qemu-e2k/hw
Olaf Hering 856ca10f9c xen-platform: do full PCI reset during unplug of IDE devices
The IDE unplug function needs to reset the entire PCI device, to make
sure all state is initialized to defaults. This is done by calling
pci_device_reset, which resets not only the chip specific registers, but
also all PCI state. This fixes "unplug" in a Xen HVM domU with the
modular legacy xenlinux PV drivers.

Commit ee358e919e ("hw/ide/piix: Convert reset handler to
DeviceReset") changed the way how the the disks are unplugged. Prior
this commit the PCI device remained unchanged. After this change,
piix_ide_reset is exercised after the "unplug" command, which was not
the case prior that commit. This function resets the command register.
As a result the ata_piix driver inside the domU will see a disabled PCI
device. The generic PCI code will reenable the PCI device. On the qemu
side, this runs pci_default_write_config/pci_update_mappings. Here a
changed address is returned by pci_bar_address, this is the address
which was truncated in piix_ide_reset. In case of a Xen HVM domU, the
address changes from 0xc120 to 0xc100. This truncation was a bug in
piix_ide_reset, which was fixed in commit 230dfd9257 ("hw/ide/piix:
properly initialize the BMIBA register"). If pci_xen_ide_unplug had used
pci_device_reset, the PCI registers would have been properly reset, and
commit ee358e919e would have not introduced a regression for this
specific domU environment.

While the unplug is supposed to hide the IDE disks, the changed BMIBA
address broke the UHCI device. In case the domU has an USB tablet
configured, to recive absolute pointer coordinates for the GUI, it will
cause a hang during device discovery of the partly discovered USB hid
device. Reading the USBSTS word size register will fail. The access ends
up in the QEMU piix-bmdma device, instead of the expected uhci device.
Here a byte size request is expected, and a value of ~0 is returned. As
a result the UCHI driver sees an error state in the register, and turns
off the UHCI controller.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Paul Durrant <paul@xen.org>
Message-Id: <20230720072950.20198-1-olaf@aepfle.de>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
2023-08-01 10:22:33 +01:00
..
9pfs hw/9pfs: spelling fixes 2023-07-25 17:15:47 +03:00
acpi hw/acpi: Fix PM control register access 2023-06-26 09:49:24 -04:00
adc meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
alpha hw/alpha: Use MachineClass->default_nic in the alpha machine 2023-05-26 09:10:49 +02:00
arm xen: Don't pass MemoryListener around by value 2023-08-01 10:22:33 +01:00
audio meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
avr Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
block xen-block: Avoid leaks on new error path 2023-08-01 10:22:33 +01:00
char hw/char/escc: Implement loopback mode 2023-07-25 14:40:49 +02:00
core pcie: Specify 0 for ARI next function numbers 2023-07-10 18:59:32 -04:00
cpu meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
cxl hw/cxl/events: Add event interrupt support 2023-06-22 18:55:14 -04:00
display virtio-gpu-udmabuf: correct naming of QemuDmaBuf size properties 2023-07-17 15:22:28 +04:00
dma meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
gpio meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
hppa target/hppa: Provide qemu version via fw_cfg to firmware 2023-06-24 13:39:48 +02:00
hyperv win32: replace closesocket() with close() wrapper 2023-03-13 15:39:31 +04:00
i2c meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
i386 xen-platform: do full PCI reset during unplug of IDE devices 2023-08-01 10:22:33 +01:00
ide hw/ide/piix: properly initialize the BMIBA register 2023-07-14 11:10:57 +02:00
input vhost-user: fully use new backend/frontend naming 2023-06-26 09:50:00 -04:00
intc arm: spelling fixes 2023-07-25 17:13:53 +03:00
ipack meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
ipmi meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
isa hw/isa/vt82c686: Remove via_isa_set_irq() 2023-07-11 00:11:25 +02:00
loongarch hw/loongarch/virt: Use machine_memory_devices_init() 2023-07-12 09:25:37 +02:00
m68k other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
mem memory-device: Track used region size in DeviceMemoryState 2023-07-12 09:25:37 +02:00
microblaze other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
mips hw/mips: Improve the default USB settings in the loongson3-virt machine 2023-07-25 14:40:49 +02:00
misc arm: spelling fixes 2023-07-25 17:13:53 +03:00
net kconfig: Add PCIe devices to s390x machines 2023-07-14 11:10:57 +02:00
nios2 hw/nios2: set machine->fdt in nios2_load_dtb() 2022-10-17 16:15:10 -03:00
nubus meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
nvme hw/nvme: use stl/ldl pci dma api 2023-07-30 20:09:54 +02:00
nvram hw/nvram: Avoid unnecessary Xilinx eFuse backstore write 2023-07-17 11:05:52 +01:00
openrisc *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
pci hw/pci: add comment to explain checking for available function 0 in pci hotplug 2023-07-25 17:19:44 +03:00
pci-bridge meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
pci-host hw/pci/pci: Remove multifunction parameter from pci_new_multifunction() 2023-07-10 18:59:32 -04:00
pcmcia meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
ppc hw/ppc/spapr: Use machine_memory_devices_init() 2023-07-12 09:25:37 +02:00
rdma meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
remote exec/memory: Add symbol for memory listener priority for device backend 2023-06-28 14:27:59 +02:00
riscv hw/riscv: Fix typo field in error_report 2023-07-19 14:31:41 +10:00
rtc meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
rx bulk: Remove pointless QOM casts 2023-06-05 20:48:34 +02:00
s390x s390x: Fix QEMU abort by selecting S390_FLIC_KVM 2023-07-18 09:36:27 +02:00
scsi scsi: clear unit attention only for REPORT LUNS commands 2023-07-14 11:10:58 +02:00
sd hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers 2023-07-25 14:40:49 +02:00
sensor meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
sh4 hw/sh4: Use MachineClass->default_nic in the sh4 r2d machine 2023-05-22 09:44:48 +02:00
smbios hw/smbios: Fix core count in type4 2023-07-10 16:17:08 -04:00
sparc other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
sparc64 hw/pci/pci: Remove multifunction parameter from pci_new_multifunction() 2023-07-10 18:59:32 -04:00
ssi meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
timer meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
tpm hw/tpm: TIS on sysbus: Remove unsupport ppi command line option 2023-07-14 11:31:54 -04:00
tricore hw/tricore: fix inclusion of tricore_testboard 2021-07-20 20:10:21 +02:00
usb hw/usb/canokey: change license to GPLv2+ 2023-07-25 17:24:12 +01:00
vfio vfio/pci: Enable AtomicOps completers on root ports 2023-07-10 09:52:52 +02:00
virtio virtio-mem-pci: Device unplug support 2023-07-12 09:27:32 +02:00
watchdog meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
xen xen: Don't pass MemoryListener around by value 2023-08-01 10:22:33 +01:00
xenpv hw/xenpv: Initialize Xen backend operations 2023-03-24 14:52:14 +00:00
xtensa hw: Simplify calls to pci_nic_init_nofail() 2023-07-08 07:24:38 +03:00
Kconfig xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation 2023-03-01 08:22:49 +00:00
meson.build hw/loongarch: Add support loongson3 virt machine type. 2022-06-06 18:09:03 +00:00