Re: git: 65b133e5d292 - main - x86: allow to have more than one kind of IOMMU

From: Cy Schubert <Cy.Schubert_at_cschubert.com>
Date: Thu, 05 Sep 2024 02:06:02 UTC
Both machines still panic.

First machine panics on ohci(4) attach while the second at re(4) attach in
acpi_pci_get_dma_tag().

First machine:

Copyright (c) 1992-2024 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 15.0-CURRENT #61 komquats-n272062-79eba754bec3: Wed Sep  4 17:46:55 PDT 2024
    root@slippy:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
VT(vga): text 80x25
CPU: AMD Phenom(tm) II X4 945 Processor (3013.95-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
  SVM: NP,NRIP,NAsids=64
  TSC: P-state invariant
real memory  = 8589934592 (8192 MB)
avail memory = 8264794112 (7881 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <Nvidia ASUSACPI>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
random: unblocking device.
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aEventBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aControlBlock: 16/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/PmTimerBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 64/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe1Block: 128/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aEventBlock: 8, using default 32 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aControlBlock: 8, using default 16 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/PmTimerBlock: 8, using default 32 (20230628/tbfadt-850)
ioapic0: MADT APIC ID 4 != hw id 0
ioapic0 <Version 1.1> irqs 0-23
Launching APs: 1 2 3
random: entropy device external interface
kbd1 at kbdmux0
vtvga0: <VT VGA driver>
aesni0: No AES or SHA support.
acpi0: <Nvidia ASUSACPI>
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.CPU0 (20230628/dspkginit-605)
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfefff000-0xfefff3ff irq 0,8 on acpi0
Timecounter "HPET" frequency 25000000 Hz quality 950
atrtc0: <AT realtime clock> port 0x70-0x73 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1008-0x100b on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pci0: <memory, RAM> at device 0.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 1.0 on pci0
isa0: <ISA bus> on isab0
ohci0: <nVidia nForce MCP55 USB Controller> mem 0xfe02f000-0xfe02ffff irq 21 at device 2.0 on pci0


Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address   = 0x0
fault code              = supervisor read instruction, page not present
instruction pointer     = 0x20:0x0
stack pointer           = 0x28:0xffffffff81f2caa8
frame pointer           = 0x28:0xffffffff81f2cac0
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 0 (swapper)
rdi: fffff80005808500 rsi: 0000000000000000 rdx: ffffffff80e54eb8
rcx: ffffffff80e54eb8  r8: 0000001473a90040  r9: ffffffff810f5ce0
rax: 0000000000000000 rbx: fffff80005808500 rbp: ffffffff81f2cac0
r10: ffffffff81f2c9f0 r11: fffffffffffffff5 r12: fffffe00113fc320
r13: fffff800057ec0a0 r14: fffff80005808800 r15: fffff80005808800
trap number             = 12
panic: page fault
cpuid = 2
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff81f2c790
vpanic() at vpanic+0x13f/frame 0xffffffff81f2c8c0
panic() at panic+0x43/frame 0xffffffff81f2c920
trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f2c980
trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f2c9d0
calltrap() at calltrap+0x8/frame 0xffffffff81f2c9d0
--- trap 0xc, rip = 0, rsp = 0xffffffff81f2caa8, rbp = 0xffffffff81f2cac0 ---
??() at 0/frame 0xffffffff81f2cac0
acpi_pci_get_dma_tag() at acpi_pci_get_dma_tag+0x34/frame 0xffffffff81f2cae0
ohci_pci_attach() at ohci_pci_attach+0x4f/frame 0xffffffff81f2cb30
device_attach() at device_attach+0x3ac/frame 0xffffffff81f2cb80
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f2cbb0
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f2cbe0
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f2cc20
device_attach() at device_attach+0x3ac/frame 0xffffffff81f2cc70
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f2cca0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x424/frame 0xffffffff81f2cd00
device_attach() at device_attach+0x3ac/frame 0xffffffff81f2cd50
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f2cd80
acpi_probe_children() at acpi_probe_children+0x6f/frame 0xffffffff81f2cde0
acpi_attach() at acpi_attach+0x9dc/frame 0xffffffff81f2ce70
device_attach() at device_attach+0x3ac/frame 0xffffffff81f2cec0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f2cef0
device_attach() at device_attach+0x3ac/frame 0xffffffff81f2cf40
bus_generic_new_pass() at bus_generic_new_pass+0x127/frame 0xffffffff81f2cf70
root_bus_configure() at root_bus_configure+0x26/frame 0xffffffff81f2cf90
configure() at configure+0x9/frame 0xffffffff81f2cfa0
mi_startup() at mi_startup+0x1c8/frame 0xffffffff81f2cff0
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
--> Press a key on the console to reboot,
--> or switch off the system now.
acpi0: reset failed - timeout
Rebooting...
cpu_reset: Restarting BSP
cpu_reset_proxy: Stopped CPU 2


Second machine:

Copyright (c) 1992-2024 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
        The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 15.0-CURRENT #61 komquats-n272062-79eba754bec3: Wed Sep  4 17:46:55 PDT 2024
    root@slippy:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
VT(vga): text 80x25
CPU: AMD Processor model unknown (3000.02-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
  SVM: NP,NRIP,NAsids=64
  TSC: P-state invariant
real memory  = 8589934592 (8192 MB)
avail memory = 8145883136 (7768 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <ATI    ASUSACPI>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
random: unblocking device.
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aEventBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aControlBlock: 16/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/PmTimerBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 64/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aEventBlock: 8, using default 32 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aControlBlock: 8, using default 16 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/PmTimerBlock: 8, using default 32 (20230628/tbfadt-850)
ioapic0: MADT APIC ID 4 != hw id 0
ioapic0 <Version 2.1> irqs 0-23
Launching APs: 1 3 2
random: entropy device external interface
vtvga0: <VT VGA driver>
aesni0: No AES or SHA support.
acpi0: <ATI ASUSACPI>
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.CPU0 (20230628/dspkginit-605)
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 0,8 on acpi0
device_attach: hpet0 attach returned 12
atrtc0: <AT realtime clock> port 0x70-0x73 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xcc00-0xccff mem 0xf0000000-0xf7ffffff,0xfdbf0000-0xfdbfffff,0xfda00000-0xfdafffff irq 18 at device 5.0 on pci1
vgapci0: Boot video device
pcib2: <ACPI PCI-PCI bridge> at device 7.0 on pci0
pci2: <ACPI PCI bus> on pcib2
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xdc00-0xdcff mem 0xfdfff000-0xfdffffff irq 19 at device 0.0 on pci2
re0: Using 1 MSI message
re0: Chip rev. 0x38000000
re0: MAC rev. 0x00000000


Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address   = 0x0
fault code              = supervisor read instruction, page not present
instruction pointer     = 0x20:0x0
stack pointer           = 0x28:0xffffffff81f088c8
frame pointer           = 0x28:0xffffffff81f088e0
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 0 (swapper)
rdi: fffff800057d4d00 rsi: 0000000000000000 rdx: 000000000000004a
rcx: fffff80005704000  r8: 0000001670cdcfc6  r9: ffffffff810f5ce0
rax: 0000000000000000 rbx: fffff800057d4d00 rbp: ffffffff81f088e0
r10: ffffffff81f08860 r11: fffffffffffffff5 r12: 0000000038000000
r13: ffffffffffffffff r14: fffff800057d4e00 r15: 0000000000000100
trap number             = 12
panic: page fault
cpuid = 2
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff81f085b0
vpanic() at vpanic+0x13f/frame 0xffffffff81f086e0
panic() at panic+0x43/frame 0xffffffff81f08740
trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f087a0
trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f087f0
calltrap() at calltrap+0x8/frame 0xffffffff81f087f0
--- trap 0xc, rip = 0, rsp = 0xffffffff81f088c8, rbp = 0xffffffff81f088e0 ---
??() at 0/frame 0xffffffff81f088e0
acpi_pci_get_dma_tag() at acpi_pci_get_dma_tag+0x34/frame 0xffffffff81f08900
re_attach() at re_attach+0x100b/frame 0xffffffff81f08990
device_attach() at device_attach+0x3ac/frame 0xffffffff81f089e0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08a10
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f08a40
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f08a80
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08ad0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08b00
acpi_pcib_pci_attach() at acpi_pcib_pci_attach+0x95/frame 0xffffffff81f08b30
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08b80
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08bb0
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f08be0
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f08c20
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08c70
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08ca0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x424/frame 0xffffffff81f08d00
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08d50
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08d80
acpi_probe_children() at acpi_probe_children+0x6f/frame 0xffffffff81f08de0
acpi_attach() at acpi_attach+0x9dc/frame 0xffffffff81f08e70
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08ec0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f08ef0
device_attach() at device_attach+0x3ac/frame 0xffffffff81f08f40
bus_generic_new_pass() at bus_generic_new_pass+0x127/frame 0xffffffff81f08f70
root_bus_configure() at root_bus_configure+0x26/frame 0xffffffff81f08f90
configure() at configure+0x9/frame 0xffffffff81f08fa0
mi_startup() at mi_startup+0x1c8/frame 0xffffffff81f08ff0
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
--> Press a key on the console to reboot,
--> or switch off the system now.
Rebooting...
cpu_reset: Restarting BSP
cpu_reset_proxy: Stopped CPU 2


-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0


In message <ZtkKErhgQskvSrXT@kib.kiev.ua>, Konstantin Belousov writes:
> On Wed, Sep 04, 2024 at 06:06:00PM -0700, Cy Schubert wrote:
> > ??() at 0/frame 0xffffffff81f058e0
> > acpi_pci_get_dma_tag() at acpi_pci_get_dma_tag+0x34/frame 0xffffffff81f0590
> 0
>
> One more method is needed.  Updated patch is below.
>
> commit 99e3d96fc1a2b1d5cac5a635608ec3044ec4fa13
> Author: Konstantin Belousov <kib@FreeBSD.org>
> Date:   Thu Sep 5 03:33:34 2024 +0300
>
>     x86: always provide dummy x86_iommu virtual methods
>     
>     to make configurations where vendor-specific IOMMU not yet implemented
>     but IOMMU is enabled in config, work when calling into MSI/IOAPIC
>     interrupt remapping.
>     
>     Reported by:    cy
>     Sponsored by:   Advanced Micro Devices (AMD)
>     Sponsored by:   The FreeBSD Foundation
>     MFC after:      1 week
>
> diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c
> index 2c647fd21c67..2011c632f770 100644
> --- a/sys/x86/iommu/iommu_utils.c
> +++ b/sys/x86/iommu/iommu_utils.c
> @@ -190,12 +190,60 @@ SYSCTL_INT(_hw_iommu, OID_AUTO, batch_coalesce, CTLFLAG
> _RWTUN,
>      &iommu_qi_batch_coalesce, 0,
>      "Number of qi batches between interrupt");
>  
> -static struct x86_iommu *x86_iommu;
> +static struct iommu_unit *
> +x86_no_iommu_find(device_t dev, bool verbose)
> +{
> +	return (NULL);
> +}
> +
> +static int
> +x86_no_iommu_alloc_msi_intr(device_t src, u_int *cookies, u_int count)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_map_msi_intr(device_t src, u_int cpu, u_int vector,
> +    u_int cookie, uint64_t *addr, uint32_t *data)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_unmap_msi_intr(device_t src, u_int cookie)
> +{
> +	return (0);
> +}
> +
> +static int
> +x86_no_iommu_map_ioapic_intr(u_int ioapic_id, u_int cpu, u_int vector,
> +    bool edge, bool activehi, int irq, u_int *cookie, uint32_t *hi,
> +    uint32_t *lo)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_unmap_ioapic_intr(u_int ioapic_id, u_int *cookie)
> +{
> +	return (0);
> +}
> +
> +static struct x86_iommu x86_no_iommu = {
> +	.find = x86_no_iommu_find,
> +	.alloc_msi_intr = x86_no_iommu_alloc_msi_intr,
> +	.map_msi_intr = x86_no_iommu_map_msi_intr,
> +	.unmap_msi_intr = x86_no_iommu_unmap_msi_intr,
> +	.map_ioapic_intr = x86_no_iommu_map_ioapic_intr,
> +	.unmap_ioapic_intr = x86_no_iommu_unmap_ioapic_intr,
> +};
> +
> +static struct x86_iommu *x86_iommu = &x86_no_iommu;
>  
>  void
>  set_x86_iommu(struct x86_iommu *x)
>  {
> -	MPASS(x86_iommu == NULL);
> +	MPASS(x86_iommu == &x86_no_iommu);
>  	x86_iommu = x;
>  }
>