Skip to content

Commit 78013ea

Browse files
author
Christoph Hellwig
committed
x86: remove the IOMMU table infrastructure
The IOMMU table tries to separate the different IOMMUs into different backends, but actually requires various cross calls. Rewrite the code to do the generic swiotlb/swiotlb-xen setup directly in pci-dma.c and then just call into the IOMMU drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
1 parent f39f8d0 commit 78013ea

File tree

21 files changed

+110
-459
lines changed

21 files changed

+110
-459
lines changed

arch/ia64/include/asm/iommu_table.h

Lines changed: 0 additions & 7 deletions
This file was deleted.

arch/x86/include/asm/dma-mapping.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/scatterlist.h>
1111
#include <asm/io.h>
12-
#include <asm/swiotlb.h>
1312

1413
extern int iommu_merge;
1514
extern int panic_on_overflow;

arch/x86/include/asm/gart.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ extern int gart_iommu_aperture_disabled;
3838
extern void early_gart_iommu_check(void);
3939
extern int gart_iommu_init(void);
4040
extern void __init gart_parse_options(char *);
41-
extern int gart_iommu_hole_init(void);
41+
void gart_iommu_hole_init(void);
4242

4343
#else
4444
#define gart_iommu_aperture 0
@@ -51,9 +51,8 @@ static inline void early_gart_iommu_check(void)
5151
static inline void gart_parse_options(char *options)
5252
{
5353
}
54-
static inline int gart_iommu_hole_init(void)
54+
static inline void gart_iommu_hole_init(void)
5555
{
56-
return -ENODEV;
5756
}
5857
#endif
5958

arch/x86/include/asm/iommu.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
extern int force_iommu, no_iommu;
1010
extern int iommu_detected;
1111

12+
#ifdef CONFIG_SWIOTLB
13+
extern bool x86_swiotlb_enable;
14+
#else
15+
#define x86_swiotlb_enable false
16+
#endif
17+
1218
/* 10 seconds */
1319
#define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000)
1420

arch/x86/include/asm/iommu_table.h

Lines changed: 0 additions & 102 deletions
This file was deleted.

arch/x86/include/asm/swiotlb.h

Lines changed: 0 additions & 30 deletions
This file was deleted.

arch/x86/include/asm/xen/swiotlb-xen.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,8 @@
33
#define _ASM_X86_SWIOTLB_XEN_H
44

55
#ifdef CONFIG_SWIOTLB_XEN
6-
extern int __init pci_xen_swiotlb_detect(void);
76
extern int pci_xen_swiotlb_init_late(void);
87
#else
9-
#define pci_xen_swiotlb_detect NULL
108
static inline int pci_xen_swiotlb_init_late(void) { return -ENXIO; }
119
#endif
1210

arch/x86/kernel/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ obj-y += bootflag.o e820.o
6868
obj-y += pci-dma.o quirks.o topology.o kdebugfs.o
6969
obj-y += alternative.o i8253.o hw_breakpoint.o
7070
obj-y += tsc.o tsc_msr.o io_delay.o rtc.o
71-
obj-y += pci-iommu_table.o
7271
obj-y += resource.o
7372
obj-y += irqflags.o
7473
obj-y += static_call.o
@@ -134,7 +133,6 @@ obj-$(CONFIG_PCSPKR_PLATFORM) += pcspeaker.o
134133

135134
obj-$(CONFIG_X86_CHECK_BIOS_CORRUPTION) += check.o
136135

137-
obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
138136
obj-$(CONFIG_OF) += devicetree.o
139137
obj-$(CONFIG_UPROBES) += uprobes.o
140138

arch/x86/kernel/amd_gart_64.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@
3838
#include <asm/iommu.h>
3939
#include <asm/gart.h>
4040
#include <asm/set_memory.h>
41-
#include <asm/swiotlb.h>
4241
#include <asm/dma.h>
4342
#include <asm/amd_nb.h>
4443
#include <asm/x86_init.h>
45-
#include <asm/iommu_table.h>
4644

4745
static unsigned long iommu_bus_base; /* GART remapping area (physical) */
4846
static unsigned long iommu_size; /* size of remapping area bytes */
@@ -808,7 +806,7 @@ int __init gart_iommu_init(void)
808806
flush_gart();
809807
dma_ops = &gart_dma_ops;
810808
x86_platform.iommu_shutdown = gart_iommu_shutdown;
811-
swiotlb = 0;
809+
x86_swiotlb_enable = false;
812810

813811
return 0;
814812
}
@@ -842,4 +840,3 @@ void __init gart_parse_options(char *p)
842840
}
843841
}
844842
}
845-
IOMMU_INIT_POST(gart_iommu_hole_init);

arch/x86/kernel/aperture_64.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ void __init early_gart_iommu_check(void)
392392

393393
static int __initdata printed_gart_size_msg;
394394

395-
int __init gart_iommu_hole_init(void)
395+
void __init gart_iommu_hole_init(void)
396396
{
397397
u32 agp_aper_base = 0, agp_aper_order = 0;
398398
u32 aper_size, aper_alloc = 0, aper_order = 0, last_aper_order = 0;
@@ -401,11 +401,11 @@ int __init gart_iommu_hole_init(void)
401401
int i, node;
402402

403403
if (!amd_gart_present())
404-
return -ENODEV;
404+
return;
405405

406406
if (gart_iommu_aperture_disabled || !fix_aperture ||
407407
!early_pci_allowed())
408-
return -ENODEV;
408+
return;
409409

410410
pr_info("Checking aperture...\n");
411411

@@ -491,10 +491,8 @@ int __init gart_iommu_hole_init(void)
491491
* and fixed up the northbridge
492492
*/
493493
exclude_from_core(last_aper_base, last_aper_order);
494-
495-
return 1;
496494
}
497-
return 0;
495+
return;
498496
}
499497

500498
if (!fallback_aper_force) {
@@ -527,7 +525,7 @@ int __init gart_iommu_hole_init(void)
527525
panic("Not enough memory for aperture");
528526
}
529527
} else {
530-
return 0;
528+
return;
531529
}
532530

533531
/*
@@ -561,6 +559,4 @@ int __init gart_iommu_hole_init(void)
561559
}
562560

563561
set_up_gart_resume(aper_order, aper_alloc);
564-
565-
return 1;
566562
}

0 commit comments

Comments
 (0)