]> git.ipfire.org Git - thirdparty/qemu.git/commit
pci: Fix the update of interrupt disable bit in PCI_COMMAND register
authorGuoyi Tu <tugy@chinatelecom.cn>
Fri, 11 Aug 2023 14:46:51 +0000 (22:46 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Fri, 11 Aug 2023 16:15:24 +0000 (12:15 -0400)
commit0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5
tree5353002958eb55035fc511d9945525900ebaf2fa
parent3d449bc6030904ead784a4e4644c9640c2152796
pci: Fix the update of interrupt disable bit in PCI_COMMAND register

The PCI_COMMAND register is located at offset 4 within
the PCI configuration space and occupies 2 bytes. The
interrupt disable bit is at the 10th bit, which corresponds
to the byte at offset 5 in the PCI configuration space.

In our testing environment, the guest driver may directly
updates the byte at offset 5 in the PCI configuration space.
The backtrace looks like as following:
    at hw/pci/pci.c:1442
    at hw/virtio/virtio-pci.c:605
    val=5, len=1) at hw/pci/pci_host.c:81

In this situation, the range_covers_byte function called
by the pci_default_write_config function will return false,
resulting in the inability to handle the interrupt disable
update event.

To fix this issue, we can use the ranges_overlap function
instead of range_covers_byte to determine whether the interrupt
bit has been updated.

Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
Signed-off-by: yuanminghao <yuanmh12@chinatelecom.cn>
Message-Id: <ce2d0437-8faa-4d61-b536-4668f645a959@chinatelecom.cn>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Fixes: b6981cb57be5 ("pci: interrupt disable bit support")
hw/pci/pci.c