Skip to contentSkip to conversation

pci: last minute bugfixes

GIT PULL Applied Michael S. Tsirkin 4 participants 8 messages Aug 11, 2023 – Aug 12, 2023

lore
Share & tools
lore
#1 lore raw

[PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host

In reply to Michael S. Tsirkin

From: Jason Chien <[email protected]>

In pcie_bus_realize(), a root bus is realized as a PCIe bus and a non-root bus is realized as a PCIe bus if its parent bus is a PCIe bus. However, the child bus "dw-pcie" is realized before the parent bus "pcie" which is the root PCIe bus. Thus, the extended configuration space is not accessible on "dw-pcie". The issue can be resolved by adding the PCI_BUS_EXTENDED_CONFIG_SPACE flag to "pcie" before "dw-pcie" is realized.

Message-Id: <[email protected]>

Signed-off-by Jason Chien &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;<br>
---
 hw/pci-host/designware.c | 1 +
 1 file changed, 1 insertion(+)
hw/pci-host/designware.c +1 -0
index 9e183caa48..388d252ee2 100644
@@ -694,6 +694,7 @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
                                      &s->pci.io,
                                      0, 4,
                                      TYPE_PCIE_BUS);
+    pci->bus->flags |= PCI_BUS_EXTENDED_CONFIG_SPACE;
 
     memory_region_init(&s->pci.address_space_root,
                        OBJECT(s),
Signature · 1 line
MST
#0 lore raw

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak in before the release.

----------------------------------------------------------------
Guoyi Tu (1):
pci: Fix the update of interrupt disable bit in PCI_COMMAND register

Jason Chien (1):
hw/pci-host: Allow extended config space access for Designware PCIe host

 hw/pci-host/designware.c | 1 +
 hw/pci/pci.c             | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
#3 lore raw

[PULL 2/2] pci: Fix the update of interrupt disable bit in PCI_COMMAND register

From: Guoyi Tu <[email protected]>

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.

Message-Id: <[email protected]>

Fixes b6981cb57be5 ("pci: interrupt disable bit support")
---
 hw/pci/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/pci/pci.c +1 -1
index b8d22e2e74..881d774fb6 100644
@@ -1613,7 +1613,7 @@ void pci_default_write_config(PCIDevice *d, uint32_t addr, uint32_t val_in, int
         range_covers_byte(addr, l, PCI_COMMAND))
         pci_update_mappings(d);
 
-    if (range_covers_byte(addr, l, PCI_COMMAND)) {
+    if (ranges_overlap(addr, l, PCI_COMMAND, 2)) {
         pci_update_irq_disabled(d, was_irq_disabled);
         memory_region_set_enabled(&d->bus_master_enable_region,
                                   (pci_get_word(d->config + PCI_COMMAND)
Signature · 1 line
MST
#2 lore raw

Re: [PULL 1/2] hw/pci-host: Allow extended config space access for Designware PCIe host

In reply to Michael S. Tsirkin
Quoted 9 lines · Michael S. Tsirkin

From: Jason Chien <[email protected]>

In pcie_bus_realize(), a root bus is realized as a PCIe bus and a non-root bus is realized as a PCIe bus if its parent bus is a PCIe bus. However, the child bus "dw-pcie" is realized before the parent bus "pcie" which is the root PCIe bus. Thus, the extended configuration space is not accessible on "dw-pcie". The issue can be resolved by adding the PCI_BUS_EXTENDED_CONFIG_SPACE flag to "pcie" before "dw-pcie" is realized.

Quoted 6 lines

Message-Id: <[email protected]>

Signed-off-by Jason Chien &lt;<a href="mailto:[email protected]" target="_blank">[email protected]</a>&gt;<br>

<8^)

Quoted 3 lines
---
  hw/pci-host/designware.c | 1 +
  1 file changed, 1 insertion(+)
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 19 lines · Michael S. Tsirkin

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak in before the release.

Quoted 8 lines

----------------------------------------------------------------
Guoyi Tu (1):
pci: Fix the update of interrupt disable bit in PCI_COMMAND register

Jason Chien (1):
hw/pci-host: Allow extended config space access for Designware PCIe host

Could you respin to get rid of the malformed Signed-off-by line in patch 1 which has an HTML mailto link in it, please?

thanks
-- PMM

#7 lore raw
In reply to Michael S. Tsirkin
Quoted 12 lines · Michael S. Tsirkin

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

Quoted 7 lines

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak in before the release.

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/8.1 as appropriate.

r~

#5 lore raw
In reply to Peter Maydell
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Michael S. Tsirkin

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak in before the release.

----------------------------------------------------------------
Guoyi Tu (1):
pci: Fix the update of interrupt disable bit in PCI_COMMAND register

Quoted 5 lines
Quoted 2 lines

Jason Chien (1):
hw/pci-host: Allow extended config space access for Designware PCIe host

Could you respin to get rid of the malformed Signed-off-by line in patch 1 which has an HTML mailto link in it, please?

Oops. I lost my train of thought over the course of the day. I mean to not push the pr to master and wait for v2, but then I forgot and did it anyway hours later.

Sorry about that.

r~

#6 lore raw
In reply to Peter Maydell
Quoted 26 lines · Peter Maydell
Quoted 25 lines · Michael S. Tsirkin

The following changes since commit 15b11a1da6a4b7c6b8bb37883f52b544dee2b8fd:

cryptodev: Handle unexpected request to avoid crash (2023-08-03 16:16:17 -0400)

are available in the Git repository at:

https://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_upstream

for you to fetch changes up to 0f936247e8ed0ab5fb7e75827dd8c8f73d5ef4b5:

pci: Fix the update of interrupt disable bit in PCI_COMMAND register (2023-08-11 12:15:24 -0400)

----------------------------------------------------------------
pci: last minute bugfixes

two fixes that seem very safe and important enough to sneak in before the release.

----------------------------------------------------------------
Guoyi Tu (1):
pci: Fix the update of interrupt disable bit in PCI_COMMAND register

Quoted 8 lines
Quoted 2 lines

Jason Chien (1):
hw/pci-host: Allow extended config space access for Designware PCIe host

Could you respin to get rid of the malformed Signed-off-by line in patch 1 which has an HTML mailto link in it, please?

thanks
-- PMM

Pushed as c4e775652a1043b21e6228e8a4d73abe943637b0, sorry I didn't notice.

Signature · 1 line
MST