diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2009-11-10 05:46:13 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-11-10 06:31:15 -0500 |
commit | d7b9f7be216b04ff9d108f856bc03d96e7b3439c (patch) | |
tree | 8ee21e81501bbba10bead150235ca811bf81a6bb /arch | |
parent | d07c1be0693e0902d743160b8b638585b808f8ac (diff) |
x86: Calgary: Convert detect_calgary() to use iommu_init hook
This changes detect_calgary() to set init_calgary() to
iommu_init hook if detect_calgary() finds the Calgary IOMMU.
We can kill the code to check if we found the IOMMU in
init_calgary() since detect_calgary() sets init_calgary() only
when it found the IOMMU.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: chrisw@sous-sol.org
Cc: dwmw2@infradead.org
Cc: joerg.roedel@amd.com
LKML-Reference: <1257849980-22640-3-git-send-email-fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/calgary.h | 2 | ||||
-rw-r--r-- | arch/x86/kernel/pci-calgary_64.c | 11 | ||||
-rw-r--r-- | arch/x86/kernel/pci-dma.c | 2 |
3 files changed, 5 insertions, 10 deletions
diff --git a/arch/x86/include/asm/calgary.h b/arch/x86/include/asm/calgary.h index b03bedb62aa7..0918654305af 100644 --- a/arch/x86/include/asm/calgary.h +++ b/arch/x86/include/asm/calgary.h | |||
@@ -62,10 +62,8 @@ struct cal_chipset_ops { | |||
62 | extern int use_calgary; | 62 | extern int use_calgary; |
63 | 63 | ||
64 | #ifdef CONFIG_CALGARY_IOMMU | 64 | #ifdef CONFIG_CALGARY_IOMMU |
65 | extern int calgary_iommu_init(void); | ||
66 | extern void detect_calgary(void); | 65 | extern void detect_calgary(void); |
67 | #else | 66 | #else |
68 | static inline int calgary_iommu_init(void) { return 1; } | ||
69 | static inline void detect_calgary(void) { return; } | 67 | static inline void detect_calgary(void) { return; } |
70 | #endif | 68 | #endif |
71 | 69 | ||
diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index 971a3bec47a8..47bd419ea4d2 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include <asm/dma.h> | 46 | #include <asm/dma.h> |
47 | #include <asm/rio.h> | 47 | #include <asm/rio.h> |
48 | #include <asm/bios_ebda.h> | 48 | #include <asm/bios_ebda.h> |
49 | #include <asm/x86_init.h> | ||
49 | 50 | ||
50 | #ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT | 51 | #ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT |
51 | int use_calgary __read_mostly = 1; | 52 | int use_calgary __read_mostly = 1; |
@@ -1344,6 +1345,8 @@ static void __init get_tce_space_from_tar(void) | |||
1344 | return; | 1345 | return; |
1345 | } | 1346 | } |
1346 | 1347 | ||
1348 | int __init calgary_iommu_init(void); | ||
1349 | |||
1347 | void __init detect_calgary(void) | 1350 | void __init detect_calgary(void) |
1348 | { | 1351 | { |
1349 | int bus; | 1352 | int bus; |
@@ -1445,6 +1448,8 @@ void __init detect_calgary(void) | |||
1445 | /* swiotlb for devices that aren't behind the Calgary. */ | 1448 | /* swiotlb for devices that aren't behind the Calgary. */ |
1446 | if (max_pfn > MAX_DMA32_PFN) | 1449 | if (max_pfn > MAX_DMA32_PFN) |
1447 | swiotlb = 1; | 1450 | swiotlb = 1; |
1451 | |||
1452 | x86_init.iommu.iommu_init = calgary_iommu_init; | ||
1448 | } | 1453 | } |
1449 | return; | 1454 | return; |
1450 | 1455 | ||
@@ -1461,12 +1466,6 @@ int __init calgary_iommu_init(void) | |||
1461 | { | 1466 | { |
1462 | int ret; | 1467 | int ret; |
1463 | 1468 | ||
1464 | if (no_iommu || (swiotlb && !calgary_detected)) | ||
1465 | return -ENODEV; | ||
1466 | |||
1467 | if (!calgary_detected) | ||
1468 | return -ENODEV; | ||
1469 | |||
1470 | /* ok, we're trying to use Calgary - let's roll */ | 1469 | /* ok, we're trying to use Calgary - let's roll */ |
1471 | printk(KERN_INFO "PCI-DMA: Using Calgary IOMMU\n"); | 1470 | printk(KERN_INFO "PCI-DMA: Using Calgary IOMMU\n"); |
1472 | 1471 | ||
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index a13478da533c..0224da88256a 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
@@ -294,8 +294,6 @@ static int __init pci_iommu_init(void) | |||
294 | 294 | ||
295 | x86_init.iommu.iommu_init(); | 295 | x86_init.iommu.iommu_init(); |
296 | 296 | ||
297 | calgary_iommu_init(); | ||
298 | |||
299 | intel_iommu_init(); | 297 | intel_iommu_init(); |
300 | 298 | ||
301 | amd_iommu_init(); | 299 | amd_iommu_init(); |