cxl: Fix the incorrect assignment of SSLBIS entry pointer initial location
authorDave Jiang <dave.jiang@intel.com>
Fri, 1 Mar 2024 21:09:48 +0000 (14:09 -0700)
committerDan Williams <dan.j.williams@intel.com>
Wed, 13 Mar 2024 06:41:59 +0000 (23:41 -0700)
commit99b52aac2d40203d0f6468325018f68e2c494c24
tree46df42c48b2c0073da15bc30297e918579df03a6
parentd206a76d7d2726f3b096037f2079ce0bd3ba329b
cxl: Fix the incorrect assignment of SSLBIS entry pointer initial location

The 'entry' pointer in cdat_sslbis_handler() is set to header +
sizeof(common header). However, the math missed the addition of the SSLBIS
main header. It should be header + sizeof(common header) + sizeof(*sslbis).
Use a defined struct for all the SSLBIS parts in order to avoid pointer
math errors.

The bug causes incorrect parsing of the SSLBIS table and introduces incorrect
performance values to the access_coordinates during the CXL access_coordinate
calculation path if there are CXL switches present in the topology.

The issue was found during testing of new code being added to add additional
checks for invalid CDAT values during CXL access_coordinate calculation. The
testing was done on qemu with a CXL topology including a CXL switch.

Fixes: 80aa780dda20 ("cxl: Add callback to parse the SSLBIS subtable from CDAT")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Fan Ni <fan.ni@samsung.com>
Link: https://lore.kernel.org/r/20240301210948.1298075-1-dave.jiang@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/core/cdat.c