public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Ming <ming4.li@intel.com>
To: linux-cxl@vger.kernel.org, rrichter@amd.com,
	terry.bowman@amd.com, dan.j.williams@intel.com,
	alison.schofield@intel.com, pengfei.xu@intel.com
Cc: Li Ming <ming4.li@intel.com>
Subject: [PATCH v2 1/2] cxl/pci: Get AER capability address from RCRB only for RCH dport
Date: Fri,  9 Aug 2024 08:27:49 +0000	[thread overview]
Message-ID: <20240809082750.3015641-2-ming4.li@intel.com> (raw)
In-Reply-To: <20240809082750.3015641-1-ming4.li@intel.com>

cxl_setup_parent_dport() needs to get RCH dport AER capability address
from RCRB to disable AER interrupt. The function does not check if dport
is RCH dport, it will get a wrong pci_host_bridge structure by dport_dev
in VH case because dport_dev points to a pci device(RP or switch DSP)
rather than a pci host bridge device.

Fixes: f05fd10d138d ("cxl/pci: Add RCH downstream port AER register discovery")
Signed-off-by: Li Ming <ming4.li@intel.com>
---
 drivers/cxl/core/pci.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c
index a663e7566c48..51132a575b27 100644
--- a/drivers/cxl/core/pci.c
+++ b/drivers/cxl/core/pci.c
@@ -834,11 +834,13 @@ static void cxl_disable_rch_root_ints(struct cxl_dport *dport)
 void cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport)
 {
 	struct device *dport_dev = dport->dport_dev;
-	struct pci_host_bridge *host_bridge;
 
-	host_bridge = to_pci_host_bridge(dport_dev);
-	if (host_bridge->native_aer)
-		dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base);
+	if (dport->rch) {
+		struct pci_host_bridge *host_bridge = to_pci_host_bridge(dport_dev);
+
+		if (host_bridge->native_aer)
+			dport->rcrb.aer_cap = cxl_rcrb_to_aer(dport_dev, dport->rcrb.base);
+	}
 
 	dport->reg_map.host = host;
 	cxl_dport_map_regs(dport);
-- 
2.40.1


  reply	other threads:[~2024-08-09  8:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09  8:27 [PATCH v2 0/2] Fix get a wrong pci host bridge in cxl_setup_parent_dport() Li Ming
2024-08-09  8:27 ` Li Ming [this message]
2024-08-09  8:27 ` [PATCH v2 2/2] cxl/test: Skip cxl_setup_parent_dport() for emulated dports Li Ming
2024-08-10  2:36   ` Pengfei Xu
2024-08-09 21:36 ` [PATCH v2 0/2] Fix get a wrong pci host bridge in cxl_setup_parent_dport() Dan Williams
2024-08-09 21:44   ` Ira Weiny
2024-08-12  6:49   ` Li, Ming4

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240809082750.3015641-2-ming4.li@intel.com \
    --to=ming4.li@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=pengfei.xu@intel.com \
    --cc=rrichter@amd.com \
    --cc=terry.bowman@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox