linux-stable/include
Lukas Wunner 027882381a cxl/pci: Fix CDAT retrieval on big endian
commit fbaa38214c upstream.

The CDAT exposed in sysfs differs between little endian and big endian
arches:  On big endian, every 4 bytes are byte-swapped.

PCI Configuration Space is little endian (PCI r3.0 sec 6.1).  Accessors
such as pci_read_config_dword() implicitly swap bytes on big endian.
That way, the macros in include/uapi/linux/pci_regs.h work regardless of
the arch's endianness.  For an example of implicit byte-swapping, see
ppc4xx_pciex_read_config(), which calls in_le32(), which uses lwbrx
(Load Word Byte-Reverse Indexed).

DOE Read/Write Data Mailbox Registers are unlike other registers in
Configuration Space in that they contain or receive a 4 byte portion of
an opaque byte stream (a "Data Object" per PCIe r6.0 sec 7.9.24.5f).
They need to be copied to or from the request/response buffer verbatim.
So amend pci_doe_send_req() and pci_doe_recv_resp() to undo the implicit
byte-swapping.

The CXL_DOE_TABLE_ACCESS_* and PCI_DOE_DATA_OBJECT_DISC_* macros assume
implicit byte-swapping.  Byte-swap requests after constructing them with
those macros and byte-swap responses before parsing them.

Change the request and response type to __le32 to avoid sparse warnings.
Per a request from Jonathan, replace sizeof(u32) with sizeof(__le32) for
consistency.

Fixes: c97006046c ("cxl/port: Read CDAT table")
Tested-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Cc: stable@vger.kernel.org # v6.0+
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/3051114102f41d19df3debbee123129118fc5e6d.1678543498.git.lukas@wunner.de
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-04-13 17:02:42 +02:00
..
acpi ACPI: x86: Introduce an acpi_quirk_skip_gpio_event_handlers() helper 2023-04-06 12:12:26 +02:00
asm-generic arch: fix broken BuildID for arm64 and riscv 2022-12-30 17:21:51 +09:00
clocksource
crypto
drm drm/bridge: Fix returned array size name for atomic_get_input_bus_fmts kdoc 2023-03-22 13:37:49 +01:00
dt-bindings remoteproc updates for v6.2 2022-12-21 09:37:14 -08:00
keys
kunit kunit: fix kunit_test_init_section_suites(...) 2023-01-31 09:10:38 -07:00
kvm KVM: arm64: Add helper vgic_write_guest_lock() 2023-01-29 18:46:11 +00:00
linux cxl/pci: Fix CDAT retrieval on big endian 2023-04-13 17:02:42 +02:00
math-emu
media media: uvcvideo: Add GUID for BGRA/X 8:8:8:8 2023-03-11 13:50:41 +01:00
memory memory: renesas-rpc-if: Split-off private data from struct rpcif 2023-03-11 13:50:21 +01:00
misc
net raw: Fix NULL deref in raw_get_next(). 2023-04-13 17:02:41 +02:00
pcmcia
ras
rdma
rv
scsi scsi: core: Add BLIST_NO_VPD_SIZE for some VDASD 2023-03-22 13:37:44 +01:00
soc firmware: raspberrypi: Fix type assignment 2023-01-10 13:44:04 -08:00
sound ASoC: soc-dapm.h: fixup warning struct snd_pcm_substream not declared 2023-03-10 09:28:40 +01:00
target
trace rcu: Fix rcu_torture_read ftrace event 2023-04-06 12:12:45 +02:00
uapi usb: uvc: Enumerate valid values for color matching 2023-03-11 13:50:44 +01:00
ufs scsi: ufs: exynos: Fix DMA alignment for PAGE_SIZE != 4096 2023-03-10 09:28:31 +01:00
vdso
video
xen x86/PVH: obtain VGA console info in Dom0 2023-04-06 12:12:27 +02:00