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>
This commit is contained in:
parent
d07c1be069
commit
d7b9f7be21
@ -62,10 +62,8 @@ struct cal_chipset_ops {
|
|||||||
extern int use_calgary;
|
extern int use_calgary;
|
||||||
|
|
||||||
#ifdef CONFIG_CALGARY_IOMMU
|
#ifdef CONFIG_CALGARY_IOMMU
|
||||||
extern int calgary_iommu_init(void);
|
|
||||||
extern void detect_calgary(void);
|
extern void detect_calgary(void);
|
||||||
#else
|
#else
|
||||||
static inline int calgary_iommu_init(void) { return 1; }
|
|
||||||
static inline void detect_calgary(void) { return; }
|
static inline void detect_calgary(void) { return; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
#include <asm/dma.h>
|
#include <asm/dma.h>
|
||||||
#include <asm/rio.h>
|
#include <asm/rio.h>
|
||||||
#include <asm/bios_ebda.h>
|
#include <asm/bios_ebda.h>
|
||||||
|
#include <asm/x86_init.h>
|
||||||
|
|
||||||
#ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT
|
#ifdef CONFIG_CALGARY_IOMMU_ENABLED_BY_DEFAULT
|
||||||
int use_calgary __read_mostly = 1;
|
int use_calgary __read_mostly = 1;
|
||||||
@ -1344,6 +1345,8 @@ static void __init get_tce_space_from_tar(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int __init calgary_iommu_init(void);
|
||||||
|
|
||||||
void __init detect_calgary(void)
|
void __init detect_calgary(void)
|
||||||
{
|
{
|
||||||
int bus;
|
int bus;
|
||||||
@ -1445,6 +1448,8 @@ void __init detect_calgary(void)
|
|||||||
/* swiotlb for devices that aren't behind the Calgary. */
|
/* swiotlb for devices that aren't behind the Calgary. */
|
||||||
if (max_pfn > MAX_DMA32_PFN)
|
if (max_pfn > MAX_DMA32_PFN)
|
||||||
swiotlb = 1;
|
swiotlb = 1;
|
||||||
|
|
||||||
|
x86_init.iommu.iommu_init = calgary_iommu_init;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1461,12 +1466,6 @@ int __init calgary_iommu_init(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (no_iommu || (swiotlb && !calgary_detected))
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
if (!calgary_detected)
|
|
||||||
return -ENODEV;
|
|
||||||
|
|
||||||
/* ok, we're trying to use Calgary - let's roll */
|
/* ok, we're trying to use Calgary - let's roll */
|
||||||
printk(KERN_INFO "PCI-DMA: Using Calgary IOMMU\n");
|
printk(KERN_INFO "PCI-DMA: Using Calgary IOMMU\n");
|
||||||
|
|
||||||
|
@ -294,8 +294,6 @@ static int __init pci_iommu_init(void)
|
|||||||
|
|
||||||
x86_init.iommu.iommu_init();
|
x86_init.iommu.iommu_init();
|
||||||
|
|
||||||
calgary_iommu_init();
|
|
||||||
|
|
||||||
intel_iommu_init();
|
intel_iommu_init();
|
||||||
|
|
||||||
amd_iommu_init();
|
amd_iommu_init();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user