linux/drivers/cxl
Dave Jiang 5d211c7090 cxl: Fix cxl_endpoint_get_perf_coordinate() support for RCH
Robert reported the following when booting a CXL host with Restricted CXL
Host (RCH) topology:
 [   39.815379] cxl_acpi ACPI0017:00: not a cxl_port device
 [   39.827123] WARNING: CPU: 46 PID: 1754 at drivers/cxl/core/port.c:592 to_cxl_port+0x56/0x70 [cxl_core]

... plus some related subsequent NULL pointer dereference:

 [   40.718708] BUG: kernel NULL pointer dereference, address: 00000000000002d8

The iterator to walk the PCIe path did not account for RCH topology.
However RCH does not support hotplug and the memory exported by the
Restricted CXL Device (RCD) should be covered by HMAT and therefore no
access_coordinate is needed. Add check to see if the endpoint device is
RCD and skip calculation.

Also add a call to cxl_endpoint_get_perf_coordinates() in cxl_test in order
to exercise the topology iterator. The dev_is_pci() check added is to help
with this test and should be harmless for normal operation.

Reported-by: Robert Richter <rrichter@amd.com>
Closes: https://lore.kernel.org/all/Ziv8GfSMSbvlBB0h@rric.localdomain/
Fixes: 592780b839 ("cxl: Fix retrieving of access_coordinates in PCIe path")
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Tested-by: Robert Richter <rrichter@amd.com>
Reviewed-by: Robert Richter <rrichter@amd.com>
Link: https://lore.kernel.org/r/20240426224913.1027420-1-dave.jiang@intel.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
2024-04-29 09:03:26 -07:00
..
core cxl: Fix cxl_endpoint_get_perf_coordinate() support for RCH 2024-04-29 09:03:26 -07:00
acpi.c cxl: Consolidate dport access_coordinate ->hb_coord and ->sw_coord into ->coord 2024-04-08 08:25:21 -07:00
cxl.h cxl: Consolidate dport access_coordinate ->hb_coord and ->sw_coord into ->coord 2024-04-08 08:25:21 -07:00
cxlmem.h cxl: Consolidate dport access_coordinate ->hb_coord and ->sw_coord into ->coord 2024-04-08 08:25:21 -07:00
cxlpci.h cxl/pci: Get rid of pointer arithmetic reading CDAT table 2024-03-12 23:52:29 -07:00
Kconfig cxl: remove CONFIG_CXL_PMU entry in drivers/cxl/Kconfig 2024-03-27 01:58:34 +09:00
Makefile cxl/pmem: Introduce nvdimm_security_ops with ->get_flags() operation 2022-11-30 16:30:47 -08:00
mem.c cxl: Fix sysfs export of qos_class for memdev 2024-02-16 23:20:34 -08:00
pci.c acpi/ghes: Remove CXL CPER notifications 2024-02-20 22:50:52 -08:00
pmem.c cxl/mbox: Move mailbox related driver state to its own data structure 2023-06-25 14:31:08 -07:00
pmu.h cxl/pci: Find and register CXL PMU devices 2023-05-30 11:20:35 -07:00
port.c cxl: Refactor to use __free() for cxl_root allocation in cxl_endpoint_port_probe() 2024-01-05 14:36:29 -08:00
security.c Merge branch 'for-6.5/cxl-type-2' into for-6.5/cxl 2023-06-25 17:16:51 -07:00