diff options
author | Muli Ben-Yehuda <muli@il.ibm.com> | 2006-12-06 20:14:07 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-12-06 20:14:07 -0500 |
commit | bff6547bb6a4e82c399d74e7fba78b12d2f162ed (patch) | |
tree | faeb4e95d243b0eb5cd6337739e4c14d154b282f | |
parent | eae93755540bae18aff46b8a0e621b5d65bd5380 (diff) |
[PATCH] Calgary: allow compiling Calgary in but not using it by default
This patch makes it possible to compile Calgary in but not use it by
default. In this mode, use 'iommu=calgary' to activate it.
Signed-off-by: Muli Ben-Yehuda <muli@il.ibm.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Andi Kleen <ak@suse.de>
-rw-r--r-- | Documentation/x86_64/boot-options.txt | 3 | ||||
-rw-r--r-- | arch/x86_64/Kconfig | 11 | ||||
-rw-r--r-- | arch/x86_64/kernel/pci-calgary.c | 9 | ||||
-rw-r--r-- | arch/x86_64/kernel/pci-dma.c | 5 | ||||
-rw-r--r-- | include/asm-x86_64/calgary.h | 2 |
5 files changed, 29 insertions, 1 deletions
diff --git a/Documentation/x86_64/boot-options.txt b/Documentation/x86_64/boot-options.txt index ab9b1c046c00..dbdcaf68e3ea 100644 --- a/Documentation/x86_64/boot-options.txt +++ b/Documentation/x86_64/boot-options.txt | |||
@@ -179,7 +179,7 @@ PCI | |||
179 | IOMMU | 179 | IOMMU |
180 | 180 | ||
181 | iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] | 181 | iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] |
182 | [,forcesac][,fullflush][,nomerge][,noaperture] | 182 | [,forcesac][,fullflush][,nomerge][,noaperture][,calgary] |
183 | size set size of iommu (in bytes) | 183 | size set size of iommu (in bytes) |
184 | noagp don't initialize the AGP driver and use full aperture. | 184 | noagp don't initialize the AGP driver and use full aperture. |
185 | off don't use the IOMMU | 185 | off don't use the IOMMU |
@@ -200,6 +200,7 @@ IOMMU | |||
200 | buffering. | 200 | buffering. |
201 | nodac Forbid DMA >4GB | 201 | nodac Forbid DMA >4GB |
202 | panic Always panic when IOMMU overflows | 202 | panic Always panic when IOMMU overflows |
203 | calgary Use the Calgary IOMMU if it is available | ||
203 | 204 | ||
204 | swiotlb=pages[,force] | 205 | swiotlb=pages[,force] |
205 | 206 | ||
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig index 010d2265f1cf..5cb509dbffe4 100644 --- a/arch/x86_64/Kconfig +++ b/arch/x86_64/Kconfig | |||
@@ -455,6 +455,17 @@ config CALGARY_IOMMU | |||
455 | Normally the kernel will make the right choice by itself. | 455 | Normally the kernel will make the right choice by itself. |
456 | If unsure, say Y. | 456 | If unsure, say Y. |
457 | 457 | ||
458 | config CALGARY_IOMMU_ENABLED_BY_DEFAULT | ||
459 | bool "Should Calgary be enabled by default?" | ||
460 | default y | ||
461 | depends on CALGARY_IOMMU | ||
462 | help | ||
463 | Should Calgary be enabled by default? if you choose 'y', Calgary | ||
464 | will be used (if it exists). If you choose 'n', Calgary will not be | ||
465 | used even if it exists. If you choose 'n' and would like to use | ||
466 | Calgary anyway, pass 'iommu=calgary' on the kernel command line. | ||
467 | If unsure, say Y. | ||
468 | |||
458 | # need this always selected by IOMMU for the VIA workaround | 469 | # need this always selected by IOMMU for the VIA workaround |
459 | config SWIOTLB | 470 | config SWIOTLB |
460 | bool | 471 | bool |
diff --git a/arch/x86_64/kernel/pci-calgary.c b/arch/x86_64/kernel/pci-calgary.c index 8a1e4f35bc3c..0ddf29dae7e0 100644 --- a/arch/x86_64/kernel/pci-calgary.c +++ b/arch/x86_64/kernel/pci-calgary.c | |||
@@ -43,6 +43,12 @@ | |||
43 | #include <asm/dma.h> | 43 | #include <asm/dma.h> |
44 | #include <asm/rio.h> | 44 | #include <asm/rio.h> |
45 | 45 | ||
46 | #ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT | ||
47 | int use_calgary __read_mostly = 1; | ||
48 | #else | ||
49 | int use_calgary __read_mostly = 0; | ||
50 | #endif /* CONFIG_CALGARY_DEFAULT_ENABLED */ | ||
51 | |||
46 | #define PCI_DEVICE_ID_IBM_CALGARY 0x02a1 | 52 | #define PCI_DEVICE_ID_IBM_CALGARY 0x02a1 |
47 | #define PCI_VENDOR_DEVICE_ID_CALGARY \ | 53 | #define PCI_VENDOR_DEVICE_ID_CALGARY \ |
48 | (PCI_VENDOR_ID_IBM | PCI_DEVICE_ID_IBM_CALGARY << 16) | 54 | (PCI_VENDOR_ID_IBM | PCI_DEVICE_ID_IBM_CALGARY << 16) |
@@ -1061,6 +1067,9 @@ void __init detect_calgary(void) | |||
1061 | if (swiotlb || no_iommu || iommu_detected) | 1067 | if (swiotlb || no_iommu || iommu_detected) |
1062 | return; | 1068 | return; |
1063 | 1069 | ||
1070 | if (!use_calgary) | ||
1071 | return; | ||
1072 | |||
1064 | if (!early_pci_allowed()) | 1073 | if (!early_pci_allowed()) |
1065 | return; | 1074 | return; |
1066 | 1075 | ||
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c index f8d857453f8a..683b7a5c1ab3 100644 --- a/arch/x86_64/kernel/pci-dma.c +++ b/arch/x86_64/kernel/pci-dma.c | |||
@@ -296,6 +296,11 @@ __init int iommu_setup(char *p) | |||
296 | gart_parse_options(p); | 296 | gart_parse_options(p); |
297 | #endif | 297 | #endif |
298 | 298 | ||
299 | #ifdef CONFIG_CALGARY_IOMMU | ||
300 | if (!strncmp(p, "calgary", 7)) | ||
301 | use_calgary = 1; | ||
302 | #endif /* CONFIG_CALGARY_IOMMU */ | ||
303 | |||
299 | p += strcspn(p, ","); | 304 | p += strcspn(p, ","); |
300 | if (*p == ',') | 305 | if (*p == ',') |
301 | ++p; | 306 | ++p; |
diff --git a/include/asm-x86_64/calgary.h b/include/asm-x86_64/calgary.h index 6b93f5a3a5c8..7ee900645719 100644 --- a/include/asm-x86_64/calgary.h +++ b/include/asm-x86_64/calgary.h | |||
@@ -51,6 +51,8 @@ struct iommu_table { | |||
51 | #define TCE_TABLE_SIZE_4M 6 | 51 | #define TCE_TABLE_SIZE_4M 6 |
52 | #define TCE_TABLE_SIZE_8M 7 | 52 | #define TCE_TABLE_SIZE_8M 7 |
53 | 53 | ||
54 | extern int use_calgary; | ||
55 | |||
54 | #ifdef CONFIG_CALGARY_IOMMU | 56 | #ifdef CONFIG_CALGARY_IOMMU |
55 | extern int calgary_iommu_init(void); | 57 | extern int calgary_iommu_init(void); |
56 | extern void detect_calgary(void); | 58 | extern void detect_calgary(void); |