[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    iommu/amd: Fix interrupt remapping when disable guest_mode
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2017-06-30 18:06:39
Message-ID: 20170630180639.640F322D7B () pdx-korg-gitolite-1 ! ci ! codeaurora ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/84a21dbdef0b96d773599c33c2afbb002198d303
Commit:     84a21dbdef0b96d773599c33c2afbb002198d303
Parent:     7304e8f28bb2f3cb2baf37c1bb2caa0f54ca4e43
Refname:    refs/heads/master
Author:     Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
AuthorDate: Mon Jun 26 04:28:04 2017 -0500
Committer:  Joerg Roedel <jroedel@suse.de>
CommitDate: Wed Jun 28 14:44:56 2017 +0200

    iommu/amd: Fix interrupt remapping when disable guest_mode
    
    Pass-through devices to VM guest can get updated IRQ affinity
    information via irq_set_affinity() when not running in guest mode.
    Currently, AMD IOMMU driver in GA mode ignores the updated information
    if the pass-through device is setup to use vAPIC regardless of guest_mode.
    This could cause invalid interrupt remapping.
    
    Also, the guest_mode bit should be set and cleared only when
    SVM updates posted-interrupt interrupt remapping information.
    
    Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
    Cc: Joerg Roedel <jroedel@suse.de>
    Fixes: d98de49a53e48 ('iommu/amd: Enable vAPIC interrupt remapping mode by default')
    Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 drivers/iommu/amd_iommu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 63cacf5d6cf2..0f1219fa8561 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3879,11 +3879,9 @@ static void irte_ga_prepare(void *entry,
 			    u8 vector, u32 dest_apicid, int devid)
 {
 	struct irte_ga *irte = (struct irte_ga *) entry;
-	struct iommu_dev_data *dev_data = search_dev_data(devid);
 
 	irte->lo.val                      = 0;
 	irte->hi.val                      = 0;
-	irte->lo.fields_remap.guest_mode  = dev_data ? dev_data->use_vapic : 0;
 	irte->lo.fields_remap.int_type    = delivery_mode;
 	irte->lo.fields_remap.dm          = dest_mode;
 	irte->hi.fields.vector            = vector;
@@ -3939,10 +3937,10 @@ static void irte_ga_set_affinity(void *entry, u16 devid, u16 index,
 	struct irte_ga *irte = (struct irte_ga *) entry;
 	struct iommu_dev_data *dev_data = search_dev_data(devid);
 
-	if (!dev_data || !dev_data->use_vapic) {
+	if (!dev_data || !dev_data->use_vapic ||
+	    !irte->lo.fields_remap.guest_mode) {
 		irte->hi.fields.vector = vector;
 		irte->lo.fields_remap.destination = dest_apicid;
-		irte->lo.fields_remap.guest_mode = 0;
 		modify_irte_ga(devid, index, irte, NULL);
 	}
 }
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic