On 30.09.24 16:00, Michael S. Tsirkin wrote:
On Tue, Sep 24, 2024 at 02:31:20PM +0200, David Hildenbrand wrote:
On 24.09.24 03:11, Gao Shiyuan wrote:

Make sure to version your patch series. For example, via
        $ git format-patch -v1 ...

As shown below, if a virtio PCI device is attached under a pci-bridge, the MR
of VirtIOPCIRegion does not belong to any address space. So memory_region_find
cannot be used to search for this MR.

I'm starting to wonder if memory_region_find() is really the right fun


Introduce the virtio-pci and pci_bridge_pci address spaces to solve this 
problem.

Before:
memory-region: pci_bridge_pci
    0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
      00000000fe200000-00000000fe200fff (prio 1, i/o): virtio-blk-pci-msix
        00000000fe200000-00000000fe20016f (prio 0, i/o): msix-table
        00000000fe200800-00000000fe200807 (prio 0, i/o): msix-pba
      000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
        000000a000400000-000000a000400fff (prio 0, i/o): 
virtio-pci-common-virtio-blk
        000000a000401000-000000a000401fff (prio 0, i/o): 
virtio-pci-isr-virtio-blk
        000000a000402000-000000a000402fff (prio 0, i/o): 
virtio-pci-device-virtio-blk
        000000a000403000-000000a000403fff (prio 0, i/o): 
virtio-pci-notify-virtio-blk

After:
address-space: pci_bridge_pci
    0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
      00000000fe200000-00000000fe200fff (prio 1, i/o): virtio-blk-pci-msix
        00000000fe200000-00000000fe20016f (prio 0, i/o): msix-table
        00000000fe200800-00000000fe200807 (prio 0, i/o): msix-pba
      000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
        000000a000400000-000000a000400fff (prio 0, i/o): 
virtio-pci-common-virtio-blk
        000000a000401000-000000a000401fff (prio 0, i/o): 
virtio-pci-isr-virtio-blk
        000000a000402000-000000a000402fff (prio 0, i/o): 
virtio-pci-device-virtio-blk
        000000a000403000-000000a000403fff (prio 0, i/o): 
virtio-pci-notify-virtio-blk

address-space: virtio-pci
    000000a000400000-000000a000403fff (prio 1, i/o): virtio-pci
      000000a000400000-000000a000400fff (prio 0, i/o): 
virtio-pci-common-virtio-blk
      000000a000401000-000000a000401fff (prio 0, i/o): virtio-pci-isr-virtio-blk
      000000a000402000-000000a000402fff (prio 0, i/o): 
virtio-pci-device-virtio-blk
      000000a000403000-000000a000403fff (prio 0, i/o): 
virtio-pci-notify-virtio-blk

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2576
Fixes: ffa8a3e ("virtio-pci: Add lookup subregion of VirtIOPCIRegion MR")

Commit id is not unique. Use 12 digits please.

I'm still not quite sure if memory_region_find() is really the right thing
to use here, but I'm no expert on that so I'm hoping virtio/PCI people can
review.

I donnu, what would you use?

I assume there is currently not better alternative. Scanning all address spaces to find+walk a flatview sounds quite wasteful during each virtio_address_space_lookup ...

So this change here looks ok to me for the time being.

--
Cheers,

David / dhildenb


Reply via email to