intel-iommu: Accept 64-bit writes to FEADDR
PATCH 1/1 intel-iommu: Accept 64-bit writes to FEADDR
From: Jan Kiszka <[email protected]>
Xen is doing this [1] and currently triggers an abort.
--- hw/i386/intel_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
hw/i386/intel_iommu.c +6 -1
@@ -2129,7 +2129,12 @@ static void vtd_mem_write(void *opaque, hwaddr addr,/* Fault Event Address Register, 32-bit */ case DMAR_FEADDR_REG : -assert (size ==4 ); +/* +* While the register is 32-bit only, some guests (Xen...) write to it +* with 64-bit. Ignore the upper part, that's likely what the hardware +* does as well (plus the upper part is not used by our model anyway). +*/ +assert (size >=4 );vtd_set_long (s, addr, val);break ;
Signature · 1 line
2.13.6
Quoted 19 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Xen is doing this [1] and currently triggers an abort.
Reported-by Luis Lloret <[email protected]>Signed-off-by Jan Kiszka <[email protected]>--- hw/i386/intel_iommu.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)hw/i386/intel_iommu.c +0
-0@@ -2129,7 +2129,12 @@ static void vtd_mem_write(void *opaque, hwaddr addr,/* Fault Event Address Register, 32-bit */
hw/i386/intel_iommu.c static void vtd_mem_write(void *opaque, hwaddr addr, · line 2139
Quoted 10 lines
hw/i386/intel_iommu.c +6
-1case DMAR_FEADDR_REG : -assert (size ==4 ); +/* +* While the register is 32-bit only, some guests (Xen...) write to it +* with 64-bit. Ignore the upper part, that's likely what the hardware +* does as well (plus the upper part is not used by our model anyway). +*/ +assert (size >=4 );vtd_set_long (s, addr, val);break ;
(Sorry for the late response due to Chinese Spring Festival)
I agree with the problem there, but do we still better provide a conditional vtd_set_quad()? Since from the spec 10.4.13 the upper 32 bits may still be used when x2apic (Extended Interrupt Mode) is enabled?
Thanks,
Signature · 1 line
Peter Xu
PATCH v2 1/1 intel-iommu: Accept 64-bit writes to FEADDR
From: Jan Kiszka <[email protected]>
Xen is doing this [1] and currently triggers an abort.
--- hw/i386/intel_iommu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
hw/i386/intel_iommu.c +9 -2
@@ -2129,8 +2129,15 @@ static void vtd_mem_write(void *opaque, hwaddr addr,/* Fault Event Address Register, 32-bit */ case DMAR_FEADDR_REG : -assert (size ==4 ); -vtd_set_long (s, addr, val); +if (size ==4 ) { +vtd_set_long (s, addr, val); + }else { +/* +* While the register is 32-bit only, some guests (Xen...) write to +* it with 64-bit. +*/ +vtd_set_quad (s, addr, val); + }break ;/* Fault Event Upper Address Register, 32-bit */
Quoted 8 lines · Jan Kiszka
From: Jan Kiszka <[email protected]>
Xen is doing this [1] and currently triggers an abort.
Reported-by Luis Lloret <[email protected]>Signed-off-by Jan Kiszka <[email protected]>
Thanks, Jan.
Quoted 26 lines
--- hw/i386/intel_iommu.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)hw/i386/intel_iommu.c +9
-2@@ -2129,8 +2129,15 @@ static void vtd_mem_write(void *opaque, hwaddr addr,/* Fault Event Address Register, 32-bit */ case DMAR_FEADDR_REG : -assert (size ==4 ); -vtd_set_long (s, addr, val); +if (size ==4 ) { +vtd_set_long (s, addr, val); + }else { +/* +* While the register is 32-bit only, some guests (Xen...) write to +* it with 64-bit. +*/ +vtd_set_quad (s, addr, val); + }break ;/* Fault Event Upper Address Register, 32-bit */
Signature · 1 line
Peter Xu