From: Muli Ben-Yehuda <mulix@mulix.org>
To: Andi Kleen <ak@suse.de>
Cc: Jon Mason <jdmason@us.ibm.com>, Muli Ben-Yehuda <MULI@il.ibm.com>,
Linux-Kernel <linux-kernel@vger.kernel.org>,
discuss@x86-64.org, Andrew Morton <akpm@osdl.org>
Subject: [RFC PATCH 1/3] x86-64: Calgary IOMMU - introduce iommu_detected
Date: Tue, 14 Mar 2006 10:24:32 +0200 [thread overview]
Message-ID: <20060314082432.GE23631@granada.merseine.nu> (raw)
Hi,
swiotlb relies on the gart specific iommu_aperture variable to know if
we discovered a hardware IOMMU before swiotlb
initialization. Introduce iommu_detected to do the same thing, but in
a HW IOMMU neutral manner, in preparation for adding the Calgary HW
IOMMU.
Signed-Off-By: Muli Ben-Yehuda <mulix@mulix.org>
Signed-Off-By: Jon Mason <jdmason@us.ibm.com>
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/x86_64/kernel/aperture.c iommu_detected/arch/x86_64/kernel/aperture.c
--- vanilla/arch/x86_64/kernel/aperture.c 2006-03-14 08:24:37.000000000 +0200
+++ iommu_detected/arch/x86_64/kernel/aperture.c 2006-03-14 09:05:00.000000000 +0200
@@ -212,6 +212,7 @@ void __init iommu_hole_init(void)
if (read_pci_config(0, num, 3, 0x00) != NB_ID_3)
continue;
+ iommu_detected = 1;
iommu_aperture = 1;
aper_order = (read_pci_config(0, num, 3, 0x90) >> 1) & 7;
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/x86_64/kernel/pci-dma.c iommu_detected/arch/x86_64/kernel/pci-dma.c
--- vanilla/arch/x86_64/kernel/pci-dma.c 2006-03-14 08:24:37.000000000 +0200
+++ iommu_detected/arch/x86_64/kernel/pci-dma.c 2006-03-14 09:05:48.000000000 +0200
@@ -33,6 +33,9 @@ int panic_on_overflow __read_mostly = 0;
int force_iommu __read_mostly= 0;
#endif
+/* Set this to 1 if there is a HW IOMMU in the system */
+int iommu_detected __read_mostly = 0;
+
/* Dummy device used for NULL arguments (normally ISA). Better would
be probably a smaller DMA mask, but this is bug-to-bug compatible
to i386. */
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/x86_64/kernel/pci-gart.c iommu_detected/arch/x86_64/kernel/pci-gart.c
--- vanilla/arch/x86_64/kernel/pci-gart.c 2006-03-14 08:24:37.000000000 +0200
+++ iommu_detected/arch/x86_64/kernel/pci-gart.c 2006-03-14 09:06:44.000000000 +0200
@@ -627,6 +627,10 @@ static int __init pci_iommu_init(void)
if (swiotlb)
return -1;
+ /* Did we detect a different HW IOMMU? */
+ if (iommu_detected && !iommu_aperture)
+ return -1;
+
if (no_iommu ||
(!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
!iommu_aperture ||
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/x86_64/kernel/pci-swiotlb.c iommu_detected/arch/x86_64/kernel/pci-swiotlb.c
--- vanilla/arch/x86_64/kernel/pci-swiotlb.c 2006-03-14 08:24:37.000000000 +0200
+++ iommu_detected/arch/x86_64/kernel/pci-swiotlb.c 2006-03-14 09:07:05.000000000 +0200
@@ -31,7 +31,7 @@ struct dma_mapping_ops swiotlb_dma_ops =
void pci_swiotlb_init(void)
{
/* don't initialize swiotlb if iommu=off (no_iommu=1) */
- if (!iommu_aperture && !no_iommu &&
+ if (!iommu_detected && !no_iommu &&
(end_pfn > MAX_DMA32_PFN || force_iommu))
swiotlb = 1;
if (swiotlb) {
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/include/asm-x86_64/dma-mapping.h iommu_detected/include/asm-x86_64/dma-mapping.h
--- vanilla/include/asm-x86_64/dma-mapping.h 2006-03-14 08:26:27.000000000 +0200
+++ iommu_detected/include/asm-x86_64/dma-mapping.h 2006-03-14 09:07:56.000000000 +0200
@@ -183,5 +183,6 @@ dma_cache_sync(void *vaddr, size_t size,
extern struct device fallback_dev;
extern int panic_on_overflow;
+extern int iommu_detected;
#endif /* _X8664_DMA_MAPPING_H */
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
next reply other threads:[~2006-03-14 8:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-14 8:24 Muli Ben-Yehuda [this message]
2006-03-14 8:25 ` [PATCH RFC 2/3] x86-64: Calgary IOMMU - Calgary specific bits Muli Ben-Yehuda
2006-03-14 8:26 ` [RFC PATCH 3/3] x86-64: Calgary IOMMU - hook it in Muli Ben-Yehuda
2006-03-14 23:03 ` Pavel Machek
2006-03-14 23:22 ` Jon Mason
2006-03-14 23:26 ` Pavel Machek
2006-03-15 0:06 ` Jon Mason
2006-03-15 1:38 ` Muli Ben-Yehuda
2006-03-14 23:03 ` [PATCH RFC 2/3] x86-64: Calgary IOMMU - Calgary specific bits Pavel Machek
2006-03-15 0:55 ` Jon Mason
2006-03-15 0:56 ` Olof Johansson
2006-03-15 1:27 ` Jon Mason
2006-03-15 3:18 ` Olof Johansson
2006-03-15 1:52 ` Muli Ben-Yehuda
2006-03-14 15:01 ` [RFC PATCH 1/3] x86-64: Calgary IOMMU - introduce iommu_detected Andi Kleen
2006-03-14 15:07 ` Muli Ben-Yehuda
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=20060314082432.GE23631@granada.merseine.nu \
--to=mulix@mulix.org \
--cc=MULI@il.ibm.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=discuss@x86-64.org \
--cc=jdmason@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
/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®