Skip to content

Commit

Permalink
Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/tip/tip

* 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, ioapic: Consolidate the explicit EOI code
  x86, ioapic: Restore the mask bit correctly in eoi_ioapic_irq()
  x86, kdump, ioapic: Reset remote-IRR in clear_IO_APIC
  iommu: Rename the DMAR and INTR_REMAP config options
  x86, ioapic: Define irq_remap_modify_chip_defaults()
  x86, msi, intr-remap: Use the ioapic set affinity routine
  iommu: Cleanup ifdefs in detect_intel_iommu()
  iommu: No need to set dmar_disabled in check_zero_address()
  iommu: Move IOMMU specific code to intel-iommu.c
  intr_remap: Call dmar_dev_scope_init() explicitly
  x86, x2apic: Enable the bios request for x2apic optout
  • Loading branch information
torvalds committed Oct 26, 2011
2 parents 37d96c2 + c020570 commit 9826530
Show file tree
Hide file tree
Showing 27 changed files with 474 additions and 405 deletions.
3 changes: 2 additions & 1 deletion Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1020,10 +1020,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]

Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/configs/generic_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion arch/ia64/dig/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
6 changes: 4 additions & 2 deletions arch/ia64/include/asm/iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion arch/ia64/include/asm/pci.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
2 changes: 1 addition & 1 deletion arch/ia64/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/kernel/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]);
Expand Down
4 changes: 2 additions & 2 deletions arch/ia64/kernel/msi_ia64.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -210,5 +210,5 @@ int arch_setup_dmar_msi(unsigned int irq)
"edge");
return 0;
}
#endif /* CONFIG_DMAR */
#endif /* CONFIG_INTEL_IOMMU */

2 changes: 1 addition & 1 deletion arch/ia64/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <asm/system.h>

#ifdef CONFIG_DMAR
#ifdef CONFIG_INTEL_IOMMU

#include <linux/kernel.h>

Expand Down
6 changes: 3 additions & 3 deletions arch/x86/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
4 changes: 2 additions & 2 deletions arch/x86/configs/x86_64_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/include/asm/hw_irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
Expand Down
6 changes: 5 additions & 1 deletion arch/x86/include/asm/irq_remapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 */
33 changes: 16 additions & 17 deletions arch/x86/kernel/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
*/
Expand All @@ -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) {
Expand All @@ -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
Expand Down
Loading

0 comments on commit 9826530

Please sign in to comment.