From df3390f4014bc707a7c301843240af6ae357edc0 Mon Sep 17 00:00:00 2001 From: Fei Li Date: Fri, 29 Apr 2022 17:19:54 +0800 Subject: [PATCH] hv: vtd: reset the one-shot bits for GCMD_REG If multiple control fields in GCMD_REG register need to be modified, software must serialize the modifications through multiple writes to this register. So one-shot bits (bits 30-29, 27 and 24) in gcmd should not been set. Otherwise, other control field may be written to GCMD_REG at the same time with one-shot bit (Clearing one-shot bit has no effect, software sets this field would set/update this control field used by hardware). Tracked-On: #7381 Signed-off-by: Fei Li --- hypervisor/arch/x86/vtd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index 4e072bfe8..66938e3bb 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -446,7 +446,7 @@ static int32_t dmar_register_hrhd(struct dmar_drhd_rt *dmar_unit) * register to control remapping hardware. Global Status Register is the corresponding read-only register to * report remapping hardware status. */ - dmar_unit->gcmd = iommu_read32(dmar_unit, DMAR_GSTS_REG); + dmar_unit->gcmd = iommu_read32(dmar_unit, DMAR_GSTS_REG) & 0x96FFFFFFU; // Reset the one-shot bits; dmar_unit->cap_msagaw = dmar_unit_get_msagw(dmar_unit);