From patchwork Mon Feb 6 20:51:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Jiang X-Patchwork-Id: 13130589 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 412BCC636D3 for ; Mon, 6 Feb 2023 20:51:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbjBFUvv (ORCPT ); Mon, 6 Feb 2023 15:51:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230354AbjBFUvu (ORCPT ); Mon, 6 Feb 2023 15:51:50 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1E492B097; Mon, 6 Feb 2023 12:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675716709; x=1707252709; h=subject:from:to:cc:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ANJK4WgXvZBb1RvzfDrGlJT/1Xf1pViUoSVpIMURtjI=; b=UFFYySA1LWF+9VBYxRHlZFKTA3MveMNcoufbCJvzRZcCekQUtFeIESsb S1yo7yBWVADFLTCFsTx749F9A8aCZSNYa0EFzJ8WVMNwHBW3rXnHvb3d6 55scEKV4a4/VzxHsHIyium4w+Gcbf080f2zi/xBYWI9Q7826jBXeoOEKq uRqykxNH2mtPi9PERlIi7TkMy/6uU3fGh3CbDkB56n5UBBIpmOuQpJ7gY UpfUd6oQBSPRoeZfFfaTv/i0NrotkjnzSCHqTiK8u69/KyMchMmI9Q6OP 198pnKk1dL4mQ4txGjntmF1ehuWH7iOpQY1qKH0pOQIvmHN90bY3rEoTH w==; X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="327946637" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="327946637" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 12:51:49 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="790552372" X-IronPort-AV: E=Sophos;i="5.97,276,1669104000"; d="scan'208";a="790552372" Received: from djiang5-mobl3.amr.corp.intel.com (HELO djiang5-mobl3.local) ([10.212.111.195]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 12:51:48 -0800 Subject: [PATCH 16/18] cxl: Move reading of CDAT data from device to after media is ready From: Dave Jiang To: linux-cxl@vger.kernel.org, linux-pci@vger.kernel.org, linux-acpi@vger.kernel.org Cc: dan.j.williams@intel.com, ira.weiny@intel.com, vishal.l.verma@intel.com, alison.schofield@intel.com, rafael@kernel.org, bhelgaas@google.com, robert.moore@intel.com Date: Mon, 06 Feb 2023 13:51:46 -0700 Message-ID: <167571670516.587790.14112456054041985666.stgit@djiang5-mobl3.local> In-Reply-To: <167571650007.587790.10040913293130712882.stgit@djiang5-mobl3.local> References: <167571650007.587790.10040913293130712882.stgit@djiang5-mobl3.local> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org The CDAT data is only valid after the hardware signals the media is ready. Move the reading to after cxl_await_media_ready() has succeeded. Signed-off-by: Dave Jiang --- drivers/cxl/port.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/cxl/port.c b/drivers/cxl/port.c index b7a4a1be2945..6b2ad22487f5 100644 --- a/drivers/cxl/port.c +++ b/drivers/cxl/port.c @@ -91,9 +91,6 @@ static int cxl_port_probe(struct device *dev) struct cxl_memdev *cxlmd = to_cxl_memdev(port->uport); struct cxl_dev_state *cxlds = cxlmd->cxlds; - /* Cache the data early to ensure is_visible() works */ - read_cdat_data(port); - get_device(&cxlmd->dev); rc = devm_add_action_or_reset(dev, schedule_detach, cxlmd); if (rc) @@ -109,6 +106,8 @@ static int cxl_port_probe(struct device *dev) return rc; } + /* Cache the data early to ensure is_visible() works */ + read_cdat_data(port); if (port->cdat.table) { rc = cdat_table_parse_dsmas(port->cdat.table, cxl_dsmas_parse_entry,