x86: some GART cleanups
Subsystems (4)
cover x86: some GART cleanups
This series of patches contains cleanups for the GART IOMMU implementation in Linux. It mostly renames symbols to make clear that they belong only to the GART and not to the implementations for other IOMMUs. It also makes some unnecessary exported functions static in the GART implementation. The patches apply cleanly to Linus latest git tree. Here is the complete diffstat:
arch/x86/kernel/Makefile_64 | 2 +- arch/x86/kernel/aperture_64.c | 15 ++++++++------- arch/x86/kernel/early-quirks.c | 10 +++++----- arch/x86/kernel/pci-calgary_64.c | 2 +- arch/x86/kernel/pci-dma_64.c | 10 +++++----- arch/x86/kernel/pci-gart_64.c | 19 +++++++++---------- arch/x86/kernel/pci-nommu_64.c | 2 +- arch/x86/kernel/pci-swiotlb_64.c | 2 +- arch/x86/kernel/reboot_64.c | 2 +- arch/x86_64/Kconfig | 6 +++--- arch/x86_64/Kconfig.debug | 2 +- arch/x86_64/defconfig | 2 +- drivers/char/agp/Kconfig | 4 ++-- drivers/char/agp/amd64-agp.c | 2 +- drivers/pci/intel-iommu.c | 2 +- drivers/usb/core/message.c | 2 +- include/asm-x86/gart.h | 20 +++++++++----------- include/asm-x86/pci_64.h | 3 +-- 18 files changed, 52 insertions(+), 55 deletions(-)
PATCH 1/4 x86 gart: rename iommu.h to gart.h
This patch renames the include file asm-x86/iommu.h to asm-x86/gart.h to make clear to which IOMMU implementation it belongs. The patch also adds "GART" to the Kconfig line.
---
arch/x86/kernel/aperture_64.c | 2 +-
arch/x86/kernel/early-quirks.c | 2 +-
arch/x86/kernel/pci-calgary_64.c | 2 +-
arch/x86/kernel/pci-dma_64.c | 2 +-
arch/x86/kernel/pci-gart_64.c | 2 +-
arch/x86/kernel/pci-nommu_64.c | 2 +-
arch/x86/kernel/pci-swiotlb_64.c | 2 +-
arch/x86/kernel/reboot_64.c | 2 +-
arch/x86_64/Kconfig | 2 +-
drivers/pci/intel-iommu.c | 2 +-
include/asm-x86/{iommu.h => gart.h} | 4 ++--
11 files changed, 12 insertions(+), 12 deletions(-)
rename include/asm-x86/{iommu.h => gart.h} (92%)arch/x86/kernel/aperture_64.c +1 -1
@@ -20,7 +20,7 @@#include <linux/ioport.h> #include <asm/e820.h> #include <asm/io.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/pci-direct.h> #include <asm/dma.h> #include <asm/k8.h>
arch/x86/kernel/early-quirks.c +1 -1
@@ -18,7 +18,7 @@#include <asm/apic.h> #ifdef CONFIG_IOMMU -#include <asm/iommu.h> +#include <asm/gart.h> #endif static void __init via_bugs (void )
arch/x86/kernel/pci-calgary_64.c +1 -1
@@ -36,7 +36,7 @@#include <linux/pci.h> #include <linux/delay.h> #include <linux/scatterlist.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/calgary.h> #include <asm/tce.h> #include <asm/pci-direct.h>
arch/x86/kernel/pci-dma_64.c +1 -1
@@ -9,7 +9,7 @@#include <linux/module.h> #include <linux/dmar.h> #include <asm/io.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/calgary.h> int iommu_merge__read_mostly =1 ;
arch/x86/kernel/pci-gart_64.c +1 -1
@@ -30,7 +30,7 @@#include <asm/mtrr.h> #include <asm/pgtable.h> #include <asm/proto.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/cacheflush.h> #include <asm/swiotlb.h> #include <asm/dma.h>
arch/x86/kernel/pci-nommu_64.c +1 -1
@@ -7,7 +7,7 @@#include <linux/dma-mapping.h> #include <linux/scatterlist.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/processor.h> #include <asm/dma.h>
arch/x86/kernel/pci-swiotlb_64.c +1 -1
@@ -5,7 +5,7 @@#include <linux/module.h> #include <linux/dma-mapping.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include <asm/swiotlb.h> #include <asm/dma.h>
arch/x86/kernel/reboot_64.c +1 -1
@@ -17,7 +17,7 @@#include <asm/pgtable.h> #include <asm/tlbflush.h> #include <asm/apic.h> -#include <asm/iommu.h> +#include <asm/gart.h> /* * Power off function, if any
arch/x86_64/Kconfig +1 -1
@@ -480,7 +480,7 @@ config HPET_EMULATE_RTC # Mark as embedded because too many people got it wrong. # The code disables itself when not needed. config IOMMU - bool "IOMMU support" if EMBEDDED + bool "GART IOMMU support" if EMBEDDED default y select SWIOTLB select AGP
drivers/pci/intel-iommu.c +1 -1
@@ -34,7 +34,7 @@#include "intel-iommu.h" #include <asm/proto.h> /* force_iommu in this header in x86-64*/ #include <asm/cacheflush.h> -#include <asm/iommu.h> +#include <asm/gart.h> #include "pci.h" #define IS_GFX_DEVICE (pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
include/asm-x86/gart.h renamed from include/asm-x86/iommu.h +2 -2
@@ -1,5 +1,5 @@ -#ifndef _ASM_X8664_IOMMU_H -#define _ASM_X8664_IOMMU_H 1 +#ifndef _ASM_X8664_GART_H +#define _ASM_X8664_GART_H 1extern void pci_iommu_shutdown (void );extern void no_iommu_init (void );
Signature · 1 line
1.5.2.5
PATCH 2/4 x86 gart: rename CONFIG_IOMMU to CONFIG_GART_IOMMU
In reply to Joerg RoedelThis patch renames the IOMMU config option to GART_IOMMU because in fact it means the GART and not general support for an IOMMU on x86.
--- arch/x86/kernel/Makefile_64 | 2 +- arch/x86/kernel/early-quirks.c | 4 ++-- arch/x86/kernel/pci-dma_64.c | 6 +++--- arch/x86_64/Kconfig | 4 ++-- arch/x86_64/Kconfig.debug | 2 +- arch/x86_64/defconfig | 2 +- drivers/char/agp/Kconfig | 4 ++-- drivers/char/agp/amd64-agp.c | 2 +- drivers/usb/core/message.c | 2 +- include/asm-x86/gart.h | 2 +- include/asm-x86/pci_64.h | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-)
arch/x86/kernel/Makefile_64 +1 -1
@@ -25,7 +25,7 @@ obj-$(CONFIG_CRASH_DUMP) += crash_dump_64.o obj-$(CONFIG_PM) += suspend_64.o obj-$(CONFIG_HIBERNATION) += suspend_asm_64.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -obj-$(CONFIG_IOMMU) += pci-gart_64.o aperture_64.o +obj-$(CONFIG_GART_IOMMU) += pci-gart_64.o aperture_64.o obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary_64.o tce_64.o obj-$(CONFIG_SWIOTLB) += pci-swiotlb_64.o obj-$(CONFIG_KPROBES) += kprobes_64.o
arch/x86/kernel/early-quirks.c +2 -2
@@ -17,13 +17,13 @@#include <asm/io_apic.h> #include <asm/apic.h> -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU #include <asm/gart.h> #endif static void __init via_bugs (void ) { -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU if ((end_pfn >MAX_DMA32_PFN || force_iommu) && !iommu_aperture_allowed) { printk(KERN_INFO
arch/x86/kernel/pci-dma_64.c +3 -3
@@ -275,7 +275,7 @@ __init int iommu_setup(char *p) swiotlb =1 ;#endif -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU gart_parse_options (p);#endif
@@ -298,7 +298,7 @@ void __init pci_iommu_alloc(void)* The order of these functions is important for * fall-back/fail-over reasons */ -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU iommu_hole_init ();#endif
@@ -321,7 +321,7 @@ static int __init pci_iommu_init(void)intel_iommu_init (); -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU gart_iommu_init ();#endif
arch/x86_64/Kconfig +2 -2
@@ -479,7 +479,7 @@ config HPET_EMULATE_RTC # Mark as embedded because too many people got it wrong. # The code disables itself when not needed. -config IOMMU +config GART_IOMMU bool "GART IOMMU support" if EMBEDDED default y select SWIOTLB
@@ -687,7 +687,7 @@ source kernel/Kconfig.hz config K8_NB def_bool y - depends on AGP_AMD64 || IOMMU || (PCI && NUMA) + depends on AGP_AMD64 || GART_IOMMU || (PCI && NUMA) endmenu
arch/x86_64/Kconfig.debug +1 -1
@@ -17,7 +17,7 @@ config DEBUG_RODATA If in doubt, say "N". config IOMMU_DEBUG - depends on IOMMU && DEBUG_KERNEL + depends on GART_IOMMU && DEBUG_KERNEL bool "Enable IOMMU debugging" help Force the IOMMU to on even when you have less than 4GB of
arch/x86_64/defconfig +1 -1
@@ -170,7 +170,7 @@ CONFIG_HOTPLUG_CPU=y CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y CONFIG_HPET_TIMER=y CONFIG_HPET_EMULATE_RTC=y -CONFIG_IOMMU=y +CONFIG_GART_IOMMU=y # CONFIG_CALGARY_IOMMU is not set CONFIG_SWIOTLB=y CONFIG_X86_MCE=y
drivers/char/agp/Kconfig +2 -2
@@ -56,9 +56,9 @@ config AGP_AMD X on AMD Irongate, 761, and 762 chipsets. config AGP_AMD64 - tristate "AMD Opteron/Athlon64 on-CPU GART support" if !IOMMU + tristate "AMD Opteron/Athlon64 on-CPU GART support" if !GART_IOMMU depends on AGP && X86 - default y if IOMMU + default y if GART_IOMMU help This option gives you AGP support for the GLX component of X using the on-CPU northbridge of the AMD Athlon64/Opteron CPUs.
drivers/char/agp/amd64-agp.c +1 -1
@@ -787,7 +787,7 @@ static void __exit agp_amd64_cleanup(void)/* On AMD64 the PCI driver needs to initialize this driver early for the IOMMU, so it has to be called via a backdoor. */ -#ifndef CONFIG_IOMMU +#ifndef CONFIG_GART_IOMMU module_init (agp_amd64_init);module_exit (agp_amd64_cleanup);#endif
drivers/usb/core/message.c +1 -1
@@ -434,7 +434,7 @@ int usb_sg_init (if (dma) { io->urbs [i]->transfer_dma =sg_dma_address (sg + i); len =sg_dma_len (sg + i); -#if defined(CONFIG_HIGHMEM ) || defined(CONFIG_IOMMU ) +#if defined(CONFIG_HIGHMEM ) || defined(CONFIG_GART_IOMMU ) io->urbs[i]->transfer_buffer =NULL ;#else io->urbs[i]->transfer_buffer =sg_virt (&sg[i]);
include/asm-x86/gart.h +1 -1
@@ -5,7 +5,7 @@ extern void pci_iommu_shutdown(void);extern void no_iommu_init (void );extern int force_iommu, no_iommu;extern int iommu_detected; -#ifdef CONFIG_IOMMU +#ifdef CONFIG_GART_IOMMU extern void gart_iommu_init (void );extern void gart_iommu_shutdown (void );extern void __init gart_parse_options (char *);
include/asm-x86/pci_64.h +1 -1
@@ -37,7 +37,7 @@ extern int iommu_setup(char *opt);*/ #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys) -#if defined(CONFIG_IOMMU ) || defined(CONFIG_CALGARY_IOMMU ) +#if defined(CONFIG_GART_IOMMU ) || defined(CONFIG_CALGARY_IOMMU )#define DECLARE_PCI_UNMAP_ADDR (ADDR_NAME ) \ dma_addr_t ADDR_NAME;
Signature · 1 line
1.5.2.5
PATCH 3/4 x86 gart: make some variables and functions static
In reply to Joerg RoedelThis patch makes some functions and variables static in pci-gart_64.c which are not used somewhere else.
--- arch/x86/kernel/pci-gart_64.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/pci-gart_64.c +4 -4
@@ -36,11 +36,11 @@#include <asm/dma.h> #include <asm/k8.h> -unsigned long iommu_bus_base;/* GART remapping area (physical) */ +static unsigned long iommu_bus_base;/* GART remapping area (physical) */ static unsigned long iommu_size;/* size of remapping area bytes */ static unsigned long iommu_pages;/* .. and in pages */ -u32 *iommu_gatt_base;/* Remapping table */ +static u32 *iommu_gatt_base;/* Remapping table */ /* If this is disabled the IOMMU will use an optimized flushing strategy of only flushing when an mapping is reused. With it true the GART is flushed
@@ -135,8 +135,8 @@ static void flush_gart(void)/* Debugging aid for drivers that don't free their IOMMU tables */ static void **iommu_leak_tab;static int leak_trace; -int iommu_leak_pages =20 ; -void dump_leak (void ) +static int iommu_leak_pages =20 ; +static void dump_leak (void ) {int i;static int dump;
Signature · 1 line
1.5.2.5
cover x86: some GART cleanups
In reply to Joerg RoedelPATCH 4/4 x86 gart: rename symbols only used for the GART implementation
In reply to Joerg RoedelThis patch renames the 4 symbols iommu_hole_init(), iommu_aperture, iommu_aperture_allowed, iommu_aperture_disabled. All these symbols are only used for the GART implementation of IOMMUs.
It adds and additional gart_ prefix to them.
--- arch/x86/kernel/aperture_64.c | 13 +++++++------ arch/x86/kernel/early-quirks.c | 4 ++-- arch/x86/kernel/pci-dma_64.c | 2 +- arch/x86/kernel/pci-gart_64.c | 8 ++++---- include/asm-x86/gart.h | 12 ++++++------ 5 files changed, 20 insertions(+), 19 deletions(-)
arch/x86/kernel/aperture_64.c +7 -6
@@ -25,9 +25,9 @@#include <asm/dma.h> #include <asm/k8.h> -int iommu_aperture; -int iommu_aperture_disabled__initdata =0 ; -int iommu_aperture_allowed__initdata =0 ; +int gart_iommu_aperture; +int gart_iommu_aperture_disabled__initdata =0 ; +int gart_iommu_aperture_allowed__initdata =0 ;int fallback_aper_order__initdata =1 ;/* 64MB */ int fallback_aper_force__initdata =0 ;
@@ -204,14 +204,15 @@ static __u32 __init search_agp_bridge(u32 *order, int *valid_agp)return 0 ; } -void __init iommu_hole_init (void ) +void __init gart_iommu_hole_init (void ) {int fix, num;u32 aper_size, aper_alloc =0 , aper_order =0 , last_aper_order =0 ;u64 aper_base, last_aper_base =0 ;int valid_agp =0 ; -if (iommu_aperture_disabled || !fix_aperture || !early_pci_allowed ()) +if (gart_iommu_aperture_disabled || !fix_aperture || + !early_pci_allowed ())return ;printk (KERN_INFO "Checking aperture...\n" );
@@ -222,7 +223,7 @@ void __init iommu_hole_init(void)continue ; iommu_detected =1 ; - iommu_aperture =1 ; + gart_iommu_aperture =1 ; aper_order = (read_pci_config (0 , num,3 ,0x90 ) >>1 ) &7 ; aper_size = (32 *1024 *1024 ) << aper_order;
arch/x86/kernel/early-quirks.c +2 -2
@@ -25,11 +25,11 @@ static void __init via_bugs(void) {#ifdef CONFIG_GART_IOMMU if ((end_pfn >MAX_DMA32_PFN || force_iommu) && - !iommu_aperture_allowed) { + !gart_iommu_aperture_allowed) {printk (KERN_INFO "Looks like a VIA chipset. Disabling IOMMU." " Override with iommu=allowed\n" ); - iommu_aperture_disabled =1 ; + gart_iommu_aperture_disabled =1 ; }#endif }
arch/x86/kernel/pci-dma_64.c +1 -1
@@ -299,7 +299,7 @@ void __init pci_iommu_alloc(void)* fall-back/fail-over reasons */ #ifdef CONFIG_GART_IOMMU -iommu_hole_init (); +gart_iommu_hole_init ();#endif #ifdef CONFIG_CALGARY_IOMMU
arch/x86/kernel/pci-gart_64.c +4 -4
@@ -628,12 +628,12 @@ void __init gart_iommu_init(void)return ;/* Did we detect a different HW IOMMU? */ -if (iommu_detected && !iommu_aperture) +if (iommu_detected && !gart_iommu_aperture)return ;if (no_iommu || (!force_iommu && end_pfn <=MAX_DMA32_PFN ) || - !iommu_aperture || + !gart_iommu_aperture || (no_agp &&init_k8_gatt (&info) <0 )) {if (end_pfn >MAX_DMA32_PFN ) { printk(KERN_ERR "WARNING more than 4GB of memory "
@@ -734,9 +734,9 @@ void __init gart_parse_options(char *p) fix_aperture =0 ;/* duplicated from pci-dma.c */ if (!strncmp (p,"force" ,5 )) - iommu_aperture_allowed =1 ; + gart_iommu_aperture_allowed =1 ;if (!strncmp (p,"allowed" ,7 )) - iommu_aperture_allowed =1 ; + gart_iommu_aperture_allowed =1 ;if (!strncmp (p,"memaper" ,7 )) { fallback_aper_force =1 ; p +=7 ;
include/asm-x86/gart.h +6 -6
@@ -9,16 +9,16 @@ extern int iommu_detected;extern void gart_iommu_init (void );extern void gart_iommu_shutdown (void );extern void __init gart_parse_options (char *); -extern void iommu_hole_init (void ); +extern void gart_iommu_hole_init (void );extern int fallback_aper_order;extern int fallback_aper_force; -extern int iommu_aperture; -extern int iommu_aperture_allowed; -extern int iommu_aperture_disabled; +extern int gart_iommu_aperture; +extern int gart_iommu_aperture_allowed; +extern int gart_iommu_aperture_disabled;extern int fix_aperture;#else -#define iommu_aperture 0 -#define iommu_aperture_allowed 0 +#define gart_iommu_aperture 0 +#define gart_iommu_aperture_allowed 0static inline void gart_iommu_shutdown (void ) {
Signature · 1 line
1.5.2.5