qemu/hw
Matthew Rosato 4a8d21ba50 s390x/pci: RPCIT second pass when mappings exhausted
If we encounter a new mapping while the number of available DMA entries
in vfio is 0, we are currently skipping that mapping which is a problem
if we manage to free up DMA space after that within the same RPCIT --
we will return to the guest with CC0 and have not mapped everything
within the specified range.  This issue was uncovered while testing
changes to the s390 linux kernel iommu/dma code, where a different
usage pattern was employed (new mappings start at the end of the
aperture and work back towards the front, making us far more likely
to encounter new mappings before invalidated mappings during a
global refresh).

Fix this by tracking whether any mappings were skipped due to vfio
DMA limit hitting 0; when this occurs, we still continue the range
and unmap/map anything we can - then we must re-run the range again
to pickup anything that was missed.  This must occur in a loop until
all requests are satisfied (success) or we detect that we are still
unable to complete all mappings (return ZPCI_RPCIT_ST_INSUFF_RES).

Link: https://lore.kernel.org/linux-s390/20221019144435.369902-1-schnelle@linux.ibm.com/
Fixes: 37fa32de70 ("s390x/pci: Honor DMA limits set by vfio")
Reported-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Matthew Rosato <mjrosato@linux.ibm.com>
Message-Id: <20221028194758.204007-2-mjrosato@linux.ibm.com>
Reviewed-by: Eric Farman <farman@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2022-11-06 12:27:35 +01:00
..
9pfs Pull request 2022-10-25 11:37:17 -04:00
acpi hw/acpi: Add ospm_status hook implementation for acpi-ged 2022-09-22 16:38:28 +01:00
adc
alpha hw: Remove unused MAX_IDE_BUS define 2022-10-31 11:32:07 +01:00
arm hw/arm/boot: Set SCR_EL3.HXEn when booting kernel 2022-11-04 10:58:58 +00:00
audio
avr
block ppc patch queue for 2022-10-29: 2022-10-31 06:28:43 -04:00
char Drop useless casts from g_malloc() & friends to pointer 2022-10-22 23:15:40 +02:00
core Pull request 2022-10-30 15:07:25 -04:00
cpu
cris
cxl
display Drop useless casts from g_malloc() & friends to pointer 2022-10-22 23:15:40 +02:00
dma treewide: Remove the unnecessary space before semicolon 2022-10-24 13:41:10 +02:00
gpio hw/gpio/meson: Introduce dedicated config switch for hw/gpio/mpc8xxx 2022-10-17 16:15:09 -03:00
hppa hw: Remove unused MAX_IDE_BUS define 2022-10-31 11:32:07 +01:00
hyperv hw/hyperv/hyperv.c: Use device_cold_reset() instead of device_legacy_reset() 2022-10-27 10:27:23 +01:00
i2c hw/i2c/aspeed: Fix old reg slave receive 2022-10-24 11:20:15 +02:00
i386 * bug fixes 2022-11-03 10:54:37 -04:00
ide hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h 2022-10-31 18:48:23 +00:00
input
intc hw/intc: Fix LoongArch extioi coreisr accessing 2022-11-04 17:07:40 +08:00
ipack
ipmi
isa hw/isa/piix4: Move pci_ide_create_devs() call to board code 2022-10-31 11:32:07 +01:00
loongarch hw/loongarch: Add TPM device for LoongArch virt machine 2022-11-04 17:09:39 +08:00
m68k m68k/q800: do not re-randomize RNG seed on snapshot load 2022-10-27 11:34:31 +01:00
mem hw/mem/nvdimm: fix error message for 'unarmed' flag 2022-10-24 12:38:38 +02:00
microblaze
mips hw/mips/malta: Use bootloader helper to set BAR registers 2022-10-31 11:32:56 +01:00
misc mac_nvram: Use NVRAM_SIZE constant 2022-10-31 18:48:23 +00:00
net * Fix and test the VISTR instruction on s390x 2022-10-31 06:19:54 -04:00
nios2 hw/nios2: set machine->fdt in nios2_load_dtb() 2022-10-17 16:15:10 -03:00
nubus
nvme hw/nvme: Abort copy command when format is one while pif 2022-11-02 09:23:05 +01:00
nvram hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h 2022-10-31 18:48:23 +00:00
openrisc openrisc: re-randomize rng-seed on reboot 2022-10-27 11:34:31 +01:00
pci
pci-bridge
pci-host hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h 2022-10-31 18:48:23 +00:00
pcmcia
ppc mac_newworld: Turn CORE99_VIA_CONFIG defines into an enum 2022-10-31 18:48:23 +00:00
rdma
remote Use g_new() & friends where that makes obvious sense 2022-10-04 00:10:11 +02:00
riscv riscv: re-randomize rng-seed on reboot 2022-10-27 11:34:31 +01:00
rtc
rx rx: re-randomize rng-seed on reboot 2022-10-27 11:34:31 +01:00
s390x s390x/pci: RPCIT second pass when mappings exhausted 2022-11-06 12:27:35 +01:00
scsi hw/scsi/vmw_pvscsi.c: Use device_cold_reset() to reset SCSI devices 2022-10-18 13:58:04 +02:00
sd hw/sd/sdhci: Rename ESDHC_* defines to USDHC_* 2022-10-28 13:26:20 -03:00
sensor
sh4
smbios hw/smbios: support for type 8 (port connector) 2022-10-09 16:38:45 -04:00
sparc
sparc64 hw: Remove unused MAX_IDE_BUS define 2022-10-31 11:32:07 +01:00
ssi aspeed/smc: Cache AspeedSMCClass 2022-10-24 11:20:15 +02:00
timer target/imx: reload cmp timer outside of the reload ptimer transaction 2022-10-27 10:27:23 +01:00
tpm
tricore
usb hw/usb: dev-mtp: Use g_mkdir() 2022-10-31 20:37:58 +00:00
vfio vfio/common: Fix vfio_iommu_type1_info use after free 2022-09-27 14:26:42 -06:00
virtio Hi, 2022-10-30 18:31:59 -04:00
watchdog watchdog: remove -watchdog option 2022-09-29 11:40:28 +02:00
xen hw/xen: set pci Atomic Ops requests for passthrough device 2022-09-27 14:23:23 +01:00
xenpv
xtensa
Kconfig
meson.build