From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Ben Cheatham <Benjamin.Cheatham@amd.com>
Cc: <linux-cxl@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 03/16] PCI: PCIe portdrv: Add CXL Isolation service driver
Date: Fri, 12 Sep 2025 16:14:58 +0100 [thread overview]
Message-ID: <20250912161458.00002d16@huawei.com> (raw)
In-Reply-To: <20250730214718.10679-4-Benjamin.Cheatham@amd.com>
On Wed, 30 Jul 2025 16:47:05 -0500
Ben Cheatham <Benjamin.Cheatham@amd.com> wrote:
> Add the CXL isolation service, which will provide the necessary
> information to the PCIe portdrv and CXL drivers to map, setup, and
> handle CXL isolation interrupts.
>
> Add functions to get the CXL isolation MSI/-X interrupt vector
> from the PCIe portdrv.
>
> Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
Hmm. I feel a bit guilty I haven't gotten back to a rework of the
portdrv. To potentially make that easier (when I or someone else
get the time), would it work for you if this only did MSI-X?
That would let us handle this in a somewhat 'pluggable' way without
having to deal with the limitations of MSI wrt to dynamic interrupt
allocation.
> ---
> drivers/cxl/Kconfig | 14 +++++
> drivers/cxl/cxl.h | 4 ++
> drivers/pci/pcie/Makefile | 1 +
> drivers/pci/pcie/cxl_isolation.c | 87 ++++++++++++++++++++++++++++++++
> drivers/pci/pcie/portdrv.c | 1 +
> drivers/pci/pcie/portdrv.h | 18 ++++++-
> 6 files changed, 124 insertions(+), 1 deletion(-)
> create mode 100644 drivers/pci/pcie/cxl_isolation.c
>
> diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig
> index 57274de54a45..537e1e8e13da 100644
> --- a/drivers/cxl/Kconfig
> +++ b/drivers/cxl/Kconfig
> @@ -247,4 +247,18 @@ config CXL_NATIVE_RAS
> If unsure, or if this kernel is meant for production environments,
> say Y.
>
> +config CXL_ISOLATION
> + bool "CXL.mem Isolation Support"
> + depends on PCIEPORTBUS
> + depends on CXL_BUS=PCIEPORTBUS
> + help
> + Enables the CXL.mem isolation PCIe port bus service driver. This
> + driver, in combination with the CXL driver core, is responsible
> + for managing CXL-capable PCIe root ports that undergo CXL.mem
> + error isolation due to either a CXL.mem transaction timeout or
> + link down condition. Without error isolation, either of these
> + conditions will trigger a system reset.
> +
> + If unsure say 'y'
I'd drop this last line or say something more about when it makes sense to enable.
> diff --git a/drivers/pci/pcie/cxl_isolation.c b/drivers/pci/pcie/cxl_isolation.c
> new file mode 100644
> index 000000000000..550f16271d1c
> --- /dev/null
> +++ b/drivers/pci/pcie/cxl_isolation.c
> @@ -0,0 +1,87 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * The CXL Isolation PCIe port service driver provides functions to allocate
> + * and set up CXL Timeout & Isolation interrupts (CXL 3.2 12.3). This driver
> + * does no actual interrupt handling, it only provides the information for
> + * the CXL driver to set up its own handling because the CXL driver is better
> + * equipped to handle isolation interrupts.
> + *
> + * Copyright (C) 2025, Advanced Micro Devices, Inc.
> + * All Rights Reserved.
> + *
> + * Author: Ben Cheatham <Benjamin.Cheatham@amd.com>
> + */
> +
> +#include <linux/pci.h>
> +
> +#include "../../cxl/cxlpci.h"
> +#include "portdrv.h"
> +
> +static int get_isolation_intr_vec(u32 cap)
> +{
> + if (!FIELD_GET(CXL_ISOLATION_CAP_INTR_SUPP, cap) ||
> + !FIELD_GET(CXL_ISOLATION_CAP_MEM_ISO_SUPP, cap))
> + return -ENXIO;
> +
> + return FIELD_GET(CXL_ISOLATION_CAP_INTR_MASK, cap);
> +}
> +
> +int pcie_cxliso_get_intr_vec(struct pci_dev *dev, int *vec)
> +{
> + struct cxl_component_regs regs;
> + struct cxl_register_map map;
> + u32 cap;
> + int rc;
> +
> + rc = cxl_find_regblock(dev, CXL_REGLOC_RBI_COMPONENT, &map);
> + if (rc)
> + return rc;
> +
> + rc = cxl_setup_regs(&map);
> + if (rc)
> + return rc;
> +
> + if (!map.component_map.isolation.valid)
> + return -ENXIO;
> +
Add some comments here on why we go through this dance of temporary mapping.
(I have similar for the CPMU code I never finished upstreaming).
> + rc = cxl_map_component_regs(&map, ®s,
> + BIT(CXL_CM_CAP_CAP_ID_ISOLATION));
> + if (rc)
> + return rc;
> +
> + cap = readl(regs.isolation + CXL_ISOLATION_CAPABILITY_OFFSET);
> + rc = get_isolation_intr_vec(cap);
> + if (rc < 0) {
Probably use a goto given common shared stuff to do on exit.
> + cxl_unmap_component_regs(&map, ®s,
> + BIT(CXL_CM_CAP_CAP_ID_ISOLATION));
> + return rc;
> + }
> +
> + if (vec)
> + *vec = rc;
> +
> + cxl_unmap_component_regs(&map, ®s, BIT(CXL_CM_CAP_CAP_ID_ISOLATION));
> + return 0;
> +
> +}
> +
> +static int cxl_isolation_probe(struct pcie_device *dev)
> +{
> + if (!pcie_is_cxl(dev->port) || pcie_cxliso_get_intr_vec(dev->port, NULL))
The second call has rich error codes so better not to eat them.
if (!pcie_is_cxl(dev->port))
return -ENXIO;
rc = pcie_cxl_iso_get_intr_vec();
if (rc)
return rc;
> + return -ENXIO;
> +
> + pci_info(dev->port, "CXLISO: Signaling with IRQ %d\n", dev->irq);
I guess there is history of this for other portdrv services, but to me too noisy
for a normal boot and should be trivial to get from /proc/interrupts
> + return 0;
> +}
next prev parent reply other threads:[~2025-09-12 15:15 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 [this message]
2025-09-17 17:26 ` Cheatham, Benjamin
2025-07-30 21:47 ` [PATCH 04/16] PCI: PCIe portdrv: Allocate CXL isolation MSI/-X vector Ben Cheatham
2025-08-04 21:39 ` 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=20250912161458.00002d16@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=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.