The ARI next function number field is undefined for VF. The PF should end the linked list formed with the field by specifying 0.
Fixes: 44c2c09488 ("hw/nvme: Add support for SR-IOV") Signed-off-by: Akihiko Odaki <akihiko.od...@daynix.com> --- hw/nvme/nvme.h | 1 + hw/core/machine.c | 1 + hw/nvme/ctrl.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h index 209e8f5b4c..c2ba6755ab 100644 --- a/hw/nvme/nvme.h +++ b/hw/nvme/nvme.h @@ -515,6 +515,7 @@ typedef struct NvmeParams { uint16_t sriov_vi_flexible; uint8_t sriov_max_vq_per_vf; uint8_t sriov_max_vi_per_vf; + bool ari_nextfn_1; } NvmeParams; typedef struct NvmeCtrl { diff --git a/hw/core/machine.c b/hw/core/machine.c index 46f8f9a2b0..f984a767a2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -41,6 +41,7 @@ GlobalProperty hw_compat_8_0[] = { { "migration", "multifd-flush-after-each-section", "on"}, + { "nvme", "ari-nextfn-1", "on"}, }; const size_t hw_compat_8_0_len = G_N_ELEMENTS(hw_compat_8_0); diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index fd917fcda1..4bbafc66b5 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8088,7 +8088,7 @@ static bool nvme_init_pci(NvmeCtrl *n, PCIDevice *pci_dev, Error **errp) pcie_endpoint_cap_init(pci_dev, 0x80); pcie_cap_flr_init(pci_dev); if (n->params.sriov_max_vfs) { - pcie_ari_init(pci_dev, 0x100, 1); + pcie_ari_init(pci_dev, 0x100, n->params.ari_nextfn_1 ? 1 : 0); } /* add one to max_ioqpairs to account for the admin queue pair */ @@ -8406,6 +8406,7 @@ static Property nvme_props[] = { params.sriov_max_vi_per_vf, 0), DEFINE_PROP_UINT8("sriov_max_vq_per_vf", NvmeCtrl, params.sriov_max_vq_per_vf, 0), + DEFINE_PROP_BOOL("ari-nextfn-1", NvmeCtrl, params.ari_nextfn_1, false), DEFINE_PROP_END_OF_LIST(), }; -- 2.41.0