From: Joerg Roedel <joerg.roedel@amd.com>
To: mingo@redhat.com, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org,
bhavna.sarathy@amd.com, robert.richter@amd.com,
Joerg Roedel <joerg.roedel@amd.com>
Subject: [PATCH 3/6] AMD IOMMU: flush domain TLB when there is more than one page to flush
Date: Thu, 3 Jul 2008 19:35:08 +0200 [thread overview]
Message-ID: <1215106511-12915-4-git-send-email-joerg.roedel@amd.com> (raw)
In-Reply-To: <1215106511-12915-1-git-send-email-joerg.roedel@amd.com>
This patch changes the domain TLB flushing behavior of the driver. When there
is more than one page to flush it flushes the whole domain TLB instead of every
single page. So we send only a single command to the IOMMU in every case which
is faster to execute.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
---
arch/x86/kernel/amd_iommu.c | 14 ++++++++++----
include/asm-x86/amd_iommu_types.h | 2 ++
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 329b2c3..f2766d8 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -140,16 +140,22 @@ static int iommu_queue_inv_iommu_pages(struct amd_iommu *iommu,
static int iommu_flush_pages(struct amd_iommu *iommu, u16 domid,
u64 address, size_t size)
{
- int i;
+ int s = 0;
unsigned pages = to_pages(address, size);
address &= PAGE_MASK;
- for (i = 0; i < pages; ++i) {
- iommu_queue_inv_iommu_pages(iommu, address, domid, 0, 0);
- address += PAGE_SIZE;
+ if (pages > 1) {
+ /*
+ * If we have to flush more than one page, flush all
+ * TLB entries for this domain
+ */
+ address = CMD_INV_IOMMU_ALL_PAGES_ADDRESS;
+ s = 1;
}
+ iommu_queue_inv_iommu_pages(iommu, address, domid, 0, s);
+
return 0;
}
diff --git a/include/asm-x86/amd_iommu_types.h b/include/asm-x86/amd_iommu_types.h
index 0f39550..7bfcb47 100644
--- a/include/asm-x86/amd_iommu_types.h
+++ b/include/asm-x86/amd_iommu_types.h
@@ -93,6 +93,8 @@
#define CMD_INV_IOMMU_PAGES_SIZE_MASK 0x01
#define CMD_INV_IOMMU_PAGES_PDE_MASK 0x02
+#define CMD_INV_IOMMU_ALL_PAGES_ADDRESS 0x7fffffffffffffffULL
+
/* macros and definitions for device table entries */
#define DEV_ENTRY_VALID 0x00
#define DEV_ENTRY_TRANSLATION 0x01
--
1.5.3.7
next prev parent reply other threads:[~2008-07-03 17:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-03 17:35 [PATCH 0/6] AMD IOMMU updates Joerg Roedel
2008-07-03 17:35 ` [PATCH 1/6] AMD IOMMU: more verbose Kconfig description text Joerg Roedel
2008-07-03 17:35 ` [PATCH 2/6] AMD IOMMU: remove unnecessary set_bit_string Joerg Roedel
2008-07-03 17:35 ` Joerg Roedel [this message]
2008-07-03 18:01 ` [PATCH 3/6] AMD IOMMU: flush domain TLB when there is more than onepage to flush Duran, Leo
2008-07-03 17:35 ` [PATCH 4/6] AMD IOMMU: honor iommu=off instead of amd_iommu=off Joerg Roedel
2008-07-03 17:35 ` [PATCH 5/6] AMD IOMMU: don't try to init IOMMU if early detect code did not detect one Joerg Roedel
2008-07-03 17:35 ` [PATCH 6/6] AMD IOMMU: remove unnecessary code from the iommu_enable function Joerg Roedel
2008-07-04 9:52 ` [PATCH 0/6] AMD IOMMU updates Ingo Molnar
2008-07-07 7:40 ` FUJITA Tomonori
2008-07-07 7:44 ` Ingo Molnar
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=1215106511-12915-4-git-send-email-joerg.roedel@amd.com \
--to=joerg.roedel@amd.com \
--cc=bhavna.sarathy@amd.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®