]> www.infradead.org Git - users/jedix/linux-maple.git/commit
PCI: endpoint: pci-epf-test: Handle endianness properly
authorNiklas Cassel <cassel@kernel.org>
Mon, 27 Jan 2025 16:12:42 +0000 (17:12 +0100)
committerKrzysztof Wilczyński <kwilczynski@kernel.org>
Sat, 8 Mar 2025 14:42:38 +0000 (14:42 +0000)
commit3c936e0ec0e412a3ce6072883da8682fb723d573
tree8b93074665db0e2ca7701cad2d18d9bd8ea30b61
parent2014c95afecee3e76ca4a56956a936e23283f05b
PCI: endpoint: pci-epf-test: Handle endianness properly

The struct pci_epf_test_reg is the actual data in pci-epf-test's test_reg
BAR (usually BAR0), which the host uses to send commands (etc.), and which
pci-epf-test uses to send back status codes.

pci-epf-test currently reads and writes this data without any endianness
conversion functions, which means that pci-epf-test is completely broken
on big-endian endpoint systems.

PCI devices are inherently little-endian, and the data stored in the PCI
BARs should be in little-endian.

Use endianness conversion functions when reading and writing data to
struct pci_epf_test_reg so that pci-epf-test will behave correctly on
big-endian endpoint systems.

Fixes: 349e7a85b25f ("PCI: endpoint: functions: Add an EP function to test PCI")
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://lore.kernel.org/r/20250127161242.104651-2-cassel@kernel.org
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>
drivers/pci/endpoint/functions/pci-epf-test.c