qemu-e2k/hw
Arnout Engelen f471e8b060 hw/usb/hcd-ehci: fix writeback order
The 'active' bit passes control over a qTD between the guest and the
controller: set to 1 by guest to enable execution by the controller,
and the controller sets it to '0' to hand back control to the guest.

ehci_state_writeback write two dwords to main memory using DMA:
the third dword of the qTD (containing dt, total bytes to transfer,
cpage, cerr and status) and the fourth dword of the qTD (containing
the offset).

This commit makes sure the fourth dword is written before the third,
avoiding a race condition where a new offset written into the qTD
by the guest after it observed the status going to go to '0' gets
overwritten by a 'late' DMA writeback of the previous offset.

This race condition could lead to 'cpage out of range (5)' errors,
and reproduced by:

./qemu-system-x86_64 -enable-kvm -bios $SEABIOS/bios.bin -m 4096 -device usb-ehci -blockdev driver=file,read-only=on,filename=/home/aengelen/Downloads/openSUSE-Tumbleweed-DVD-i586-Snapshot20220428-Media.iso,node-name=iso -device usb-storage,drive=iso,bootindex=0 -chardev pipe,id=shell,path=/tmp/pipe -device virtio-serial -device virtconsole,chardev=shell -device virtio-rng-pci -serial mon:stdio -nographic

(press a key, select 'Installation' (2), and accept the default
values. On my machine the 'cpage out of range' is reproduced while
loading the Linux Kernel about once per 7 attempts. With the fix in
this commit it no longer fails)

This problem was previously reported as a seabios problem in
https://mail.coreboot.org/hyperkitty/list/seabios@seabios.org/thread/OUTHT5ISSQJGXPNTUPY3O5E5EPZJCHM3/
and as a nixos CI build failure in
https://github.com/NixOS/nixpkgs/issues/170803

Signed-off-by: Arnout Engelen <arnout@bzzt.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-06-14 10:34:36 +02:00
..
9pfs virtio: drop name parameter for virtio_init() 2022-05-16 04:38:40 -04:00
acpi hw/acpi/piix4: remove unused piix4_pm_initfn() function 2022-06-11 11:44:47 +02:00
adc hw/adc/zynq-xadc: Use qemu_irq typedef 2022-05-19 16:19:02 +01:00
alpha
arm hw/core/loader: return image sizes as ssize_t 2022-06-10 09:31:42 +10:00
audio hw/audio/cs4231a: Const'ify global tables 2022-06-11 11:44:50 +02:00
avr
block hw/block/fdc-sysbus: Always mark sysbus floppy controllers as not having DMA 2022-06-11 11:36:14 +02:00
char acpi: serial-is: replace ISADeviceClass::build_aml with AcpiDevAmlIfClass:build_dev_aml 2022-06-09 19:32:48 -04:00
core virtio,pc,pci: fixes,cleanups,features 2022-06-10 18:15:34 -07:00
cpu
cris
cxl hw/cxl: Fix missing write mask for HDM decoder target list registers 2022-06-09 19:32:49 -04:00
display xlnx_dp: Fix the interrupt disable logic 2022-06-08 19:38:47 +01:00
dma ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY 2022-05-19 16:19:03 +01:00
gpio hw/gpio: replace HWADDR_PRIx with PRIx64 2022-05-25 10:31:33 +02:00
hppa hppa: Fix serial port assignments and pass-through 2022-05-28 12:25:42 +02:00
hyperv hw/hyperv/vmbus: Remove unused vmbus_load/save_req() 2022-05-30 19:49:42 +02:00
i2c acpi: ich9-smb: add support for AcpiDevAmlIf interface 2022-06-09 19:32:48 -04:00
i386 hw/i386/pc: Unexport functions used only internally 2022-06-11 11:44:50 +02:00
ide include/hw/ide: Unexport pci_piix3_xen_ide_unplug() 2022-06-09 14:47:42 +01:00
input acpi: pckbd: replace ISADeviceClass::build_aml with AcpiDevAmlIfClass:build_dev_aml 2022-06-09 19:32:48 -04:00
intc hw/intc: sifive_plic: Avoid overflowing the addr_config buffer 2022-06-10 09:31:42 +10:00
ipack
ipmi acpi: ipmi: use AcpiDevAmlIf interface to build IPMI device descriptors 2022-06-09 19:32:49 -04:00
isa hw/isa/piix3: Inline and remove piix3_create() 2022-06-11 11:44:50 +02:00
loongarch hw/loongarch: Add LoongArch virt power manager support. 2022-06-06 18:14:13 +00:00
m68k ptimer: Rename PTIMER_POLICY_DEFAULT to PTIMER_POLICY_LEGACY 2022-05-19 16:19:03 +01:00
mem mem/cxl_type3: Add read and write functions for associated hostmem. 2022-05-13 07:57:26 -04:00
microblaze
mips hw/mips/boston: Initialize g_autofree pointers 2022-06-11 23:50:35 +02:00
misc acpi: pvpanic-isa: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML 2022-06-09 19:32:49 -04:00
net hw/net/fsl_etsec/etsec: Remove obsolete and unused etsec_create() 2022-06-11 11:44:50 +02:00
nios2
nubus
nvme hw/nvme: add new command abort case 2022-06-03 21:48:24 +02:00
nvram machine: use QAPI struct for boot configuration 2022-05-12 12:29:43 +02:00
openrisc hw/openrisc: use right OMPIC size variable 2022-05-15 10:33:01 +09:00
pci virtio,pc,pci: fixes,cleanups,features 2022-06-10 18:15:34 -07:00
pci-bridge pci/pci_expander_bridge: For CXL HB delay the HB register memory region setup. 2022-06-09 19:32:49 -04:00
pci-host hw/pci-host/gpex-acpi: Add support for dsdt construction for pxb-cxl 2022-05-13 07:57:26 -04:00
pcmcia
ppc spapr: Use address from elf parser for kernel address 2022-05-26 17:11:32 -03:00
rdma
remote QIOChannel: Add flags on io_writev and introduce io_flush callback 2022-05-16 13:56:24 +01:00
riscv hw/core/loader: return image sizes as ssize_t 2022-06-10 09:31:42 +10:00
rtc hw/rtc/mc146818rtc: QOM'ify io_base offset 2022-06-11 11:44:50 +02:00
rx
s390x modules: introduces module_kconfig directive 2022-06-06 09:26:53 +02:00
scsi virtio,pc,pci: fixes,cleanups,features 2022-06-10 18:15:34 -07:00
sd hw/sd/allwinner-sdhost: report FIFO water level as 1 when data ready 2022-05-30 12:34:46 +01:00
sensor
sh4
smbios
sparc machine: make memory-backend a link property 2022-05-12 12:29:44 +02:00
sparc64 hw: Reuse TYPE_I8042 define 2022-06-11 11:44:50 +02:00
ssi
timer Fix 'writeable' typos 2022-06-08 19:38:47 +01:00
tpm acpi: tpm-tis: use AcpiDevAmlIfClass:build_dev_aml to provide device's AML 2022-06-09 19:32:49 -04:00
tricore
usb hw/usb/hcd-ehci: fix writeback order 2022-06-14 10:34:36 +02:00
vfio vfio/common: remove spurious warning on vfio_listener_region_del 2022-06-08 08:44:19 -06:00
virtio hw/virtio/vhost-user: don't use uninitialized variable 2022-06-09 19:32:49 -04:00
watchdog
xen hw/xen/xen_pt: Resolve igd_passthrough_isa_bridge_create() indirection 2022-05-12 12:07:06 +02:00
xenpv Warn user if the vga flag is passed but no vga device is created 2022-05-09 08:21:14 +02:00
xtensa hw/xtensa: fix reset value of MIROUT register of MX PIC 2022-05-06 15:27:40 -07:00
Kconfig hw/loongarch: Add support loongson3 virt machine type. 2022-06-06 18:09:03 +00:00
meson.build hw/loongarch: Add support loongson3 virt machine type. 2022-06-06 18:09:03 +00:00