Index: head/sys/amd64/conf/GENERIC =================================================================== --- head/sys/amd64/conf/GENERIC +++ head/sys/amd64/conf/GENERIC @@ -102,6 +102,7 @@ options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default +options IOMMU # Kernel Sanitizers #options COVERAGE # Generic kernel coverage. Used by KCOV @@ -127,7 +128,6 @@ # Bus support. device acpi -options ACPI_DMAR device pci options PCI_HP # PCI-Express native HotPlug options PCI_IOV # PCI SR-IOV support Index: head/sys/amd64/conf/MINIMAL =================================================================== --- head/sys/amd64/conf/MINIMAL +++ head/sys/amd64/conf/MINIMAL @@ -93,6 +93,7 @@ options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default +options IOMMU # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -103,7 +104,6 @@ # Bus support. device acpi -options ACPI_DMAR device pci # atkbdc0 controls both the keyboard and the PS/2 mouse Index: head/sys/conf/files.x86 =================================================================== --- head/sys/conf/files.x86 +++ head/sys/conf/files.x86 @@ -165,8 +165,8 @@ dev/imcsmb/imcsmb_pci.c optional imcsmb pci dev/intel/spi.c optional intelspi dev/io/iodev.c optional io -dev/iommu/busdma_iommu.c optional acpi acpi_dmar pci -dev/iommu/iommu_gas.c optional acpi acpi_dmar pci +dev/iommu/busdma_iommu.c optional acpi iommu pci +dev/iommu/iommu_gas.c optional acpi iommu pci dev/ipmi/ipmi.c optional ipmi dev/ipmi/ipmi_acpi.c optional ipmi acpi dev/ipmi/ipmi_isa.c optional ipmi isa @@ -302,14 +302,14 @@ x86/cpufreq/hwpstate_intel.c optional cpufreq x86/cpufreq/p4tcc.c optional cpufreq x86/cpufreq/powernow.c optional cpufreq -x86/iommu/intel_ctx.c optional acpi acpi_dmar pci -x86/iommu/intel_drv.c optional acpi acpi_dmar pci -x86/iommu/intel_fault.c optional acpi acpi_dmar pci -x86/iommu/intel_idpgtbl.c optional acpi acpi_dmar pci -x86/iommu/intel_intrmap.c optional acpi acpi_dmar pci -x86/iommu/intel_qi.c optional acpi acpi_dmar pci -x86/iommu/intel_quirks.c optional acpi acpi_dmar pci -x86/iommu/intel_utils.c optional acpi acpi_dmar pci +x86/iommu/intel_ctx.c optional acpi iommu pci +x86/iommu/intel_drv.c optional acpi iommu pci +x86/iommu/intel_fault.c optional acpi iommu pci +x86/iommu/intel_idpgtbl.c optional acpi iommu pci +x86/iommu/intel_intrmap.c optional acpi iommu pci +x86/iommu/intel_qi.c optional acpi iommu pci +x86/iommu/intel_quirks.c optional acpi iommu pci +x86/iommu/intel_utils.c optional acpi iommu pci x86/isa/atrtc.c standard x86/isa/clock.c standard x86/isa/isa.c optional isa Index: head/sys/conf/options =================================================================== --- head/sys/conf/options +++ head/sys/conf/options @@ -704,8 +704,10 @@ ACPI_DEBUG opt_acpi.h ACPI_MAX_TASKS opt_acpi.h ACPI_MAX_THREADS opt_acpi.h -ACPI_DMAR opt_acpi.h DEV_ACPI opt_acpi.h + +# options for IOMMU support +IOMMU opt_iommu.h # ISA support DEV_ISA opt_isa.h Index: head/sys/dev/acpica/acpi_pci.c =================================================================== --- head/sys/dev/acpica/acpi_pci.c +++ head/sys/dev/acpica/acpi_pci.c @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_iommu.h" #include #include @@ -459,7 +460,7 @@ return (pci_detach(dev)); } -#ifdef ACPI_DMAR +#ifdef IOMMU static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus, device_t child) { Index: head/sys/dev/pci/pci.c =================================================================== --- head/sys/dev/pci/pci.c +++ head/sys/dev/pci/pci.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_iommu.h" #include "opt_bus.h" #include @@ -5683,7 +5684,7 @@ return (&dinfo->resources); } -#ifdef ACPI_DMAR +#ifdef IOMMU bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev) { Index: head/sys/i386/conf/MINIMAL =================================================================== --- head/sys/i386/conf/MINIMAL +++ head/sys/i386/conf/MINIMAL @@ -93,6 +93,7 @@ options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed options MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones options VERBOSE_SYSINIT=0 # Support debug.verbose_sysinit, off by default +options IOMMU # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -104,7 +105,6 @@ # Bus support. device acpi -options ACPI_DMAR device pci # atkbdc0 controls both the keyboard and the PS/2 mouse Index: head/sys/i386/conf/NOTES =================================================================== --- head/sys/i386/conf/NOTES +++ head/sys/i386/conf/NOTES @@ -439,6 +439,8 @@ device tdfx # Enable 3Dfx Voodoo support device tdfx_linux # Enable Linuxulator support +options IOMMU # Enable IOMMU support + # # ACPI support using the Intel ACPI Component Architecture reference # implementation. @@ -450,7 +452,6 @@ device acpi options ACPI_DEBUG -options ACPI_DMAR # ACPI WMI Mapping driver device acpi_wmi Index: head/sys/x86/x86/busdma_machdep.c =================================================================== --- head/sys/x86/x86/busdma_machdep.c +++ head/sys/x86/x86/busdma_machdep.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_iommu.h" #include #include @@ -268,7 +269,7 @@ return (tc->impl->tag_destroy(dmat)); } -#ifndef ACPI_DMAR +#ifndef IOMMU bool bus_dma_iommu_set_buswide(device_t dev); int bus_dma_iommu_load_ident(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t start, vm_size_t length, int flags); Index: head/sys/x86/x86/io_apic.c =================================================================== --- head/sys/x86/x86/io_apic.c +++ head/sys/x86/x86/io_apic.c @@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_iommu.h" #include "opt_isa.h" #include @@ -314,7 +315,7 @@ { struct ioapic *io = (struct ioapic *)intpin->io_intsrc.is_pic; uint32_t low, high; -#ifdef ACPI_DMAR +#ifdef IOMMU int error; #endif @@ -331,7 +332,7 @@ ioapic_write(io->io_addr, IOAPIC_REDTBL_LO(intpin->io_intpin), low | IOART_INTMSET); -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock_spin(&icu_lock); iommu_unmap_ioapic_intr(io->io_apic_id, &intpin->io_remap_cookie); @@ -340,7 +341,7 @@ return; } -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock_spin(&icu_lock); error = iommu_map_ioapic_intr(io->io_apic_id, intpin->io_cpu, intpin->io_vector, intpin->io_edgetrigger, @@ -712,7 +713,7 @@ intpin->io_cpu = PCPU_GET(apic_id); value = ioapic_read(apic, IOAPIC_REDTBL_LO(i)); ioapic_write(apic, IOAPIC_REDTBL_LO(i), value | IOART_INTMSET); -#ifdef ACPI_DMAR +#ifdef IOMMU /* dummy, but sets cookie */ mtx_unlock_spin(&icu_lock); iommu_map_ioapic_intr(io->io_apic_id, Index: head/sys/x86/x86/msi.c =================================================================== --- head/sys/x86/x86/msi.c +++ head/sys/x86/x86/msi.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "opt_acpi.h" +#include "opt_iommu.h" #include #include @@ -383,7 +384,7 @@ struct msi_intsrc *msi, *fsrc; u_int cpu, domain, *mirqs; int cnt, i, vector; -#ifdef ACPI_DMAR +#ifdef IOMMU u_int cookies[count]; int error; #endif @@ -449,7 +450,7 @@ return (ENOSPC); } -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock(&msi_lock); error = iommu_alloc_msi_intr(dev, cookies, count); mtx_lock(&msi_lock); @@ -531,7 +532,7 @@ msi = (struct msi_intsrc *)intr_lookup_source(irqs[i]); KASSERT(msi->msi_first == first, ("message not in group")); KASSERT(msi->msi_dev == first->msi_dev, ("owner mismatch")); -#ifdef ACPI_DMAR +#ifdef IOMMU iommu_unmap_msi_intr(first->msi_dev, msi->msi_remap_cookie); #endif msi->msi_first = NULL; @@ -541,7 +542,7 @@ } /* Clear out the first message. */ -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock(&msi_lock); iommu_unmap_msi_intr(first->msi_dev, first->msi_remap_cookie); mtx_lock(&msi_lock); @@ -564,7 +565,7 @@ { struct msi_intsrc *msi; int error; -#ifdef ACPI_DMAR +#ifdef IOMMU struct msi_intsrc *msi1; int i, k; #endif @@ -595,7 +596,7 @@ msi = msi->msi_first; } -#ifdef ACPI_DMAR +#ifdef IOMMU if (!msi->msi_msix) { for (k = msi->msi_count - 1, i = first_msi_irq; k > 0 && i < first_msi_irq + num_msi_irqs; i++) { @@ -633,7 +634,7 @@ struct msi_intsrc *msi; u_int cpu, domain; int i, vector; -#ifdef ACPI_DMAR +#ifdef IOMMU u_int cookie; int error; #endif @@ -684,7 +685,7 @@ } msi->msi_dev = dev; -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock(&msi_lock); error = iommu_alloc_msi_intr(dev, &cookie, 1); mtx_lock(&msi_lock); @@ -739,7 +740,7 @@ KASSERT(msi->msi_dev != NULL, ("unowned message")); /* Clear out the message. */ -#ifdef ACPI_DMAR +#ifdef IOMMU mtx_unlock(&msi_lock); iommu_unmap_msi_intr(msi->msi_dev, msi->msi_remap_cookie); mtx_lock(&msi_lock);