Patch "iommu/vt-d: Serialize IOMMU GCMD register modifications" has been added to the 5.8-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    iommu/vt-d: Serialize IOMMU GCMD register modifications

to the 5.8-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     iommu-vt-d-serialize-iommu-gcmd-register-modificatio.patch
and it can be found in the queue-5.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f05e1d1118b0332c1c789547b748319e694a4bd3
Author: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
Date:   Fri Aug 28 08:06:15 2020 +0800

    iommu/vt-d: Serialize IOMMU GCMD register modifications
    
    [ Upstream commit 6e4e9ec65078093165463c13d4eb92b3e8d7b2e8 ]
    
    The VT-d spec requires (10.4.4 Global Command Register, GCMD_REG General
    Description) that:
    
    If multiple control fields in this register need to be modified, software
    must serialize the modifications through multiple writes to this register.
    
    However, in irq_remapping.c, modifications of IRE and CFI are done in one
    write. We need to do two separate writes with STS checking after each. It
    also checks the status register before writing command register to avoid
    unnecessary register write.
    
    Fixes: af8d102f999a4 ("x86/intel/irq_remapping: Clean up x2apic opt-out security warning mess")
    Signed-off-by: Lu Baolu <baolu.lu@xxxxxxxxxxxxxxx>
    Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
    Cc: Andy Lutomirski <luto@xxxxxxxxxxxxxx>
    Cc: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>
    Cc: Kevin Tian <kevin.tian@xxxxxxxxx>
    Cc: Ashok Raj <ashok.raj@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20200828000615.8281-1-baolu.lu@xxxxxxxxxxxxxxx
    Signed-off-by: Joerg Roedel <jroedel@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/iommu/intel/irq_remapping.c b/drivers/iommu/intel/irq_remapping.c
index aa096b333a991..4828f4fe09ab5 100644
--- a/drivers/iommu/intel/irq_remapping.c
+++ b/drivers/iommu/intel/irq_remapping.c
@@ -507,12 +507,18 @@ static void iommu_enable_irq_remapping(struct intel_iommu *iommu)
 
 	/* Enable interrupt-remapping */
 	iommu->gcmd |= DMA_GCMD_IRE;
-	iommu->gcmd &= ~DMA_GCMD_CFI;  /* Block compatibility-format MSIs */
 	writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
-
 	IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
 		      readl, (sts & DMA_GSTS_IRES), sts);
 
+	/* Block compatibility-format MSIs */
+	if (sts & DMA_GSTS_CFIS) {
+		iommu->gcmd &= ~DMA_GCMD_CFI;
+		writel(iommu->gcmd, iommu->reg + DMAR_GCMD_REG);
+		IOMMU_WAIT_OP(iommu, DMAR_GSTS_REG,
+			      readl, !(sts & DMA_GSTS_CFIS), sts);
+	}
+
 	/*
 	 * With CFI clear in the Global Command register, we should be
 	 * protected from dangerous (i.e. compatibility) interrupts



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux