hw/ide/piix: properly initialize the BMIBA register #36
Closed
olafhering wants to merge 188 commits from
factory into factory
pull from: factory
merge into: dfaggioli:factory
dfaggioli:v10.0-factory
dfaggioli:v9.2-factory
dfaggioli:v7.1-sle15sp5
dfaggioli:v8.2-sle15sp6
dfaggioli:opensuse-5.2
dfaggioli:v6.2-sle15sp4
dfaggioli:v8.2-sle15sp6-snp-tdx
dfaggioli:v9.1-factory
dfaggioli:factory-tmp
dfaggioli:opensuse-3.1
dfaggioli:v9.0-factory
dfaggioli:v7.2-sle15sp5-tdx
dfaggioli:v8.2-sle15sp6-tdx
dfaggioli:master
dfaggioli:v6.2.0-sle15sp4
dfaggioli:opensuse-2.9
dfaggioli:opensuse-2.6
dfaggioli:opensuse-4.2
dfaggioli:opensuse-7.1
dfaggioli:opensuse-6.2
dfaggioli:opensuse-7.0
dfaggioli:opensuse-2.11
dfaggioli:opensuse-6.1
dfaggioli:opensuse-6.0
dfaggioli:opensuse-1.4
dfaggioli:bsc1179719
dfaggioli:opensuse-5.1
dfaggioli:opensuse-5.0
dfaggioli:opensuse-4.1
dfaggioli:opensuse-4.0
dfaggioli:opensuse-3.0
dfaggioli:opensuse-2.12
dfaggioli:opensuse-2.10
dfaggioli:opensuse-2.8
dfaggioli:opensuse-2.7
dfaggioli:opensuse-2.1
dfaggioli:opensuse-2.5
dfaggioli:opensuse-2.4
dfaggioli:opensuse-2.3
dfaggioli:opensuse-1.6
dfaggioli:opensuse-2.2
dfaggioli:opensuse-2.0
dfaggioli:opensuse-1.7
dfaggioli:opensuse-1.3
dfaggioli:opensuse-1.5
dfaggioli:opensuse-1.1
dfaggioli:stable-1.3
dfaggioli:stable-1.2
dfaggioli:opensuse-1.2
dfaggioli:stable-1.1
dfaggioli:opensuse-1.0
dfaggioli:stable-1.0
dfaggioli:stable-0.15
dfaggioli:stable-0.14
dfaggioli:stable-0.13
dfaggioli:stable-0.12
dfaggioli:stable-0.11
dfaggioli:stable-0.10
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "factory"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
According to the 82371FB documentation (82371FB.pdf, 2.3.9. BMIBA-BUS MASTER INTERFACE BASE ADDRESS REGISTER, April 1997), the register is 32bit wide. To properly reset it to default values, all 32bit need to be cleared. Bit #0 "Resource Type Indicator (RTE)" needs to be enabled.
The initial change wrote just the lower 8 bit, leaving parts of the "Bus Master Interface Base Address" address at bit 15:4 unchanged.
This bug went unnoticed until commit
ee358e919e("hw/ide/piix: Convert reset handler to DeviceReset"). After this change, piix_ide_reset is exercised after the "unplug" command from a Xen HVM domU, 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.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.
Fixes:
e6a71ae327("Add support for 82371FB (Step A1) and Improved support for 82371SB (Function 1)")Signed-off-by: Olaf Hering olaf@aepfle.de
Reviewed-by: Bernhard Beschow shentey@gmail.com
Reviewed-by: Philippe Mathieu-Daudé philmd@linaro.org
Message-ID: 20230712074721.14728-1-olaf@aepfle.de
Signed-off-by: Paolo Bonzini pbonzini@redhat.com
Resolves: bsc#1179993, bsc#1181740
(cherry picked from commit
230dfd9257)Will be in v8.0.n.
Pull request closed