From: Klaus Jensen Date: Sun, 10 Nov 2024 13:04:27 +0000 (+0100) Subject: hw/nvme: fix msix_uninit with exclusive bar X-Git-Tag: v8.2.9~35 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bc7a671371e24a3655869b261a0a680eca61a33;p=thirdparty%2Fqemu.git hw/nvme: fix msix_uninit with exclusive bar Commit fa905f65c554 introduced a machine compatibility parameter to enable an exclusive bar for msix. It failed to account for this when cleaning up. Make sure that if an exclusive bar is enabled, we use the proper cleanup routine. Cc: qemu-stable@nongnu.org Fixes: fa905f65c554 ("hw/nvme: add machine compatibility parameter to enable msix exclusive bar") Reviewed-by: Jesper Wendel Devantier Signed-off-by: Klaus Jensen (cherry picked from commit 9162f101257639cc4c7e20f72f77268b1256dd79) Signed-off-by: Michael Tokarev --- diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c index 359313dbcb0..94a37a3aef9 100644 --- a/hw/nvme/ctrl.c +++ b/hw/nvme/ctrl.c @@ -8411,7 +8411,12 @@ static void nvme_exit(PCIDevice *pci_dev) pcie_sriov_pf_exit(pci_dev); } - msix_uninit(pci_dev, &n->bar0, &n->bar0); + if (n->params.msix_exclusive_bar && !pci_is_vf(pci_dev)) { + msix_uninit_exclusive_bar(pci_dev); + } else { + msix_uninit(pci_dev, &n->bar0, &n->bar0); + } + memory_region_del_subregion(&n->bar0, &n->iomem); }