From: Jamin Lin <[email protected]> The ASPEED PCIe class may be registered for machines that do not instantiate a PCIe root complex. Updating the global msi_nonbroken flag from class_init() therefore affects unrelated machines.
Defer the update to the per-device realize handler, so the flag changes only when an ASPEED PCIe root complex is actually instantiated. Cc: [email protected] Fixes: f002aa35f320 ("hw/pci-host/aspeed: Add AST2600 PCIe config space and host bridge") Reported-by: Marcelo Manzo <[email protected]> Reviewed-by: Philippe Mathieu-Daudé <[email protected]> Reviewed-by: Peter Maydell <[email protected]> Signed-off-by: Jamin Lin <[email protected]> Reviewed-by: Marcelo Manzo <[email protected]> Tested-by: Marcelo Manzo <[email protected]> Message-ID: <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> (cherry picked from commit 8cc795376e954818dce06cfc640efdea721d6061) Signed-off-by: Michael Tokarev <[email protected]> diff --git a/hw/pci-host/aspeed_pcie.c b/hw/pci-host/aspeed_pcie.c index b46eb74234b..ceb010f2133 100644 --- a/hw/pci-host/aspeed_pcie.c +++ b/hw/pci-host/aspeed_pcie.c @@ -181,6 +181,8 @@ static void aspeed_pcie_rc_realize(DeviceState *dev, Error **errp) g_autofree char *dram_alias_name = NULL; g_autofree char *root_bus_name = NULL; + msi_nonbroken = true; + /* PCI configuration space */ pcie_host_mmcfg_init(pex, PCIE_MMCFG_SIZE_MAX); sysbus_init_mmio(sbd, &pex->mmio); @@ -294,8 +296,6 @@ static void aspeed_pcie_rc_class_init(ObjectClass *klass, const void *data) hc->root_bus_path = aspeed_pcie_rc_root_bus_path; device_class_set_props(dc, aspeed_pcie_rc_props); - - msi_nonbroken = true; } /* -- 2.47.3
