linux-stable/drivers/cxl
Jonathan Cameron 721992163e cxl/regs: Fix size of CXL Capability Header Register
[ Upstream commit 74b0fe8040 ]

In CXL 2.0, 8.2.5.1 CXL Capability Header Register: this register
is given as 32 bits.

8.2.3 which covers the CXL 2.0 Component registers, including the
CXL Capability Header Register states that access restrictions
specified in Section 8.2.2 apply.

8.2.2 includes:
* A 32 bit register shall be accessed as a 4 Byte quantity.
...
If these rules are not followed, the behavior is undefined.

Discovered during review of CXL QEMU emulation. Alex Bennée pointed
out there was a comment saying that 4 byte registers must be read
with a 4 byte read, but 8 byte reads were being emulated.

https://lore.kernel.org/qemu-devel/87bkzyd3c7.fsf@linaro.org/

Fixing that, led to this code failing. Whilst a given hardware
implementation 'might' work with an 8 byte read, it should not be relied
upon. The QEMU emulation v5 will return 0 and log the wrong access width.

The code moved, so one fixes tag for where this will directly apply and
also a reference to the earlier introduction of the code for backports.

Fixes: 0f06157e01 ("cxl/core: Move register mapping infrastructure")
Fixes: 08422378c4 ("cxl/pci: Add HDM decoder capabilities")
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Ben Widawsky <ben.widawsky@intel.com>
Link: https://lore.kernel.org/r/20220201153437.2873-1-Jonathan.Cameron@huawei.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:30 +02:00
..
core cxl/regs: Fix size of CXL Capability Header Register 2022-04-08 14:23:30 +02:00
acpi.c cxl/acpi: Do not add DSDT disabled ACPI0016 host bridge ports 2021-09-07 11:39:01 -07:00
cxl.h cxl/pci: Simplify register setup 2021-08-06 08:27:02 -07:00
cxlmem.h cxl/mem: Account for partitionable space in ram/pmem ranges 2021-08-10 11:57:59 -07:00
Kconfig cxl/pmem: Add initial infrastructure for pmem support 2021-06-15 16:47:14 -07:00
Makefile cxl: Move cxl_core to new directory 2021-08-06 08:22:53 -07:00
pci.c cxl/pci: Fix NULL vs ERR_PTR confusion 2021-11-18 19:16:04 +01:00
pci.h cxl/pci: Simplify register setup 2021-08-06 08:27:02 -07:00
pmem.c cxl/pmem: Fix reference counting for delayed work 2022-01-27 11:02:58 +01:00