core/iommu changes for v3.2
Subsystems (5)
Linus,
Please pull the latest core-iommu-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git core-iommu-for-linus
Thanks,
Ingo
------------------>
Suresh Siddha (11):
x86, x2apic: Enable the bios request for x2apic optout
intr_remap: Call dmar_dev_scope_init() explicitly
iommu: Move IOMMU specific code to intel-iommu.c
iommu: No need to set dmar_disabled in check_zero_address()
iommu: Cleanup ifdefs in detect_intel_iommu()
x86, msi, intr-remap: Use the ioapic set affinity routine x86, ioapic: Define irq_remap_modify_chip_defaults()
iommu: Rename the DMAR and INTR_REMAP config options x86, kdump, ioapic: Reset remote-IRR in clear_IO_APIC x86, ioapic: Restore the mask bit correctly in eoi_ioapic_irq() x86, ioapic: Consolidate the explicit EOI code
Documentation/kernel-parameters.txt | 3 +- arch/ia64/configs/generic_defconfig | 2 +- arch/ia64/dig/Makefile | 2 +- arch/ia64/include/asm/device.h | 2 +- arch/ia64/include/asm/iommu.h | 6 +- arch/ia64/include/asm/pci.h | 2 +- arch/ia64/kernel/Makefile | 2 +- arch/ia64/kernel/acpi.c | 4 +- arch/ia64/kernel/msi_ia64.c | 4 +- arch/ia64/kernel/pci-dma.c | 2 +- arch/x86/Kconfig | 6 +- arch/x86/configs/x86_64_defconfig | 4 +- arch/x86/include/asm/device.h | 2 +- arch/x86/include/asm/hw_irq.h | 2 +- arch/x86/include/asm/irq_remapping.h | 6 +- arch/x86/kernel/apic/apic.c | 33 ++-- arch/x86/kernel/apic/io_apic.c | 284 ++++++++++++++++----------------- drivers/char/agp/intel-gtt.c | 4 +- drivers/iommu/Kconfig | 25 ++-- drivers/iommu/Makefile | 5 +- drivers/iommu/dmar.c | 198 +++--------------------- drivers/iommu/intel-iommu.c | 167 +++++++++++++++++++-- drivers/iommu/intr_remapping.c | 53 ++++++- drivers/pci/quirks.c | 2 +- include/linux/dma_remapping.h | 10 +- include/linux/dmar.h | 43 ++++- include/linux/intel-iommu.h | 6 +- 27 files changed, 474 insertions(+), 405 deletions(-)
Documentation/kernel-parameters.txt +2 -1
@@ -1014,10 +1014,11 @@ bytes respectively. Such letter suffixes can also be entirely omitted. has the capability. With this option, super page will not be supported. intremap= [X86-64, Intel-IOMMU] - Format: { on (default) | off | nosid } on enable Interrupt Remapping (default) off disable Interrupt Remapping nosid disable Source ID checking + no_x2apic_optout + BIOS x2APIC opt-out request will be ignored inttest= [IA-64]
arch/ia64/configs/generic_defconfig +1 -1
@@ -234,4 +234,4 @@ CONFIG_CRYPTO_MD5=y # CONFIG_CRYPTO_ANSI_CPRNG is not set CONFIG_CRC_T10DIF=y CONFIG_MISC_DEVICES=y -CONFIG_DMAR=y +CONFIG_INTEL_IOMMU=y
arch/ia64/dig/Makefile +1 -1
@@ -6,7 +6,7 @@ # obj-y := setup.o -ifeq ($(CONFIG_DMAR), y) +ifeq ($(CONFIG_INTEL_IOMMU), y) obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o else obj-$(CONFIG_IA64_GENERIC) += machvec.o
arch/ia64/include/asm/device.h +1 -1
@@ -10,7 +10,7 @@ struct dev_archdata {#ifdef CONFIG_ACPI void *acpi_handle;#endif -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU void *iommu;/* hook for IOMMU specific extension */ #endif };
arch/ia64/include/asm/iommu.h +4 -2
@@ -7,12 +7,14 @@extern void pci_iommu_shutdown (void );extern void no_iommu_init (void ); +#ifdef CONFIG_INTEL_IOMMU extern int force_iommu, no_iommu; -extern int iommu_detected; -#ifdef CONFIG_DMAR extern int iommu_pass_through; +extern int iommu_detected;#else #define iommu_pass_through (0) +#define no_iommu (1) +#define iommu_detected (0)#endif extern void iommu_dma_init (void );extern void machvec_init (const char *name);
arch/ia64/include/asm/pci.h +1 -1
@@ -139,7 +139,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); } -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU extern void pci_iommu_alloc (void );#endif #endif /* _ASM_IA64_PCI_H */
arch/ia64/kernel/Makefile +1 -1
@@ -43,7 +43,7 @@ obj-$(CONFIG_IA64_ESI) += esi.o ifneq ($(CONFIG_IA64_ESI),) obj-y += esi_stub.o # must be in kernel proper endif -obj-$(CONFIG_DMAR) += pci-dma.o +obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o obj-$(CONFIG_BINFMT_ELF) += elfcore.o
arch/ia64/kernel/acpi.c +2 -2
@@ -88,7 +88,7 @@ acpi_get_sysname(void)struct acpi_table_rsdp *rsdp;struct acpi_table_xsdt *xsdt;struct acpi_table_header *hdr; -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU u64 i, nentries;#endif
@@ -125,7 +125,7 @@ acpi_get_sysname(void)return "xen" ; } -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU /* Look for Intel IOMMU */ nentries = (hdr->length -sizeof (*hdr)) /sizeof (xsdt->table_offset_entry[0 ]);
arch/ia64/kernel/msi_ia64.c +2 -2
@@ -131,7 +131,7 @@ void arch_teardown_msi_irq(unsigned int irq)return ia64_teardown_msi_irq (irq); } -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU #ifdef CONFIG_SMP static int dmar_msi_set_affinity (struct irq_data *data,const struct cpumask *mask,bool force)
@@ -210,5 +210,5 @@ int arch_setup_dmar_msi(unsigned int irq) "edge"); return 0; } -#endif /* CONFIG_DMAR */ +#endif /* CONFIG_INTEL_IOMMU */
arch/ia64/kernel/pci-dma.c +1 -1
@@ -14,7 +14,7 @@#include <asm/system.h> -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU #include <linux/kernel.h>
arch/x86/Kconfig +3 -3
@@ -130,7 +130,7 @@ config SBUS bool config NEED_DMA_MAP_STATE - def_bool (X86_64 || DMAR || DMA_API_DEBUG) + def_bool (X86_64 || INTEL_IOMMU || DMA_API_DEBUG) config NEED_SG_DMA_LENGTH def_bool y
@@ -220,7 +220,7 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC config HAVE_INTEL_TXT def_bool y - depends on EXPERIMENTAL && DMAR && ACPI + depends on EXPERIMENTAL && INTEL_IOMMU && ACPI config X86_32_SMP def_bool y
@@ -287,7 +287,7 @@ config SMP config X86_X2APIC bool "Support x2apic" - depends on X86_LOCAL_APIC && X86_64 && INTR_REMAP + depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP ---help--- This enables x2apic support on CPUs that have this feature.
arch/x86/configs/x86_64_defconfig +2 -2
@@ -67,8 +67,8 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_ONDEMAND=y CONFIG_X86_ACPI_CPUFREQ=y CONFIG_PCI_MMCONFIG=y -CONFIG_DMAR=y -# CONFIG_DMAR_DEFAULT_ON is not set +CONFIG_INTEL_IOMMU=y +# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set CONFIG_PCIEPORTBUS=y CONFIG_PCCARD=y CONFIG_YENTA=y
arch/x86/include/asm/device.h +1 -1
@@ -8,7 +8,7 @@ struct dev_archdata {#ifdef CONFIG_X86_64 struct dma_map_ops *dma_ops;#endif -#if defined(CONFIG_DMAR ) || defined(CONFIG_AMD_IOMMU ) +#if defined(CONFIG_INTEL_IOMMU ) || defined(CONFIG_AMD_IOMMU )void *iommu;/* hook for IOMMU specific extension */ #endif };
arch/x86/include/asm/hw_irq.h +1 -1
@@ -119,7 +119,7 @@ struct irq_cfg {cpumask_var_t old_domain;u8 vector; u8 move_in_progress : 1; -#ifdef CONFIG_INTR_REMAP +#ifdef CONFIG_IRQ_REMAP struct irq_2_iommu irq_2_iommu;#endif };
arch/x86/include/asm/irq_remapping.h +5 -1
@@ -3,7 +3,8 @@#define IRTE_DEST (dest) ((x2apic_mode) ? dest : dest << 8) -#ifdef CONFIG_INTR_REMAP +#ifdef CONFIG_IRQ_REMAP +static void irq_remap_modify_chip_defaults (struct irq_chip *chip);static inline void prepare_irte (struct irte *irte,int vector,unsigned int dest) {
@@ -36,6 +37,9 @@ static inline bool irq_remapped(struct irq_cfg *cfg) {return false; } +static inline void irq_remap_modify_chip_defaults (struct irq_chip *chip) +{ +}#endif #endif /* _ASM_X86_IRQ_REMAPPING_H */
arch/x86/kernel/apic/apic.c +16 -17
@@ -1437,27 +1437,21 @@ void enable_x2apic(void)int __init enable_IR (void ) { -#ifdef CONFIG_INTR_REMAP +#ifdef CONFIG_IRQ_REMAP if (!intr_remapping_supported ()) {pr_debug ("intr-remapping not supported\n" ); -return 0 ; +return -1 ; }if (!x2apic_preenabled && skip_ioapic_setup) {pr_info ("Skipped enabling intr-remap because of skipping " "io-apic setup\n" ); -return 0 ; +return -1 ; } -if (enable_intr_remapping (x2apic_supported ())) -return 0 ; - -pr_info ("Enabled Interrupt-remapping\n" ); - -return 1 ; - +return enable_intr_remapping ();#endif -return 0 ; +return -1 ; }void __init enable_IR_x2apic (void )
@@ -1481,11 +1475,11 @@ void __init enable_IR_x2apic(void)mask_ioapic_entries ();if (dmar_table_init_ret) - ret =0 ; + ret =-1 ;else ret =enable_IR (); -if (!ret) { +if (ret <0 ) {/* IR is required if there is APIC ID > 255 even when running * under KVM */
@@ -1499,6 +1493,9 @@ void __init enable_IR_x2apic(void)x2apic_force_phys (); } +if (ret ==IRQ_REMAP_XAPIC_MODE ) + goto nox2apic; + x2apic_enabled =1 ;if (x2apic_supported () && !x2apic_mode) {
@@ -1508,19 +1505,21 @@ void __init enable_IR_x2apic(void) } nox2apic: -if (!ret)/* IR enabling failed */ +if (ret <0 )/* IR enabling failed */ restore_ioapic_entries (); legacy_pic->restore_mask ();local_irq_restore (flags); out: -if (x2apic_enabled) +if (x2apic_enabled || !x2apic_supported ())return ;if (x2apic_preenabled)panic ("x2apic: enabled by BIOS but kernel init failed." ); -else if (cpu_has_x2apic) -pr_info ("Not enabling x2apic, Intr-remapping init failed.\n" ); +else if (ret ==IRQ_REMAP_XAPIC_MODE ) +pr_info ("x2apic not enabled, IRQ remapping is in xapic mode\n" ); +else if (ret <0 ) +pr_info ("x2apic not enabled, IRQ remapping init failed\n" ); }#ifdef CONFIG_X86_64
arch/x86/kernel/apic/io_apic.c +138 -146
409 lines not on this page · raw message
drivers/char/agp/intel-gtt.c +2 -2
@@ -30,10 +30,10 @@/* * If we have Intel graphics, we're not going to have anything other than * an Intel IOMMU. So make the correct use of the PCI DMA API contingent -* on the Intel IOMMU support (CONFIG_DMAR). +* on the Intel IOMMU support (CONFIG_INTEL_IOMMU). * Only newer chipsets need to bother with this, of course. */ -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU #define USE_PCI_DMA_API 1#else #define USE_PCI_DMA_API 0
drivers/iommu/Kconfig +15 -10
@@ -59,10 +59,14 @@ config AMD_IOMMU_STATS If unsure, say N. # Intel IOMMU support -config DMAR - bool "Support for DMA Remapping Devices" +config DMAR_TABLE + bool + +config INTEL_IOMMU + bool "Support for Intel IOMMU using DMA Remapping Devices" depends on PCI_MSI && ACPI && (X86 || IA64_GENERIC) select IOMMU_API + select DMAR_TABLE help DMA remapping (DMAR) devices support enables independent address translations for Direct Memory Access (DMA) from devices.
@@ -70,18 +74,18 @@ config DMAR and include PCI device scope covered by these DMA remapping devices. -config DMAR_DEFAULT_ON +config INTEL_IOMMU_DEFAULT_ON def_bool y - prompt "Enable DMA Remapping Devices by default" - depends on DMAR + prompt "Enable Intel DMA Remapping Devices by default" + depends on INTEL_IOMMU help Selecting this option will enable a DMAR device at boot time if one is found. If this option is not selected, DMAR support can be enabled by passing intel_iommu=on to the kernel. -config DMAR_BROKEN_GFX_WA +config INTEL_IOMMU_BROKEN_GFX_WA bool "Workaround broken graphics drivers (going away soon)" - depends on DMAR && BROKEN && X86 + depends on INTEL_IOMMU && BROKEN && X86 ---help--- Current Graphics drivers tend to use physical address for DMA and avoid using DMA APIs. Setting this config
@@ -90,18 +94,19 @@ config DMAR_BROKEN_GFX_WA to use physical addresses for DMA, at least until this option is removed in the 2.6.32 kernel. -config DMAR_FLOPPY_WA +config INTEL_IOMMU_FLOPPY_WA def_bool y - depends on DMAR && X86 + depends on INTEL_IOMMU && X86 ---help--- Floppy disk drivers are known to bypass DMA API calls thereby failing to work when IOMMU is enabled. This workaround will setup a 1:1 mapping for the first 16MiB to make floppy (an ISA device) work. -config INTR_REMAP +config IRQ_REMAP bool "Support for Interrupt Remapping (EXPERIMENTAL)" depends on X86_64 && X86_IO_APIC && PCI_MSI && ACPI && EXPERIMENTAL + select DMAR_TABLE ---help--- Supports Interrupt remapping for IO-APIC and MSI devices. To use x2apic mode in the CPU's which support x2APIC enhancements or
drivers/iommu/Makefile +3 -2
@@ -1,5 +1,6 @@ obj-$(CONFIG_IOMMU_API) += iommu.o obj-$(CONFIG_MSM_IOMMU) += msm_iommu.o msm_iommu_dev.o obj-$(CONFIG_AMD_IOMMU) += amd_iommu.o amd_iommu_init.o -obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o -obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o +obj-$(CONFIG_DMAR_TABLE) += dmar.o +obj-$(CONFIG_INTEL_IOMMU) += iova.o intel-iommu.o +obj-$(CONFIG_IRQ_REMAP) += intr_remapping.o
drivers/iommu/dmar.c +24 -174
288 lines not on this page · raw message
drivers/iommu/intel-iommu.c +157 -10
217 lines not on this page · raw message
drivers/iommu/intr_remapping.c +45 -8
99 lines not on this page · raw message
drivers/pci/quirks.c +1 -1
@@ -2788,7 +2788,7 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_RICOH, PCI_DEVICE_ID_RICOH_R5CE823, ricoh_DECLARE_PCI_FIXUP_RESUME_EARLY (PCI_VENDOR_ID_RICOH ,PCI_DEVICE_ID_RICOH_R5CE823 , ricoh_mmc_fixup_r5c832);#endif /*CONFIG_MMC_RICOH_MMC*/ -#if defined(CONFIG_DMAR ) || defined(CONFIG_INTR_REMAP ) +#ifdef CONFIG_DMAR_TABLE #define VTUNCERRMSK_REG 0x1ac#define VTD_MSK_SPEC_ERRORS (1 << 31)/*
include/linux/dma_remapping.h +7 -3
@@ -25,11 +25,12 @@ struct intel_iommu;struct dmar_domain ;struct root_entry ; -extern void free_dmar_iommu (struct intel_iommu *iommu); -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU +extern void free_dmar_iommu (struct intel_iommu *iommu);extern int iommu_calculate_agaw (struct intel_iommu *iommu);extern int iommu_calculate_max_sagaw (struct intel_iommu *iommu); +extern int dmar_disabled;#else static inline int iommu_calculate_agaw (struct intel_iommu *iommu) {
@@ -39,8 +40,11 @@ static inline int iommu_calculate_max_sagaw(struct intel_iommu *iommu) {return 0 ; } +static inline void free_dmar_iommu (struct intel_iommu *iommu) +{ +} +#define dmar_disabled (1)#endif -extern int dmar_disabled;#endif
include/linux/dmar.h +35 -8
89 lines not on this page · raw message
include/linux/intel-iommu.h +3 -3
@@ -279,7 +279,7 @@ struct q_inval {int free_cnt; }; -#ifdef CONFIG_INTR_REMAP +#ifdef CONFIG_IRQ_REMAP /* 1MB - maximum possible interrupt remapping table size */ #define INTR_REMAP_PAGE_ORDER 8#define INTR_REMAP_TABLE_REG_SIZE 0xf
@@ -318,7 +318,7 @@ struct intel_iommu {unsigned int irq;unsigned char name[13 ];/* Device Name */ -#ifdef CONFIG_DMAR +#ifdef CONFIG_INTEL_IOMMU unsigned long *domain_ids;/* bitmap of domains */ struct dmar_domain **domains;/* ptr to domains */ spinlock_t lock;/* protect context, domain ids */
@@ -329,7 +329,7 @@ struct intel_iommu {struct q_inval *qi;/* Queued invalidation info */ u32 *iommu_state;/* Store iommu states between suspend and resume.*/ -#ifdef CONFIG_INTR_REMAP +#ifdef CONFIG_IRQ_REMAP struct ir_table *ir_table;/* Interrupt remapping info */ #endif int node;