kernel_samsung_a53x/arch/s390/include/asm
Niklas Schnelle 3b98a26de2 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: cd24834130ac ("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-11-18 12:12:50 +01:00
..
fpu s390/vx: fix save/restore of fpu kernel context 2024-11-18 12:11:58 +01:00
trace Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
airq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
alternative-asm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
alternative.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
appldata.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
archrandom.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asm-const.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asm-prototypes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atomic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
atomic_ops.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
barrier.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bitops.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
boot_data.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bugs.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cache.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ccwdev.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ccwgroup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
checksum.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
chpid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
chsc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cio.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clocksource.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cmb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cmpxchg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
compat.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpacf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpcmd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu_mcf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu_mf-insn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpu_mf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cpufeature.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cputime.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
crw.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
css_chars.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ctl_reg.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
current.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
delay.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
diag.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dis.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dwarf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
eadm.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ebcdic.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
elf.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exec.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extable.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
extmem.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
facility.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
fcx.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ftrace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
futex.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gmap.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hardirq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hugetlb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hw_irq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idals.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
idle.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
io.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipl.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irq.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
irqflags.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
itcw.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
jump_label.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kasan.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kbuild Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kdebug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kexec.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kprobes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm_host.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
kvm_para.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
linkage.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
livepatch.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
lowcore.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mem_detect.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mem_encrypt.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmu_context.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmzone.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
module.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nmi.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nospec-branch.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nospec-insn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
numa.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
os_info.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
page-states.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
page.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci_clp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci_debug.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci_dma.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci_insn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pci_io.h s390/pci: fix max size calculation in zpci_memcpy_toio() 2024-11-18 12:12:50 +01:00
percpu.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
perf_event.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pgalloc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pgtable.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pkey.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pnet.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
preempt.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
processor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ptdump.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ptrace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
purgatory.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
qdio.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
runtime_instr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
schid.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sclp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scsw.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
seccomp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sections.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
serial.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
set_memory.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
setup.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
shmparam.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
signal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sigp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
smp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sparsemem.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spinlock.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
spinlock_types.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stacktrace.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
stp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
string.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
switch_to.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
syscall.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
syscall_wrapper.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysinfo.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
termios.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
thread_info.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timex.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tlb.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tlbflush.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
topology.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uaccess.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unistd.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
unwind.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uprobes.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
user.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
uv.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vdso.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vga.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vmalloc.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vmlinux.lds.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vtime.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vtimer.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vx-insn.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
xor.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00