public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix bug in iommu_context_addr: Always get pointer to lower extended-context-table
@ 2015-08-24  6:26 Xiao, Nan (Nan@HPS Performance, Beijing)
  2015-08-25  8:42 ` joro
  0 siblings, 1 reply; 6+ messages in thread
From: Xiao, Nan (Nan@HPS Performance, Beijing) @ 2015-08-24  6:26 UTC (permalink / raw)
  To: joro@8bytes.org, dwmw2@infradead.org,
	iommu@lists.linux-foundation.org
  Cc: linux-kernel@vger.kernel.org

Hi David & joerg,

In iommu_context_addr() function, we always use lower extended-context-table
even though upper-half of the extended root-entry is present.

Signed-off-by: Nan Xiao <nan.xiao@hp.com>
---
 drivers/iommu/intel-iommu.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 0649b94..4213598 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -759,10 +759,11 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu
 		if (devfn >= 0x80) {
 			devfn -= 0x80;
 			entry = &root->hi;
-		}
+		} else
+			entry = &root->lo;
 		devfn *= 2;
-	}
-	entry = &root->lo;
+	} else
+		entry = &root->lo;
 	if (*entry & 1)
 		context = phys_to_virt(*entry & VTD_PAGE_MASK);
 	else {
-- 
2.4.3

Best Regards
Nan Xiao


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-25  9:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24  6:26 [PATCH] Fix bug in iommu_context_addr: Always get pointer to lower extended-context-table Xiao, Nan (Nan@HPS Performance, Beijing)
2015-08-25  8:42 ` joro
2015-08-25  8:46   ` Xiao, Nan (Nan@HPservers-Core-OE-PSC)
2015-08-25  8:59     ` joro
2015-08-25  9:15       ` Xiao, Nan (Nan@HPservers-Core-OE-PSC)
2015-08-25  9:42         ` joro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox