svn commit: r366267 - in head/sys: amd64/conf conf dev/acpica dev/pci i386/conf x86/x86

Ruslan Bukin br at FreeBSD.org
Tue Sep 29 20:29:10 UTC 2020


Author: br
Date: Tue Sep 29 20:29:07 2020
New Revision: 366267
URL: https://svnweb.freebsd.org/changeset/base/366267

Log:
  Rename kernel option ACPI_DMAR to IOMMU.
  This is mostly needed for a common arm64/amd64 iommu code.
  
  Reviewed by:	kib
  Sponsored by:	DARPA, AFRL
  Differential Revision:	https://reviews.freebsd.org/D26587

Modified:
  head/sys/amd64/conf/GENERIC
  head/sys/amd64/conf/MINIMAL
  head/sys/conf/files.x86
  head/sys/conf/options
  head/sys/dev/acpica/acpi_pci.c
  head/sys/dev/pci/pci.c
  head/sys/i386/conf/MINIMAL
  head/sys/i386/conf/NOTES
  head/sys/x86/x86/busdma_machdep.c
  head/sys/x86/x86/io_apic.c
  head/sys/x86/x86/msi.c

Modified: head/sys/amd64/conf/GENERIC
==============================================================================
--- head/sys/amd64/conf/GENERIC	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/amd64/conf/GENERIC	Tue Sep 29 20:29:07 2020	(r366267)
@@ -102,6 +102,7 @@ options 	WITNESS			# Enable checks to detect deadlocks
 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 @@ device		cpufreq
 
 # Bus support.
 device		acpi
-options 	ACPI_DMAR
 device		pci
 options 	PCI_HP			# PCI-Express native HotPlug
 options		PCI_IOV			# PCI SR-IOV support

Modified: head/sys/amd64/conf/MINIMAL
==============================================================================
--- head/sys/amd64/conf/MINIMAL	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/amd64/conf/MINIMAL	Tue Sep 29 20:29:07 2020	(r366267)
@@ -93,6 +93,7 @@ options 	WITNESS			# Enable checks to detect deadlocks
 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 @@ device		cpufreq
 
 # Bus support.
 device		acpi
-options 	ACPI_DMAR
 device		pci
 
 # atkbdc0 controls both the keyboard and the PS/2 mouse

Modified: head/sys/conf/files.x86
==============================================================================
--- head/sys/conf/files.x86	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/conf/files.x86	Tue Sep 29 20:29:07 2020	(r366267)
@@ -165,8 +165,8 @@ dev/imcsmb/imcsmb.c		optional	imcsmb
 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_amd.c	optional	cpufreq
 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

Modified: head/sys/conf/options
==============================================================================
--- head/sys/conf/options	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/conf/options	Tue Sep 29 20:29:07 2020	(r366267)
@@ -704,8 +704,10 @@ EPOCH_TRACE		opt_global.h
 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

Modified: head/sys/dev/acpica/acpi_pci.c
==============================================================================
--- head/sys/dev/acpica/acpi_pci.c	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/dev/acpica/acpi_pci.c	Tue Sep 29 20:29:07 2020	(r366267)
@@ -30,6 +30,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
+#include "opt_iommu.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -459,7 +460,7 @@ acpi_pci_detach(device_t dev)
 	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)
 {

Modified: head/sys/dev/pci/pci.c
==============================================================================
--- head/sys/dev/pci/pci.c	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/dev/pci/pci.c	Tue Sep 29 20:29:07 2020	(r366267)
@@ -32,6 +32,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
+#include "opt_iommu.h"
 #include "opt_bus.h"
 
 #include <sys/param.h>
@@ -5683,7 +5684,7 @@ pci_get_resource_list (device_t dev, device_t child)
 	return (&dinfo->resources);
 }
 
-#ifdef ACPI_DMAR
+#ifdef IOMMU
 bus_dma_tag_t
 pci_get_dma_tag(device_t bus, device_t dev)
 {

Modified: head/sys/i386/conf/MINIMAL
==============================================================================
--- head/sys/i386/conf/MINIMAL	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/i386/conf/MINIMAL	Tue Sep 29 20:29:07 2020	(r366267)
@@ -93,6 +93,7 @@ options 	WITNESS			# Enable checks to detect deadlocks
 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 @@ device		cpufreq
 
 # Bus support.
 device		acpi
-options 	ACPI_DMAR
 device		pci
 
 # atkbdc0 controls both the keyboard and the PS/2 mouse

Modified: head/sys/i386/conf/NOTES
==============================================================================
--- head/sys/i386/conf/NOTES	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/i386/conf/NOTES	Tue Sep 29 20:29:07 2020	(r366267)
@@ -439,6 +439,8 @@ device		s3pci
 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		tdfx_linux		# Enable Linuxulator support
 
 device		acpi
 options 	ACPI_DEBUG
-options 	ACPI_DMAR
 
 # ACPI WMI Mapping driver
 device		acpi_wmi

Modified: head/sys/x86/x86/busdma_machdep.c
==============================================================================
--- head/sys/x86/x86/busdma_machdep.c	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/x86/x86/busdma_machdep.c	Tue Sep 29 20:29:07 2020	(r366267)
@@ -34,6 +34,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
+#include "opt_iommu.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -268,7 +269,7 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
 	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);

Modified: head/sys/x86/x86/io_apic.c
==============================================================================
--- head/sys/x86/x86/io_apic.c	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/x86/x86/io_apic.c	Tue Sep 29 20:29:07 2020	(r366267)
@@ -29,6 +29,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
+#include "opt_iommu.h"
 #include "opt_isa.h"
 
 #include <sys/param.h>
@@ -314,7 +315,7 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
 {
 	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_program_intpin(struct ioapic_intsrc *intpin)
 			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 @@ ioapic_program_intpin(struct ioapic_intsrc *intpin)
 		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 @@ ioapic_create(vm_paddr_t addr, int32_t apic_id, int in
 		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,

Modified: head/sys/x86/x86/msi.c
==============================================================================
--- head/sys/x86/x86/msi.c	Tue Sep 29 18:13:54 2020	(r366266)
+++ head/sys/x86/x86/msi.c	Tue Sep 29 20:29:07 2020	(r366267)
@@ -40,6 +40,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_acpi.h"
+#include "opt_iommu.h"
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -383,7 +384,7 @@ msi_alloc(device_t dev, int count, int maxcount, int *
 	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 @@ again:
 		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_release(int *irqs, int count)
 		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 @@ msi_release(int *irqs, int count)
 	}
 
 	/* 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 @@ msi_map(int irq, uint64_t *addr, uint32_t *data)
 {
 	struct msi_intsrc *msi;
 	int error;
-#ifdef ACPI_DMAR
+#ifdef IOMMU
 	struct msi_intsrc *msi1;
 	int i, k;
 #endif
@@ -595,7 +596,7 @@ msi_map(int irq, uint64_t *addr, uint32_t *data)
 		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 @@ msix_alloc(device_t dev, int *irq)
 	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 @@ again:
 	}
 
 	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 @@ msix_release(int irq)
 	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);


More information about the svn-src-head mailing list