From: Ben Cheatham <Benjamin.Cheatham@amd.com>
To: <linux-cxl@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-acpi@vger.kernel.org>
Cc: Ben Cheatham <Benjamin.Cheatham@amd.com>
Subject: [PATCH 04/16] PCI: PCIe portdrv: Allocate CXL isolation MSI/-X vector
Date: Wed, 30 Jul 2025 16:47:06 -0500 [thread overview]
Message-ID: <20250730214718.10679-5-Benjamin.Cheatham@amd.com> (raw)
In-Reply-To: <20250730214718.10679-1-Benjamin.Cheatham@amd.com>
Update the PCIe portdrv MSI/-X vector allocation code to include the CXL
isolation service.
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
drivers/pci/pcie/portdrv.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 465d1aec4ca6..6119e2e25ad2 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -50,12 +50,12 @@ static void release_pcie_device(struct device *dev)
}
/*
- * Fill in *pme, *aer, *dpc with the relevant Interrupt Message Numbers if
+ * Fill in *pme, *aer, *dpc, *iso with the relevant Interrupt Message Numbers if
* services are enabled in "mask". Return the number of MSI/MSI-X vectors
* required to accommodate the largest Message Number.
*/
static int pcie_message_numbers(struct pci_dev *dev, int mask,
- u32 *pme, u32 *aer, u32 *dpc)
+ u32 *pme, u32 *aer, u32 *dpc, u32 *iso)
{
u32 nvec = 0, pos;
u16 reg16;
@@ -98,6 +98,11 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
}
}
+ if (mask & PCIE_PORT_SERVICE_CXLISO) {
+ if (pcie_cxliso_get_intr_vec(dev, iso) == 0)
+ nvec = max(nvec, *iso + 1);
+ }
+
return nvec;
}
@@ -113,7 +118,7 @@ static int pcie_message_numbers(struct pci_dev *dev, int mask,
static int pcie_port_enable_irq_vec(struct pci_dev *dev, int *irqs, int mask)
{
int nr_entries, nvec, pcie_irq;
- u32 pme = 0, aer = 0, dpc = 0;
+ u32 pme = 0, aer = 0, dpc = 0, iso = 0;
/* Allocate the maximum possible number of MSI/MSI-X vectors */
nr_entries = pci_alloc_irq_vectors(dev, 1, PCIE_PORT_MAX_MSI_ENTRIES,
@@ -122,7 +127,7 @@ static int pcie_port_enable_irq_vec(struct pci_dev *dev, int *irqs, int mask)
return nr_entries;
/* See how many and which Interrupt Message Numbers we actually use */
- nvec = pcie_message_numbers(dev, mask, &pme, &aer, &dpc);
+ nvec = pcie_message_numbers(dev, mask, &pme, &aer, &dpc, &iso);
if (nvec > nr_entries) {
pci_free_irq_vectors(dev);
return -EIO;
@@ -163,6 +168,9 @@ static int pcie_port_enable_irq_vec(struct pci_dev *dev, int *irqs, int mask)
if (mask & PCIE_PORT_SERVICE_DPC)
irqs[PCIE_PORT_SERVICE_DPC_SHIFT] = pci_irq_vector(dev, dpc);
+ if (mask & PCIE_PORT_SERVICE_CXLISO)
+ irqs[PCIE_PORT_SERVICE_CXLISO_SHIFT] = pci_irq_vector(dev, iso);
+
return 0;
}
@@ -278,6 +286,10 @@ static int get_port_device_capability(struct pci_dev *dev)
services |= PCIE_PORT_SERVICE_BWCTRL;
}
+ if (pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT &&
+ pcie_cxliso_get_intr_vec(dev, NULL) == 0)
+ services |= PCIE_PORT_SERVICE_CXLISO;
+
return services;
}
--
2.34.1
next prev parent reply other threads:[~2025-07-30 21:48 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-30 21:47 [PATCH 00/16] CXL.mem error isolation support Ben Cheatham
2025-07-30 21:47 ` [PATCH 01/16] cxl/regs: Add cxl_unmap_component_regs() Ben Cheatham
2025-09-12 14:46 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 02/16] cxl/regs: Add CXL Isolation capability mapping Ben Cheatham
2025-09-12 14:47 ` Jonathan Cameron
2025-07-30 21:47 ` [PATCH 03/16] PCI: PCIe portdrv: Add CXL Isolation service driver Ben Cheatham
2025-09-12 15:14 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` Ben Cheatham [this message]
2025-08-04 21:39 ` [PATCH 04/16] PCI: PCIe portdrv: Allocate CXL isolation MSI/-X vector Bjorn Helgaas
2025-08-06 17:58 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 05/16] PCI: PCIe portdrv: Add interface for getting CXL isolation IRQ Ben Cheatham
2025-07-31 5:59 ` Lukas Wunner
2025-07-31 13:13 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 06/16] cxl/core: Enable CXL.mem isolation Ben Cheatham
2025-09-12 15:21 ` Jonathan Cameron
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 07/16] cxl/core: Set up isolation interrupts Ben Cheatham
2025-09-12 15:25 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 08/16] cxl/core: Enable CXL " Ben Cheatham
2025-07-30 21:47 ` [PATCH 09/16] cxl/core: Prevent onlining CXL memory behind isolated ports Ben Cheatham
2025-07-30 21:47 ` [PATCH 10/16] cxl/core: Enable CXL.mem timeout Ben Cheatham
2025-07-30 21:47 ` [PATCH 11/16] cxl/pci: Add isolation handler Ben Cheatham
2025-07-30 21:47 ` [PATCH 12/16] PCI: PCIe portdrv: Add cxl_isolation sysfs attributes Ben Cheatham
2025-09-12 15:33 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 13/16] cxl/core, PCI: PCIe portdrv: Add CXL timeout range programming Ben Cheatham
2025-08-04 21:39 ` Bjorn Helgaas
2025-08-06 17:58 ` Cheatham, Benjamin
2025-09-12 15:55 ` Jonathan Cameron
2025-09-17 17:27 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 14/16] ACPI: Add CXL isolation _OSC fields Ben Cheatham
2025-08-22 19:19 ` Rafael J. Wysocki
2025-07-30 21:47 ` [PATCH 15/16] cxl/core, cxl/acpi: Enable CXL isolation based on _OSC handshake Ben Cheatham
2025-07-30 21:47 ` [PATCH 16/16] cxl/core, cxl/acpi: Add CXL isolation notify handler Ben Cheatham
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=20250730214718.10679-5-Benjamin.Cheatham@amd.com \
--to=benjamin.cheatham@amd.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.