From: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
To: Dave Jiang <dave.jiang@intel.com>, linux-cxl@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
dan.j.williams@intel.com, ira.weiny@intel.com, lukas@wunner.de,
Terry Bowman <terry.bowman@amd.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
"Richter, Robert" <robert.richter@amd.com>,
Fontenot Nathan <nathan.fontenot@amd.com>,
"Kodamati,
PradeepVineshReddy (Pradeep Vinesh Reddy)"
<PradeepVineshReddy.Kodamati@amd.com>
Subject: Re: [PATCH v9] cxl: add RAS status unmasking for CXL
Date: Tue, 11 Jul 2023 11:18:51 -0700 [thread overview]
Message-ID: <0975a0d9-7b9b-e959-5621-928ac90fcb66@amd.com> (raw)
In-Reply-To: <167700213490.106661.13890376014908981260.stgit@djiang5-mobl3.local>
Hi all,
I understand this has been in upstream already. But I have a slight
confusion on one of the checks been done here.
On 2/21/2023 9:55 AM, Dave Jiang wrote:
> By default the CXL RAS mask registers bits are defaulted to 1's and
> suppress all error reporting. If the kernel has negotiated ownership
> of error handling for CXL then unmask the mask registers by writing 0s.
>
> PCI_EXP_DEVCTL capability is checked to see uncorrectable or correctable
> errors bits are set before unmasking the respective errors.
>
> Acked-by: Bjorn Helgaas <bhelgaas@google.com> # pci_regs.h
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
>
> ---
> +static int cxl_pci_ras_unmask(struct pci_dev *pdev)
> +{
> + struct pci_host_bridge *host_bridge = pci_find_host_bridge(pdev->bus);
> + struct cxl_dev_state *cxlds = pci_get_drvdata(pdev);
> + void __iomem *addr;
> + u32 orig_val, val, mask;
> + u16 cap;
> + int rc;
> +
> + if (!cxlds->regs.ras) {
> + dev_dbg(&pdev->dev, "No RAS registers.\n");
> + return 0;
> + }
> +
> + /* BIOS has CXL error control */
> + if (!host_bridge->native_cxl_error)
> + return -EOPNOTSUPP;
Why are we checking for native_cxl_error (native_cxl_error is CXL Memory
Error Reporting Control _OSC bit..) while unmasking RAS status?
RAS registers will be reported on a protocol error and the protocol
error follows the PCIe AER. Should we check for AER _OSC instead of CXL
Memory Error _OSC?
Because atleast on AMD systems we log RAS registers only on Protocol
errors and we use this CXL Memory _OSC knob to report component errors.
Is it same across everywhere? And there might be cases where protocol
error reporting might be native (PCIe AER) and component/memory can be
FW-First which fails this check..
Thanks,
Smita
> +
> + rc = pcie_capability_read_word(pdev, PCI_EXP_DEVCTL, &cap);
> + if (rc)
> + return rc;
> +
> + if (cap & PCI_EXP_DEVCTL_URRE) {
> + addr = cxlds->regs.ras + CXL_RAS_UNCORRECTABLE_MASK_OFFSET;
> + orig_val = readl(addr);
> +
> + mask = CXL_RAS_UNCORRECTABLE_MASK_MASK;
> + if (!cxl_pci_flit_256(pdev))
> + mask &= ~CXL_RAS_UNCORRECTABLE_MASK_F256B_MASK;
> + val = orig_val & ~mask;
> + writel(val, addr);
> + dev_dbg(&pdev->dev,
> + "Uncorrectable RAS Errors Mask: %#x -> %#x\n",
> + orig_val, val);
> + }
> +
> + if (cap & PCI_EXP_DEVCTL_CERE) {
> + addr = cxlds->regs.ras + CXL_RAS_CORRECTABLE_MASK_OFFSET;
> + orig_val = readl(addr);
> + val = orig_val & ~CXL_RAS_CORRECTABLE_MASK_MASK;
> + writel(val, addr);
> + dev_dbg(&pdev->dev, "Correctable RAS Errors Mask: %#x -> %#x\n",
> + orig_val, val);
> + }
> +
> + return 0;
> +}
> +
> static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> {
> struct pci_host_bridge *host_bridge = pci_find_host_bridge(pdev->bus);
> @@ -728,6 +789,10 @@ static int cxl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> if (rc)
> return rc;
>
> + rc = cxl_pci_ras_unmask(pdev);
> + if (rc)
> + dev_dbg(&pdev->dev, "No RAS reporting unmasked\n");
> +
> pci_save_state(pdev);
>
> return rc;
> diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h
> index 85ab1278811e..dc2000e0fe3a 100644
> --- a/include/uapi/linux/pci_regs.h
> +++ b/include/uapi/linux/pci_regs.h
> @@ -693,6 +693,7 @@
> #define PCI_EXP_LNKCTL2_TX_MARGIN 0x0380 /* Transmit Margin */
> #define PCI_EXP_LNKCTL2_HASD 0x0020 /* HW Autonomous Speed Disable */
> #define PCI_EXP_LNKSTA2 0x32 /* Link Status 2 */
> +#define PCI_EXP_LNKSTA2_FLIT 0x0400 /* Flit Mode Status */
> #define PCI_CAP_EXP_ENDPOINT_SIZEOF_V2 0x32 /* end of v2 EPs w/ link */
> #define PCI_EXP_SLTCAP2 0x34 /* Slot Capabilities 2 */
> #define PCI_EXP_SLTCAP2_IBPD 0x00000001 /* In-band PD Disable Supported */
>
>
next prev parent reply other threads:[~2023-07-11 18:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-21 17:55 [PATCH v9] cxl: add RAS status unmasking for CXL Dave Jiang
2023-02-23 5:01 ` Ira Weiny
2023-07-11 18:18 ` Smita Koralahalli [this message]
2023-07-13 21:21 ` Dan Williams
2023-07-13 21:50 ` Smita Koralahalli
2023-07-14 13:51 ` Yazen Ghannam
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=0975a0d9-7b9b-e959-5621-928ac90fcb66@amd.com \
--to=smita.koralahallichannabasappa@amd.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=PradeepVineshReddy.Kodamati@amd.com \
--cc=bhelgaas@google.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=nathan.fontenot@amd.com \
--cc=robert.richter@amd.com \
--cc=terry.bowman@amd.com \
--cc=yazen.ghannam@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