summaryrefslogtreecommitdiffstats
path: root/hw/i386
diff options
context:
space:
mode:
authorJason Wang2022-03-17 09:05:21 +0100
committerMichael S. Tsirkin2022-05-16 10:38:40 +0200
commitceb058955ab529937498acfd3c9259a2a64b2d4e (patch)
tree4544ec4a5208a639b4bb637e875307c57df1e6bf /hw/i386
parentintel-iommu: block output address in interrupt address range (diff)
downloadqemu-ceb058955ab529937498acfd3c9259a2a64b2d4e.tar.gz
qemu-ceb058955ab529937498acfd3c9259a2a64b2d4e.tar.xz
qemu-ceb058955ab529937498acfd3c9259a2a64b2d4e.zip
intel-iommu: update root_scalable before switching as during post_load
We need check whether passthrough is enabled during vtd_switch_address_space() by checking the context entries. This requires the root_scalable to be set correctly otherwise we may try to check legacy rsvd bits instead of scalable ones. Fixing this by updating root_scalable before switching the address spaces during post_load. Fixes: fb43cf739e ("intel_iommu: scalable mode emulation") Signed-off-by: Jason Wang <jasowang@redhat.com> Message-Id: <20220317080522.14621-1-jasowang@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
Diffstat (limited to 'hw/i386')
-rw-r--r--hw/i386/intel_iommu.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 695dd51dc3..53e3f5035d 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3074,13 +3074,6 @@ static int vtd_post_load(void *opaque, int version_id)
IntelIOMMUState *iommu = opaque;
/*
- * Memory regions are dynamically turned on/off depending on
- * context entry configurations from the guest. After migration,
- * we need to make sure the memory regions are still correct.
- */
- vtd_switch_address_space_all(iommu);
-
- /*
* We don't need to migrate the root_scalable because we can
* simply do the calculation after the loading is complete. We
* can actually do similar things with root, dmar_enabled, etc.
@@ -3089,6 +3082,13 @@ static int vtd_post_load(void *opaque, int version_id)
*/
vtd_update_scalable_state(iommu);
+ /*
+ * Memory regions are dynamically turned on/off depending on
+ * context entry configurations from the guest. After migration,
+ * we need to make sure the memory regions are still correct.
+ */
+ vtd_switch_address_space_all(iommu);
+
return 0;
}