* [PATCH v1] intel_iommu: fix bug to read DMAR_RTADDR_REG
@ 2019-12-05 9:54 Yi Sun
2019-12-05 13:33 ` Peter Xu
0 siblings, 1 reply; 2+ messages in thread
From: Yi Sun @ 2019-12-05 9:54 UTC (permalink / raw)
To: qemu-devel; +Cc: jasowang, Yi Sun, dgilbert, peterx, mst
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>
---
hw/i386/intel_iommu.c | 7 +++----
1 file 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 */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] intel_iommu: fix bug to read DMAR_RTADDR_REG
2019-12-05 9:54 [PATCH v1] intel_iommu: fix bug to read DMAR_RTADDR_REG Yi Sun
@ 2019-12-05 13:33 ` Peter Xu
0 siblings, 0 replies; 2+ messages in thread
From: Peter Xu @ 2019-12-05 13:33 UTC (permalink / raw)
To: Yi Sun; +Cc: jasowang, mst, qemu-devel, dgilbert
On Thu, Dec 05, 2019 at 05:54:39PM +0800, Yi Sun wrote:
> 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>
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-05 13:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 9:54 [PATCH v1] intel_iommu: fix bug to read DMAR_RTADDR_REG Yi Sun
2019-12-05 13:33 ` Peter Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.