summaryrefslogtreecommitdiffstats
path: root/hw/i386/intel_iommu.c
diff options
context:
space:
mode:
authorYi Sun2019-12-05 10:54:39 +0100
committerMichael S. Tsirkin2020-01-05 13:03:03 +0100
commit8fdee7118defeb34441d860047e3e0cfd9da9c26 (patch)
treef4b58d07756ec4e37aa1d62ef94582fef45ee044 /hw/i386/intel_iommu.c
parentvirtio-input: convert to new virtio_delete_queue (diff)
downloadqemu-8fdee7118defeb34441d860047e3e0cfd9da9c26.tar.gz
qemu-8fdee7118defeb34441d860047e3e0cfd9da9c26.tar.xz
qemu-8fdee7118defeb34441d860047e3e0cfd9da9c26.zip
intel_iommu: fix bug to read DMAR_RTADDR_REG
Should directly read DMAR_RTADDR_REG but not using 's->root'. Because 's->root' is modified in 'vtd_root_table_setup()' so that the first 12 bits are omitted. This causes the guest iommu debugfs cannot show pasid tables. Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com> Message-Id: <20191205095439.29114-1-yi.y.sun@linux.intel.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/i386/intel_iommu.c')
-rw-r--r--hw/i386/intel_iommu.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 43c94b993b..ee06993675 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -2610,16 +2610,15 @@ static uint64_t vtd_mem_read(void *opaque, hwaddr addr, unsigned size)
switch (addr) {
/* Root Table Address Register, 64-bit */
case DMAR_RTADDR_REG:
+ val = vtd_get_quad_raw(s, DMAR_RTADDR_REG);
if (size == 4) {
- val = s->root & ((1ULL << 32) - 1);
- } else {
- val = s->root;
+ val = val & ((1ULL << 32) - 1);
}
break;
case DMAR_RTADDR_REG_HI:
assert(size == 4);
- val = s->root >> 32;
+ val = vtd_get_quad_raw(s, DMAR_RTADDR_REG) >> 32;
break;
/* Invalidation Queue Address Register, 64-bit */