Files
linux/arch/s390/include/asm
Niklas Schnelle 80df7d6af7 s390/pci: fix max size calculation in zpci_memcpy_toio()
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>
2024-01-11 18:22:58 +01:00
..
2021-07-27 09:39:15 +02:00
2022-05-11 14:40:57 +02:00
2020-08-26 18:47:21 +02:00
2023-06-05 09:36:39 +02:00
2023-06-05 09:36:40 +02:00
2023-07-24 12:12:24 +02:00
2020-12-16 14:55:49 +01:00
2022-07-13 14:42:11 +00:00
2023-02-15 11:07:01 +01:00
2023-08-18 10:12:34 -07:00
2022-12-06 16:18:22 +01:00
2023-08-09 15:20:51 +02:00
2023-11-05 22:34:58 +01:00
2021-08-03 14:31:40 +02:00
2020-02-27 16:02:21 +01:00
2023-10-02 08:43:00 +02:00
2023-10-02 08:43:00 +02:00
2023-06-05 09:36:39 +02:00
2024-01-05 10:17:44 -08:00
2020-09-14 11:38:35 +02:00
2022-06-30 19:40:36 +02:00
2023-12-11 14:33:07 +01:00
2022-05-11 14:40:57 +02:00
2021-06-18 16:41:21 +02:00
2022-01-30 21:17:00 -05:00
2021-07-08 15:37:28 +02:00
2021-01-19 12:29:26 +01:00