public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "joro@8bytes.org" <joro@8bytes.org>
To: "Xiao, Nan (Nan@HPservers-Core-OE-PSC)" <nan.xiao@hp.com>
Cc: "dwmw2@infradead.org" <dwmw2@infradead.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Fix bug in iommu_context_addr: Always get pointer to lower extended-context-table
Date: Tue, 25 Aug 2015 10:59:37 +0200	[thread overview]
Message-ID: <20150825085937.GD32055@8bytes.org> (raw)
In-Reply-To: <F9D82F0D71C0024FA18FE771EDDAF149082020ED@G4W3298.americas.hpqcorp.net>

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 <jroedel@suse.de>
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 <nan.xiao@hp.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 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


  reply	other threads:[~2015-08-25  8:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-08-25  9:15       ` Xiao, Nan (Nan@HPservers-Core-OE-PSC)
2015-08-25  9:42         ` joro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150825085937.GD32055@8bytes.org \
    --to=joro@8bytes.org \
    --cc=dwmw2@infradead.org \
    --cc=iommu@lists.linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nan.xiao@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox