From 5abf99c76e76fa2f5c72c51db1443e7032423998 Mon Sep 17 00:00:00 2001 From: Maxim Levitsky Date: Thu, 20 Jan 2022 18:00:07 +0200 Subject: [PATCH] Pause all VCPUs on host bridge memregion changes This is temp hack to avoid cpu_pm=on failures --- hw/pci-host/i440fx.c | 5 +++++ hw/pci-host/q35.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c index e08716142b..03384b410e 100644 --- a/hw/pci-host/i440fx.c +++ b/hw/pci-host/i440fx.c @@ -36,6 +36,7 @@ #include "qapi/visitor.h" #include "qemu/error-report.h" #include "qom/object.h" +#include "sysemu/cpus.h" /* * I440FX chipset data sheet. @@ -69,6 +70,8 @@ static void i440fx_update_memory_mappings(PCII440FXState *d) int i; PCIDevice *pd = PCI_DEVICE(d); + pause_all_vcpus(); + memory_region_transaction_begin(); for (i = 0; i < ARRAY_SIZE(d->pam_regions); i++) { pam_update(&d->pam_regions[i], i, @@ -79,6 +82,8 @@ static void i440fx_update_memory_mappings(PCII440FXState *d) memory_region_set_enabled(&d->smram, pd->config[I440FX_SMRAM] & SMRAM_G_SMRAME); memory_region_transaction_commit(); + + resume_all_vcpus(); } diff --git a/hw/pci-host/q35.c b/hw/pci-host/q35.c index ab5a47aff5..02831f5248 100644 --- a/hw/pci-host/q35.c +++ b/hw/pci-host/q35.c @@ -37,6 +37,7 @@ #include "qapi/error.h" #include "qapi/visitor.h" #include "qemu/module.h" +#include "sysemu/cpus.h" /**************************************************************************** * Q35 host @@ -471,6 +472,8 @@ static void mch_write_config(PCIDevice *d, { MCHPCIState *mch = MCH_PCI_DEVICE(d); + pause_all_vcpus(); + pci_default_write_config(d, address, val, len); if (ranges_overlap(address, len, MCH_HOST_BRIDGE_PAM0, @@ -496,6 +499,8 @@ static void mch_write_config(PCIDevice *d, if (ranges_overlap(address, len, MCH_HOST_BRIDGE_F_SMBASE, 1)) { mch_update_smbase_smram(mch); } + + resume_all_vcpus(); } static void mch_update(MCHPCIState *mch) -- 2.26.3