From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755412AbbHYI7m (ORCPT ); Tue, 25 Aug 2015 04:59:42 -0400 Received: from 8bytes.org ([81.169.241.247]:51144 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755290AbbHYI7j (ORCPT ); Tue, 25 Aug 2015 04:59:39 -0400 Date: Tue, 25 Aug 2015 10:59:37 +0200 From: "joro@8bytes.org" To: "Xiao, Nan (Nan@HPservers-Core-OE-PSC)" Cc: "dwmw2@infradead.org" , "iommu@lists.linux-foundation.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] Fix bug in iommu_context_addr: Always get pointer to lower extended-context-table Message-ID: <20150825085937.GD32055@8bytes.org> References: <20150825084208.GB32055@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 25, 2015 at 08:46:27AM +0000, Xiao, Nan (Nan@HPservers-Core-OE-PSC) wrote: > Yes, your patch is simple and better! Okay, I queued this patch to my x86/vt-d branch: >>From 03932776424a799c3f065a69e98076a78530288b Mon Sep 17 00:00:00 2001 From: Joerg Roedel Date: Tue, 25 Aug 2015 10:54:28 +0200 Subject: [PATCH] iommu/vt-d: Really use upper context table when necessary There is a bug in iommu_context_addr() which will always use the lower context table, event when the upper context table needs to be used. Fix this issue. Fixes: 03ecc32c5274 ("iommu/vt-d: support extended root and context entries") Reported-by: Xiao, Nan Signed-off-by: Joerg Roedel --- drivers/iommu/intel-iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a85077d..63daf1b 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -803,6 +803,7 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu struct context_entry *context; u64 *entry; + entry = &root->lo; if (ecs_enabled(iommu)) { if (devfn >= 0x80) { devfn -= 0x80; @@ -810,7 +811,6 @@ static inline struct context_entry *iommu_context_addr(struct intel_iommu *iommu } devfn *= 2; } - entry = &root->lo; if (*entry & 1) context = phys_to_virt(*entry & VTD_PAGE_MASK); else { -- 1.8.4.5