You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/hw/nvme
Damien Bergamini 2e54e5fda7 pcie_sriov: Fix broken MMIO accesses from SR-IOV VFs
Starting with commit cab1398a60, SR-IOV VFs are realized as soon as
pcie_sriov_pf_init() is called.  Because pcie_sriov_pf_init() must be
called before pcie_sriov_pf_init_vf_bar(), the VF BARs types won't be
known when the VF realize function calls pcie_sriov_vf_register_bar().

This breaks the memory regions of the VFs (for instance with igbvf):

$ lspci
...
    Region 0: Memory at 281a00000 (64-bit, prefetchable) [virtual] [size=16K]
    Region 3: Memory at 281a20000 (64-bit, prefetchable) [virtual] [size=16K]

$ info mtree
...
address-space: pci_bridge_pci_mem
  0000000000000000-ffffffffffffffff (prio 0, i/o): pci_bridge_pci
    0000000081a00000-0000000081a03fff (prio 1, i/o): igbvf-mmio
    0000000081a20000-0000000081a23fff (prio 1, i/o): igbvf-msix

and causes MMIO accesses to fail:

    Invalid write at addr 0x281A01520, size 4, region '(null)', reason: rejected
    Invalid read at addr 0x281A00C40, size 4, region '(null)', reason: rejected

To fix this, VF BARs are now registered with pci_register_bar() which
has a type parameter and pcie_sriov_vf_register_bar() is removed.

Fixes: cab1398a60 ("pcie_sriov: Reuse SR-IOV VF device instances")
Signed-off-by: Damien Bergamini <damien.bergamini@eviden.com>
Signed-off-by: Clement Mathieu--Drif <clement.mathieu--drif@eviden.com>
Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20250901151314.1038020-1-clement.mathieu--drif@eviden.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
3 weeks ago
..
Kconfig kconfig: Add NVME to s390x machines 2 years ago
ctrl.c pcie_sriov: Fix broken MMIO accesses from SR-IOV VFs 3 weeks ago
dif.c include: Rename sysemu/ -> system/ 10 months ago
dif.h hw/nvme: 64-bit pi support 4 years ago
meson.build hw/nvme: Add NVMe NGUID property 2 years ago
nguid.c qdev: Rename PropertyInfo member @name to @type 8 months ago
ns.c qom: Have class_init() take a const data argument 6 months ago
nvme.h hw/nvme: fix attachment of private namespaces 7 months ago
subsys.c hw/nvme: fix nvme hotplugging 5 months ago
trace-events hw/nvme: i/o cmd set independent namespace data structure 12 months ago
trace.h