* [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev
2023-09-05 18:44 [PATCH v3 0/3] CXL, ACPI, APEI, EINJ: Update EINJ for CXL 1.1 error types Ben Cheatham
@ 2023-09-05 18:44 ` Ben Cheatham
2023-09-05 20:22 ` kernel test robot
2023-09-05 18:44 ` [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support Ben Cheatham
2023-09-05 18:44 ` [PATCH v3 3/3] ACPI, APEI, EINJ: Update EINJ documentation Ben Cheatham
2 siblings, 1 reply; 7+ messages in thread
From: Ben Cheatham @ 2023-09-05 18:44 UTC (permalink / raw)
To: rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: bhelgaas, benjamin.cheatham, yazen.ghannam
Add cxl_rcrb_addr to the dport_dev (normally represented by a pcie
device) for CXL RCH root ports. The file will print the RCRB base
MMIO address of the root port when read and will be used by
users looking to inject CXL EINJ error types for RCH hosts.
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
Documentation/ABI/testing/sysfs-bus-cxl | 8 ++++++
drivers/cxl/acpi.c | 2 ++
drivers/cxl/core/port.c | 33 +++++++++++++++++++++++++
drivers/cxl/cxl.h | 2 ++
4 files changed, 45 insertions(+)
diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl
index 087f762ebfd5..a7d169235543 100644
--- a/Documentation/ABI/testing/sysfs-bus-cxl
+++ b/Documentation/ABI/testing/sysfs-bus-cxl
@@ -177,6 +177,14 @@ Description:
integer reflects the hardware port unique-id used in the
hardware decoder target list.
+What: /sys/bus/cxl/devices/portX/dportY/cxl_rcrb_addr
+Date: August, 2023
+KernelVersion: v6.6
+Contact: linux-cxl@vger.kernel.org
+Description:
+ (RO) The 'cxl_rcrb_addr' device file gives the MMIO base address
+ of the RCRB of the corresponding CXL 1.1 downstream port. Only
+ present for CXL 1.1 dports.
What: /sys/bus/cxl/devices/decoderX.Y
Date: June, 2021
diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
index d1c559879dcc..3e2ca946bf47 100644
--- a/drivers/cxl/acpi.c
+++ b/drivers/cxl/acpi.c
@@ -676,6 +676,8 @@ static int cxl_acpi_probe(struct platform_device *pdev)
if (IS_ERR(root_port))
return PTR_ERR(root_port);
+ set_cxl_root(root_port);
+
rc = bus_for_each_dev(adev->dev.bus, NULL, root_port,
add_host_bridge_dport);
if (rc < 0)
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index 724be8448eb4..b69fd1c1d5d6 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -875,6 +875,14 @@ struct cxl_port *find_cxl_root(struct cxl_port *port)
}
EXPORT_SYMBOL_NS_GPL(find_cxl_root, CXL);
+static struct cxl_port *cxl_root;
+
+void set_cxl_root(struct cxl_port *root_port)
+{
+ cxl_root = root_port;
+}
+EXPORT_SYMBOL_NS_GPL(set_cxl_root, CXL);
+
static struct cxl_dport *find_dport(struct cxl_port *port, int id)
{
struct cxl_dport *dport;
@@ -930,11 +938,30 @@ static void cond_cxl_root_unlock(struct cxl_port *port)
device_unlock(&port->dev);
}
+static ssize_t cxl_rcrb_addr_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct cxl_dport *dport;
+
+ if (!cxl_root)
+ return -ENODEV;
+
+ dport = cxl_find_dport_by_dev(cxl_root, dev);
+ if (!dport)
+ return -ENODEV;
+
+ return sysfs_emit(buf, "0x%llx\n", dport->rcrb.base);
+}
+DEVICE_ATTR_RO(cxl_rcrb_addr);
+
static void cxl_dport_remove(void *data)
{
struct cxl_dport *dport = data;
struct cxl_port *port = dport->port;
+ if (dport->rch)
+ device_remove_file(dport->dport_dev, &dev_attr_cxl_rcrb_addr);
+
xa_erase(&port->dports, (unsigned long) dport->dport_dev);
put_device(dport->dport_dev);
}
@@ -1021,6 +1048,12 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev,
if (rc)
return ERR_PTR(rc);
+ if (dport->rch && dport->rcrb.base != CXL_RESOURCE_NONE) {
+ rc = device_create_file(dport_dev, &dev_attr_cxl_rcrb_addr);
+ if (rc)
+ return ERR_PTR(rc);
+ }
+
return dport;
}
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 76d92561af29..4d5bce4bae7e 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -690,6 +690,8 @@ struct cxl_port *devm_cxl_add_port(struct device *host,
resource_size_t component_reg_phys,
struct cxl_dport *parent_dport);
struct cxl_port *find_cxl_root(struct cxl_port *port);
+void set_cxl_root(struct cxl_port *root_port);
+
int devm_cxl_enumerate_ports(struct cxl_memdev *cxlmd);
void cxl_bus_rescan(void);
void cxl_bus_drain(void);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev
2023-09-05 18:44 ` [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev Ben Cheatham
@ 2023-09-05 20:22 ` kernel test robot
0 siblings, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-05 20:22 UTC (permalink / raw)
To: Ben Cheatham, rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: oe-kbuild-all, bhelgaas, benjamin.cheatham, yazen.ghannam
Hi Ben,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.5 next-20230905]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ben-Cheatham/CXL-PCIE-Add-cxl_rcrb_addr-file-to-dport_dev/20230906-025405
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20230905184406.135851-2-Benjamin.Cheatham%40amd.com
patch subject: [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev
config: parisc-allyesconfig (https://download.01.org/0day-ci/archive/20230906/202309060435.NqPCZpql-lkp@intel.com/config)
compiler: hppa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/202309060435.NqPCZpql-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309060435.NqPCZpql-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/cxl/core/port.c: In function 'cxl_rcrb_addr_show':
>> drivers/cxl/core/port.c:953:38: warning: format '%llx' expects argument of type 'long long unsigned int', but argument 3 has type 'resource_size_t' {aka 'unsigned int'} [-Wformat=]
953 | return sysfs_emit(buf, "0x%llx\n", dport->rcrb.base);
| ~~~^ ~~~~~~~~~~~~~~~~
| | |
| | resource_size_t {aka unsigned int}
| long long unsigned int
| %x
vim +953 drivers/cxl/core/port.c
940
941 static ssize_t cxl_rcrb_addr_show(struct device *dev,
942 struct device_attribute *attr, char *buf)
943 {
944 struct cxl_dport *dport;
945
946 if (!cxl_root)
947 return -ENODEV;
948
949 dport = cxl_find_dport_by_dev(cxl_root, dev);
950 if (!dport)
951 return -ENODEV;
952
> 953 return sysfs_emit(buf, "0x%llx\n", dport->rcrb.base);
954 }
955 DEVICE_ATTR_RO(cxl_rcrb_addr);
956
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support
2023-09-05 18:44 [PATCH v3 0/3] CXL, ACPI, APEI, EINJ: Update EINJ for CXL 1.1 error types Ben Cheatham
2023-09-05 18:44 ` [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev Ben Cheatham
@ 2023-09-05 18:44 ` Ben Cheatham
2023-09-05 20:22 ` kernel test robot
2023-09-06 4:04 ` kernel test robot
2023-09-05 18:44 ` [PATCH v3 3/3] ACPI, APEI, EINJ: Update EINJ documentation Ben Cheatham
2 siblings, 2 replies; 7+ messages in thread
From: Ben Cheatham @ 2023-09-05 18:44 UTC (permalink / raw)
To: rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: bhelgaas, benjamin.cheatham, yazen.ghannam
Add support for CXL EINJ error types for CXL 1.1 hosts added in ACPI
v6.5. Because these error types target memory-mapped CXL 1.1 compliant
downstream ports and not physical (normal/persistent) memory, these
error types are not currently allowed through the memory range
validation done by the EINJ driver.
The MMIO address of a CXL 1.1 downstream port can be found in the
cxl_rcrb_addr file in the corresponding dport directory under
/sys/bus/cxl/devices/portX. CXL 1.1 error types follow the same
procedure as a memory error type, but with param1 set to the
downstream port MMIO address.
Example usage:
$ cd /sys/kernel/debug/apei/einj
$ cat available_error_type
0x00000008 Memory Correctable
0x00000010 Memory Uncorrectable non-fatal
0x00000020 Memory Uncorrectable fatal
0x00000040 PCI Express Correctable
0x00000080 PCI Express Uncorrectable non-fatal
0x00000100 PCI Express Uncorrectable fatal
0x00008000 CXL.mem Protocol Correctable
0x00020000 CXL.mem Protocol Uncorrectable fatal
$ echo 0x8000 > error_type
$ echo 0xfffffffffffff000 > param2
$ echo 0x3 > flags
$ cat /sys/bus/cxl/devices/portX/dportY/cxl_rcrb_addr
0xb2f00000
$ echo 0xb2f00000 > param1
$ echo 1 > error_inject
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
drivers/acpi/apei/einj.c | 26 +++++++++++++++++++++++++-
drivers/cxl/core/port.c | 17 +++++++++++++++++
drivers/cxl/cxl.h | 1 +
include/linux/cxl.h | 18 ++++++++++++++++++
4 files changed, 61 insertions(+), 1 deletion(-)
create mode 100644 include/linux/cxl.h
diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c
index 013eb621dc92..0783ddd3ab4d 100644
--- a/drivers/acpi/apei/einj.c
+++ b/drivers/acpi/apei/einj.c
@@ -21,6 +21,7 @@
#include <linux/nmi.h>
#include <linux/delay.h>
#include <linux/mm.h>
+#include <linux/cxl.h>
#include <asm/unaligned.h>
#include "apei-internal.h"
@@ -36,6 +37,7 @@
#define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \
ACPI_EINJ_MEMORY_UNCORRECTABLE | \
ACPI_EINJ_MEMORY_FATAL)
+#define CXL_ERROR_MASK GENMASK(17, 12)
/*
* ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action.
@@ -512,6 +514,24 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
return rc;
}
+static int is_valid_cxl_addr(u64 addr)
+{
+ struct cxl_dport *dport;
+
+ if (IS_REACHABLE(CONFIG_CXL_ACPI)) {
+ dport = cxl_find_rch_dport_by_rcrb((resource_size_t) addr);
+
+ if (!IS_ERR_OR_NULL(dport))
+ return 1;
+ } else {
+ pr_err("CONFIG_CXL_ACPI is not reachable.\n");
+ return 0;
+ }
+
+ pr_info("Could not find dport with rcrb 0x%llx\n", addr);
+ return 0;
+}
+
/* Inject the specified hardware error */
static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
u64 param3, u64 param4)
@@ -537,8 +557,11 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
if (type & ACPI5_VENDOR_BIT) {
if (vendor_flags != SETWA_FLAGS_MEM)
goto inject;
- } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM))
+ } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) {
goto inject;
+ } else if (type & CXL_ERROR_MASK && is_valid_cxl_addr(param1)) {
+ goto inject;
+ }
/*
* Disallow crazy address masks that give BIOS leeway to pick
@@ -807,3 +830,4 @@ module_exit(einj_exit);
MODULE_AUTHOR("Huang Ying");
MODULE_DESCRIPTION("APEI Error INJection support");
MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS(CXL);
diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
index b69fd1c1d5d6..3961f099a775 100644
--- a/drivers/cxl/core/port.c
+++ b/drivers/cxl/core/port.c
@@ -1122,6 +1122,23 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port,
}
EXPORT_SYMBOL_NS_GPL(devm_cxl_add_rch_dport, CXL);
+struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
+{
+ struct cxl_dport *dport;
+ unsigned long index;
+
+ if (!cxl_root)
+ return ERR_PTR(-ENODEV);
+
+ xa_for_each(&cxl_root->dports, index, dport)
+ if ((dport->rch && dport->rcrb.base != CXL_RESOURCE_NONE)
+ && dport->rcrb.base == rcrb_base)
+ return dport;
+
+ return NULL;
+}
+EXPORT_SYMBOL_NS_GPL(cxl_find_rch_dport_by_rcrb, CXL);
+
static int add_ep(struct cxl_ep *new)
{
struct cxl_port *port = new->dport->port;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 4d5bce4bae7e..3e6779dbcd23 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -8,6 +8,7 @@
#include <linux/bitfield.h>
#include <linux/bitops.h>
#include <linux/log2.h>
+#include <linux/cxl.h>
#include <linux/io.h>
/**
diff --git a/include/linux/cxl.h b/include/linux/cxl.h
new file mode 100644
index 000000000000..09889581d9f1
--- /dev/null
+++ b/include/linux/cxl.h
@@ -0,0 +1,18 @@
+#ifndef _LINUX_CXL_H
+#define _LINUX_CXL_H
+
+#include <linux/xarray.h>
+#include <linux/errno.h>
+
+struct cxl_dport;
+
+#if IS_ENABLED(CONFIG_CXL_ACPI)
+struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base);
+#else
+struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
+{
+ return NULL;
+}
+#endif
+
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support
2023-09-05 18:44 ` [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support Ben Cheatham
@ 2023-09-05 20:22 ` kernel test robot
2023-09-06 4:04 ` kernel test robot
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-05 20:22 UTC (permalink / raw)
To: Ben Cheatham, rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: oe-kbuild-all, bhelgaas, benjamin.cheatham, yazen.ghannam
Hi Ben,
kernel test robot noticed the following build warnings:
[auto build test WARNING on rafael-pm/linux-next]
[also build test WARNING on linus/master v6.5 next-20230905]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ben-Cheatham/CXL-PCIE-Add-cxl_rcrb_addr-file-to-dport_dev/20230906-025405
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20230905184406.135851-3-Benjamin.Cheatham%40amd.com
patch subject: [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20230906/202309060439.NyMjpqql-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/202309060439.NyMjpqql-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309060439.NyMjpqql-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/cxl/cxl.h:11,
from drivers/cxl/cxlmem.h:9,
from drivers/cxl/core/port.c:11:
>> include/linux/cxl.h:12:19: warning: no previous prototype for 'cxl_find_rch_dport_by_rcrb' [-Wmissing-prototypes]
12 | struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/cxl/core/port.c:1125:19: error: redefinition of 'cxl_find_rch_dport_by_rcrb'
1125 | struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/cxl.h:12:19: note: previous definition of 'cxl_find_rch_dport_by_rcrb' with type 'struct cxl_dport *(resource_size_t)' {aka 'struct cxl_dport *(long long unsigned int)'}
12 | struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
--
In file included from drivers/cxl/cxl.h:11,
from drivers/cxl/cxlmem.h:9,
from drivers/cxl/core/pmem.c:6:
>> include/linux/cxl.h:12:19: warning: no previous prototype for 'cxl_find_rch_dport_by_rcrb' [-Wmissing-prototypes]
12 | struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
vim +/cxl_find_rch_dport_by_rcrb +12 include/linux/cxl.h
8
9 #if IS_ENABLED(CONFIG_CXL_ACPI)
10 struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base);
11 #else
> 12 struct cxl_dport *cxl_find_rch_dport_by_rcrb(resource_size_t rcrb_base)
13 {
14 return NULL;
15 }
16 #endif
17
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support
2023-09-05 18:44 ` [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support Ben Cheatham
2023-09-05 20:22 ` kernel test robot
@ 2023-09-06 4:04 ` kernel test robot
1 sibling, 0 replies; 7+ messages in thread
From: kernel test robot @ 2023-09-06 4:04 UTC (permalink / raw)
To: Ben Cheatham, rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: oe-kbuild-all, bhelgaas, benjamin.cheatham, yazen.ghannam
Hi Ben,
kernel test robot noticed the following build errors:
[auto build test ERROR on rafael-pm/linux-next]
[also build test ERROR on linus/master v6.5 next-20230905]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Ben-Cheatham/CXL-PCIE-Add-cxl_rcrb_addr-file-to-dport_dev/20230906-025405
base: https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git linux-next
patch link: https://lore.kernel.org/r/20230905184406.135851-3-Benjamin.Cheatham%40amd.com
patch subject: [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support
config: alpha-allmodconfig (https://download.01.org/0day-ci/archive/20230906/202309061156.nyIdvSmV-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230906/202309061156.nyIdvSmV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309061156.nyIdvSmV-lkp@intel.com/
All errors (new ones prefixed by >>):
alpha-linux-ld: drivers/cxl/security.o: in function `cxl_find_rch_dport_by_rcrb':
>> (.text+0x8d0): multiple definition of `cxl_find_rch_dport_by_rcrb'; drivers/cxl/pmem.o:(.text+0x1090): first defined here
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] ACPI, APEI, EINJ: Update EINJ documentation
2023-09-05 18:44 [PATCH v3 0/3] CXL, ACPI, APEI, EINJ: Update EINJ for CXL 1.1 error types Ben Cheatham
2023-09-05 18:44 ` [PATCH v3 1/3] CXL, PCIE: Add cxl_rcrb_addr file to dport_dev Ben Cheatham
2023-09-05 18:44 ` [PATCH v3 2/3] ACPI, APEI, EINJ: Add CXL 1.1 EINJ error type support Ben Cheatham
@ 2023-09-05 18:44 ` Ben Cheatham
2 siblings, 0 replies; 7+ messages in thread
From: Ben Cheatham @ 2023-09-05 18:44 UTC (permalink / raw)
To: rafael, dan.j.williams, linux-cxl, linux-acpi
Cc: bhelgaas, benjamin.cheatham, yazen.ghannam
Update EINJ documentation to include CXL errors in available_error_types
table and usage of the types.
Also fix a formatting error in the param4 file description that caused
the description to be on the same line as the bullet point.
Signed-off-by: Ben Cheatham <Benjamin.Cheatham@amd.com>
---
.../firmware-guide/acpi/apei/einj.rst | 26 ++++++++++++++++---
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst
index d6b61d22f525..20ae49ec4eac 100644
--- a/Documentation/firmware-guide/acpi/apei/einj.rst
+++ b/Documentation/firmware-guide/acpi/apei/einj.rst
@@ -32,6 +32,10 @@ configuration::
CONFIG_ACPI_APEI
CONFIG_ACPI_APEI_EINJ
+To use CXL error types ``CONFIG_CXL_ACPI`` needs to be set. If
+``CONFIG_CXL_ACPI`` is set to the "m" then ``CONFIG_ACPI_APEI_EINJ``
+also must be set to "m" or "n".
+
The EINJ user interface is in <debugfs mount point>/apei/einj.
The following files belong to it:
@@ -40,9 +44,9 @@ The following files belong to it:
This file shows which error types are supported:
- ================ ===================================
+ ================ =========================================
Error Type Value Error Description
- ================ ===================================
+ ================ =========================================
0x00000001 Processor Correctable
0x00000002 Processor Uncorrectable non-fatal
0x00000004 Processor Uncorrectable fatal
@@ -55,7 +59,13 @@ The following files belong to it:
0x00000200 Platform Correctable
0x00000400 Platform Uncorrectable non-fatal
0x00000800 Platform Uncorrectable fatal
- ================ ===================================
+ 0x00001000 CXL.cache Protocol Correctable
+ 0x00002000 CXL.cache Protocol Uncorrectable non-fatal
+ 0x00004000 CXL.cache Protocol Uncorrectable fatal
+ 0x00008000 CXL.mem Protocol Correctable
+ 0x00010000 CXL.mem Protocol Uncorrectable non-fatal
+ 0x00020000 CXL.mem Protocol Uncorrectable fatal
+ ================ =========================================
The format of the file contents are as above, except present are only
the available error types.
@@ -106,6 +116,7 @@ The following files belong to it:
Used when the 0x1 bit is set in "flags" to specify the APIC id
- param4
+
Used when the 0x4 bit is set in "flags" to specify target PCIe device
- notrigger
@@ -159,6 +170,13 @@ and param2 (1 = PROCESSOR, 2 = MEMORY, 4 = PCI). See your BIOS vendor
documentation for details (and expect changes to this API if vendors
creativity in using this feature expands beyond our expectations).
+CXL error types are supported from ACPI 6.5 onwards. To use these error
+types you need the MMIO address of a CXL 1.1 downstream port. You can
+find the address of dportY in /sys/bus/cxl/devices/portX/dportY/cxl_rcrb_addr
+(it's possible that the dport is under the CXL root, in that case the
+path would be /sys/us/cxl/devices/rootX/dportY/cxl_rcrb_addr).
+From there, write the address to param1 and continue as you would for a
+memory error type.
An error injection example::
@@ -201,4 +219,4 @@ The following sequence can be used:
7) Read from the virtual address. This will trigger the error
For more information about EINJ, please refer to ACPI specification
-version 4.0, section 17.5 and ACPI 5.0, section 18.6.
+version 4.0, section 17.5 and ACPI 6.5, section 18.6.
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread