android_kernel_asus_sm8350/arch
Niklas Schnelle 5b58cfcd4c s390/pci: fix max size calculation in zpci_memcpy_toio()
[ Upstream commit 80df7d6af7f6d229b34cf237b2cc9024c07111cd ]

The zpci_get_max_write_size() helper is used to determine the maximum
size a PCI store or load can use at a given __iomem address.

For the PCI block store the following restrictions apply:

1. The dst + len must not cross a 4K boundary in the (pseudo-)MMIO space
2. len must not exceed ZPCI_MAX_WRITE_SIZE
3. len must be a multiple of 8 bytes
4. The src address must be double word (8 byte) aligned
5. The dst address must be double word (8 byte) aligned

Otherwise only a normal PCI store which takes its src value from
a register can be used. For these PCI store restriction 1 still applies.
Similarly 1 also applies to PCI loads.

It turns out zpci_max_write_size() instead implements stricter
conditions which prevents PCI block stores from being used where they
can and should be used. In particular instead of conditions 4 and 5 it
wrongly enforces both dst and src to be size aligned. This indirectly
covers condition 1 but also prevents many legal PCI block stores.

On top of the functional shortcomings the zpci_get_max_write_size() is
misnamed as it is used for both read and write size calculations. Rename
it to zpci_get_max_io_size() and implement the listed conditions
explicitly.

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Fixes: cd24834130 ("s390/pci: base support")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
[agordeev@linux.ibm.com replaced spaces with tabs]
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-01-25 14:34:32 -08:00
..
alpha alpha: remove __init annotation from exported page_is_ram() 2023-08-16 18:19:25 +02:00
arc ARC: fix spare error 2024-01-25 14:34:20 -08:00
arm ARM: davinci: always select CONFIG_CPU_ARM926T 2024-01-25 14:34:26 -08:00
arm64 arm64: dts: qcom: sdm845-db845c: correct LED panic indicator 2024-01-25 14:34:25 -08:00
c6x dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
csky dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
h8300 h8300: Fix build errors from do_exit() to make_task_dead() transition 2023-02-06 07:52:49 +01:00
hexagon dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
ia64 ia64/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
m68k m68k: Fix invalid .section syntax 2023-09-23 10:59:38 +02:00
microblaze dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
mips MIPS: Alchemy: Fix an out-of-bound access in db1550_dev_setup() 2024-01-25 14:34:30 -08:00
nds32 dma-mapping: drop the dev argument to arch_sync_dma_for_* 2023-04-05 11:16:43 +02:00
nios2 nios2: dts: Fix tse_mac "max-frame-size" property 2023-06-21 15:44:10 +02:00
openrisc openrisc: Properly store r31 to pt_regs on unhandled exceptions 2023-05-17 11:35:53 +02:00
parisc parisc/pgtable: Do not drop upper 5 address bits of physical address 2023-11-28 16:50:20 +00:00
powerpc powerpc/imc-pmu: Add a null pointer check in update_events_in_group() 2024-01-25 14:34:22 -08:00
riscv riscv: Bump COMMAND_LINE_SIZE value to 1024 2023-04-05 11:16:39 +02:00
s390 s390/pci: fix max size calculation in zpci_memcpy_toio() 2024-01-25 14:34:32 -08:00
sh sh: bios: Revive earlyprintk support 2023-11-20 10:30:13 +01:00
sparc sparc/cpu: Switch to arch_cpu_finalize_init() 2023-08-08 19:56:34 +02:00
um um: Fix hostaudio build errors 2023-09-23 10:59:53 +02:00
unicore32
x86 x86/kvm: Do not try to disable kvmclock if it was not enabled 2024-01-25 14:34:30 -08:00
xtensa xtensa: boot/lib: fix function prototypes 2023-10-10 21:46:39 +02:00
.gitignore
Kconfig init: Provide arch_cpu_finalize_init() 2023-08-08 19:56:33 +02:00