From: Thomas Kupper Subject: Re: aq: support detaching To: tech@openbsd.org Cc: jcs@jcs.org Date: Mon, 24 Aug 2026 11:48:54 +0200 On 24.08.2026 03:26, joshua stein wrote: > On Tue, 18 Aug 2026 at 10:04:12 -0500, joshua stein wrote: >> I bought an OWC 10gbit Thunderbolt adapter and it showed up as >> aq(4). I unplugged it and the kernel panicked with "config_detach: >> forced detach of aq0 failed (45)". This implements a detach routine >> that works for me. >> >> aq0 at pci5 dev 0 function 0 "Aquantia AQC107S" rev 0x02: msix, 4 queues, Atlantic B1, F/W version 3.0.33, address 00:30:93:17:07:dc > > anyone want to ok this? I bought the same adapter (OWC Thunderbolt 3 10G Ethernet Adapter) five years ago. Wanted to report that this patch does work for me, in regards to the aq-related kernel panic. aq0 at pci7 dev 0 function 0 "Aquantia AQC107S" rev 0x02: msix, Atlantic B1, F/W version 3.1.106, address 00:23:a4:xx:xx:xx Questions @joshua: attaching it after boot-up doesn't work for me, the device doesn't show up. Does it work for you? And if I detach the adapter while OpenBSD is running and attach it again (the same happens if I detach it again after that) I get another kernel panic (see attached screenshot), this time from the USB subsystem, the system is an Intel NUC8i7BEH. Do you encounter the same? dmesg entries when detaching the adapter: uhub1 detached usb1 detached xhci1: command ring abort timeout xhci1: reset timeout xhci1 detached pci8 detached ppb7 detached aq0 detached pci7 detached ppb6 detached pci6 detached ppb5 detached pci5 detached ppb4 detached pci4 detached ppb3 detached pci3 detached ppb2 detached dmesg entries when I re-attach the adapter: ppb2 at pci2 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02 pci3 at ppb2 bus 3 ppb3 at pci3 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci4 at ppb3 bus 4 "Intel JHL6340 Thunderbolt 3" rev 0x02 at pci4 dev 0 function 0 not configured ppb4 at pci3 dev 1 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci5 at ppb4 bus 12 ppb5 at pci3 dev 2 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci6 at ppb5 bus 16 xhci1 at pci6 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: can't map mem space The complete dmesg is attached. > > >> Index: sys/dev/pci/if_aq_pci.c >> =================================================================== >> RCS file: /cvs/src/sys/dev/pci/if_aq_pci.c,v >> diff -u -p -u -p -r1.37 if_aq_pci.c >> --- sys/dev/pci/if_aq_pci.c 24 Jul 2026 02:31:43 -0000 1.37 >> +++ sys/dev/pci/if_aq_pci.c 18 Aug 2026 14:46:41 -0000 >> @@ -1001,6 +1001,7 @@ struct aq_softc { >> void *sc_ih; >> bus_space_handle_t sc_ioh; >> bus_space_tag_t sc_iot; >> + bus_size_t sc_iosize; >> >> uint32_t sc_mbox_addr; >> int sc_rbl_enabled; >> @@ -1130,6 +1131,7 @@ const struct aq_product { >> >> int aq_match(struct device *, void *, void *); >> void aq_attach(struct device *, struct device *, void *); >> +int aq_detach(struct device *, int); >> int aq_activate(struct device *, int); >> int aq_intr(void *); >> int aq_intr_link(void *); >> @@ -1230,7 +1232,7 @@ const struct aq_firmware_ops aq2_fw_ops >> }; >> >> const struct cfattach aq_ca = { >> - sizeof(struct aq_softc), aq_match, aq_attach, NULL, >> + sizeof(struct aq_softc), aq_match, aq_attach, aq_detach, >> aq_activate >> }; >> >> @@ -1296,7 +1298,7 @@ aq_attach(struct device *parent, struct >> >> memtype = pci_mapreg_type(pc, tag, AQ_BAR0); >> if (pci_mapreg_map(pa, AQ_BAR0, memtype, 0, &sc->sc_iot, &sc->sc_ioh, >> - NULL, NULL, 0)) { >> + NULL, &sc->sc_iosize, 0)) { >> printf(": failed to map BAR0\n"); >> return; >> } >> @@ -1528,6 +1530,53 @@ aq_attach(struct device *parent, struct >> >> aq_enable_intr(sc, 1, 0); >> printf("\n"); >> +} >> + >> +int >> +aq_detach(struct device *self, int flags) >> +{ >> + struct aq_softc *sc = (struct aq_softc *)self; >> + struct ifnet *ifp = &sc->sc_arpcom.ac_if; >> + struct aq_queues *aq; >> + int i; >> + >> + if (ifp->if_flags & IFF_RUNNING) >> + aq_down(sc); >> + >> + aq_enable_intr(sc, 0, 0); >> + >> + for (i = 0; i < sc->sc_nqueues; i++) { >> + aq = &sc->sc_queues[i]; >> + >> + if (aq->q_ihc != NULL) { >> + pci_intr_disestablish(sc->sc_pc, aq->q_ihc); >> + aq->q_ihc = NULL; >> + } >> + timeout_del(&aq->q_rx.rx_refill); >> + } >> + >> + if (sc->sc_ih != NULL) { >> + pci_intr_disestablish(sc->sc_pc, sc->sc_ih); >> + sc->sc_ih = NULL; >> + } >> + >> + if (sc->sc_intrmap != NULL) { >> + intrmap_destroy(sc->sc_intrmap); >> + sc->sc_intrmap = NULL; >> + } >> + >> + if (ifp->if_softc != NULL) { >> + ifmedia_delete_instance(&sc->sc_media, IFM_INST_ANY); >> + ether_ifdetach(ifp); >> + if_detach(ifp); >> + } >> + >> + if (sc->sc_iosize != 0) { >> + bus_space_unmap(sc->sc_iot, sc->sc_ioh, sc->sc_iosize); >> + sc->sc_iosize = 0; >> + } >> + >> + return 0; >> } >> >> int >> > OpenBSD 8.0-beta (AQATTACH.MP) #0: Mon Aug 24 11:25:23 CEST 2026 root@nuc8i7-obsd79.hsh.no.lan:/sys/arch/amd64/compile/AQATTACH.MP real mem = 17014718464 (16226MB) avail mem = 16475357184 (15712MB) random: good seed from bootblocks mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 3.2 @ 0x7a9a1000 (76 entries) bios0: vendor Intel Corp. version "BECFL357.86A.0098.2026.0204.1428" date 02/04/2026 bios0: Intel(R) Client Systems NUC8i7BEH acpi0 at bios0: ACPI 6.1 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP APIC FPDT FIDT MCFG SSDT SSDT HPET SSDT SSDT UEFI LPIT WDAT SSDT SSDT DBGP DBG2 SSDT NHLT TPM2 DMAR WSMT acpi0: wakeup devices SIO1(S3) RP01(S4) PXSX(S4) RP02(S4) PXSX(S4) RP03(S4) PXSX(S4) RP04(S4) PXSX(S4) RP05(S4) PXSX(S4) RP06(S4) PXSX(S4) RP07(S4) PXSX(S4) RP08(S4) [...] acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2590.87 MHz, 06-8e-0a, patch 000000f6 cpu0: cpuid 1 edx=bfebfbff ecx=77fafbbf cpu0: cpuid 6 eax=27f7 ecx=9 cpu0: cpuid 7.0 ebx=29c67af edx=bc002e00 cpu0: cpuid a vers=4, gp=4, gpwidth=48, ff=3, ffwidth=48 cpu0: cpuid d.1 eax=f cpu0: cpuid 80000001 edx=2c100800 ecx=121 cpu0: cpuid 80000007 edx=100 cpu0: msr 10a=a000c04 cpu0: MELTDOWN cpu0: 32KB 64b/line 8-way D-cache, 32KB 64b/line 8-way I-cache, 256KB 64b/line 4-way L2 cache, 8MB 64b/line 16-way L3 cache cpu0: smt 0, core 0, package 0, type P mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges cpu0: apic clock running at 24MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.2.4.1.1.1, IBE cpu1 at mainbus0: apid 2 (application processor) cpu1: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2592.16 MHz, 06-8e-0a, patch 000000f6 cpu1: smt 0, core 1, package 0, type P cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.96 MHz, 06-8e-0a, patch 000000f6 cpu2: smt 0, core 2, package 0, type P cpu3 at mainbus0: apid 6 (application processor) cpu3: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.97 MHz, 06-8e-0a, patch 000000f6 cpu3: smt 0, core 3, package 0, type P cpu4 at mainbus0: apid 1 (application processor) cpu4: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.96 MHz, 06-8e-0a, patch 000000f6 cpu4: smt 1, core 0, package 0, type SP cpu5 at mainbus0: apid 3 (application processor) cpu5: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.96 MHz, 06-8e-0a, patch 000000f6 cpu5: smt 1, core 1, package 0, type SP cpu6 at mainbus0: apid 5 (application processor) cpu6: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.96 MHz, 06-8e-0a, patch 000000f6 cpu6: smt 1, core 2, package 0, type SP cpu7 at mainbus0: apid 7 (application processor) cpu7: Intel(R) Core(TM) i7-8559U CPU @ 2.70GHz, 2593.96 MHz, 06-8e-0a, patch 000000f6 cpu7: smt 1, core 3, package 0, type SP ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 120 pins acpimcfg0 at acpi0 acpimcfg0: addr 0xe0000000, bus 0-255 acpihpet0 at acpi0: 23999999 Hz acpiprt0 at acpi0: bus 0 (PCI0) acpiprt1 at acpi0: bus -1 (PEG0) acpiprt2 at acpi0: bus -1 (PEG1) acpiprt3 at acpi0: bus -1 (PEG2) acpiprt4 at acpi0: bus 1 (RP01) acpiprt5 at acpi0: bus -1 (RP02) acpiprt6 at acpi0: bus -1 (RP03) acpiprt7 at acpi0: bus -1 (RP04) acpiprt8 at acpi0: bus 2 (RP05) acpiprt9 at acpi0: bus -1 (RP06) acpiprt10 at acpi0: bus -1 (RP07) acpiprt11 at acpi0: bus -1 (RP08) acpiprt12 at acpi0: bus 109 (RP09) acpiprt13 at acpi0: bus -1 (RP10) acpiprt14 at acpi0: bus -1 (RP11) acpiprt15 at acpi0: bus -1 (RP12) acpiprt16 at acpi0: bus -1 (RP13) acpiprt17 at acpi0: bus -1 (RP14) acpiprt18 at acpi0: bus 110 (RP15) acpiprt19 at acpi0: bus -1 (RP16) acpiprt20 at acpi0: bus -1 (RP17) acpiprt21 at acpi0: bus -1 (RP18) acpiprt22 at acpi0: bus -1 (RP19) acpiprt23 at acpi0: bus -1 (RP20) acpiprt24 at acpi0: bus -1 (RP21) acpiprt25 at acpi0: bus -1 (RP22) acpiprt26 at acpi0: bus -1 (RP23) acpiprt27 at acpi0: bus -1 (RP24) acpiec0 at acpi0 acpipci0 at acpi0 PCI0: 0x00000000 0x00000011 0x00000001 pchgpio0 at acpi0 GPI0 addr 0xfd6e0000/0x10000 0xfd6d0000/0x10000 0xfd6a0000/0x10000 irq 14, 320 pins "ACPI000E" at acpi0 not configured "PNP0C14" at acpi0 not configured acpibtn0 at acpi0: SLPB "PNP0C14" at acpi0 not configured "PNP0C14" at acpi0 not configured intelpmc0 at acpi0: PEPD state 0: 0x7f:1:2:0x00:0x0000000000000060 counter: 0x7f:64:0:0x00:0x0000000000000632 frequency: 0 state 1: 0x7f:1:2:0x00:0x0000000000000060 counter: 0x00:32:0:0x03:0x00000000fe00193c frequency: 10000 acpibtn1 at acpi0: PWRB tpm0 at acpi0 TPM_ 2.0 (CRB) addr 0xfed40000/0x5000, device 0x00000000 rev 0x0 "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C0B" at acpi0 not configured "PNP0C14" at acpi0 not configured acpitz0 at acpi0 acpitz0: TZ0_: failed to read _HOT acpitz0: TZ0_: failed to read _TMP acpipwrres0 at acpi0: USBC, resource for XDCI acpipwrres1 at acpi0: V0PR acpipwrres2 at acpi0: V1PR acpipwrres3 at acpi0: V2PR acpipwrres4 at acpi0: WRST acpicpu0 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu1 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu2 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu3 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu4 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu5 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu6 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpicpu7 at acpi0: C3(200@1034 mwait.1@0x60), C2(200@151 mwait.1@0x33), C1(1000@1 mwait.1), PSS acpipwrres5 at acpi0: FN00, resource for FAN0 acpipwrres6 at acpi0: FN01, resource for FAN1 acpipwrres7 at acpi0: FN02, resource for FAN2 acpipwrres8 at acpi0: FN03, resource for FAN3 acpipwrres9 at acpi0: FN04, resource for FAN4 acpitz1 at acpi0 acpitz1: critical temperature is 119 degC acpipwrres10 at acpi0: PIN_ acpivideo0 at acpi0: GFX0 acpivout0 at acpivideo0: DD1F cpu0: using VERW MDS workaround (except on vmm entry) cpu0: Enhanced SpeedStep 2590 MHz: speeds: 2601, 2600, 2500, 2400, 2200, 1900, 1800, 1700, 1500, 1400, 1200, 1100, 900, 700, 600, 400 MHz pci0 at mainbus0 bus 0 pchb0 at pci0 dev 0 function 0 "Intel Core 8G Host" rev 0x08 inteldrm0 at pci0 dev 2 function 0 "Intel Iris Plus 655" rev 0x01 drm0 at inteldrm0 inteldrm0: msi, COFFEELAKE, gen 9 "Intel Core GMM" rev 0x00 at pci0 dev 8 function 0 not configured pchtemp0 at pci0 dev 18 function 0 "Intel 300 Series Thermal" rev 0x30 xhci0 at pci0 dev 20 function 0 "Intel 300 Series xHCI" rev 0x30: msi, xHCI 1.10 usb0 at xhci0: USB revision 3.0 uhub0 at usb0 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1 "Intel 300 Series Shared SRAM" rev 0x30 at pci0 dev 20 function 2 not configured iwm0 at pci0 dev 20 function 3 "Intel AC 9560" rev 0x30, msix "Intel 300 Series MEI" rev 0x30 at pci0 dev 22 function 0 not configured ahci0 at pci0 dev 23 function 0 "Intel 300 Series AHCI" rev 0x30: msi, AHCI 1.3.1 ahci0: PHY offline on port 2 scsibus1 at ahci0: 32 targets ppb0 at pci0 dev 28 function 0 "Intel 300 Series PCIE" rev 0xf0 pci1 at ppb0 bus 1 ppb1 at pci0 dev 28 function 4 "Intel 300 Series PCIE" rev 0xf0: msi pci2 at ppb1 bus 2 ppb2 at pci2 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02 pci3 at ppb2 bus 3 ppb3 at pci3 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci4 at ppb3 bus 4 "Intel JHL6340 Thunderbolt 3" rev 0x02 at pci4 dev 0 function 0 not configured ppb4 at pci3 dev 1 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci5 at ppb4 bus 5 ppb5 at pci5 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02 pci6 at ppb5 bus 6 ppb6 at pci6 dev 1 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci7 at ppb6 bus 7 aq0 at pci7 dev 0 function 0 "Aquantia AQC107S" rev 0x02: msix, 4 queues, Atlantic B1, F/W version 3.1.106, address 00:23:a4:02:1c:d0 ppb7 at pci3 dev 2 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci8 at ppb7 bus 108 xhci1 at pci8 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi, xHCI 1.10 usb1 at xhci1: USB revision 3.0 uhub1 at usb1 configuration 1 interface 0 "Intel xHCI root hub" rev 3.00/1.00 addr 1 ppb8 at pci0 dev 29 function 0 "Intel 300 Series PCIE" rev 0xf0: msi pci9 at ppb8 bus 109 nvme0 at pci9 dev 0 function 0 vendor "Silicon Motion", unknown product 0x2263 rev 0x03: msix, NVMe 1.3 nvme0: NVME SSD 128GB, firmware 2204XKR, serial 2204V0223A000143 scsibus2 at nvme0: 2 targets, initiator 0 sd0 at scsibus2 targ 1 lun 0: sd0: 122104MB, 512 bytes/sector, 250069680 sectors ppb9 at pci0 dev 29 function 6 "Intel 300 Series PCIE" rev 0xf0: msi pci10 at ppb9 bus 110 rtsx0 at pci10 dev 0 function 0 "Realtek RTS522A Card Reader" rev 0x01: msi sdmmc0 at rtsx0: 4-bit, dma pcib0 at pci0 dev 31 function 0 "Intel 300 Series LPC" rev 0x30 azalia0 at pci0 dev 31 function 3 "Intel 300 Series HD Audio" rev 0x30: msi azalia0: codecs: Realtek ALC233, Intel/0x280b, using Realtek ALC233 audio0 at azalia0 ichiic0 at pci0 dev 31 function 4 "Intel 300 Series SMBus" rev 0x30: apic 2 int 16 iic0 at ichiic0 spdmem0 at iic0 addr 0x52: 16GB DDR4 SDRAM PC4-19200 SO-DIMM "Intel 300 Series SPI" rev 0x30 at pci0 dev 31 function 5 not configured em0 at pci0 dev 31 function 6 "Intel I219-V" rev 0x30: msi, address 94:c6:91:a3:b2:11 isa0 at pcib0 isadma0 at isa0 com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo com0: probed fifo depth: 0 bytes pcppi0 at isa0 port 0x61 spkr0 at pcppi0 vmm0 at mainbus0: VMX/EPT iwm0: restrict all mbufs to low memory uhidev0 at uhub0 port 3 configuration 1 interface 0 "JetKVM USB Emulation Device" rev 2.00/1.00 addr 2 uhidev0: iclass 3/1 ukbd0 at uhidev0: 8 variable keys, 6 key codes wskbd0 at ukbd0: console keyboard uhidev1 at uhub0 port 3 configuration 1 interface 1 "JetKVM USB Emulation Device" rev 2.00/1.00 addr 2 uhidev1: iclass 3/0, 2 report ids ums0 at uhidev1 reportid 1: 5 buttons wsmouse0 at ums0 mux 0 ums1 at uhidev1 reportid 2: 0 buttons, Z and W dir wsmouse1 at ums1 mux 0 uhidev2 at uhub0 port 3 configuration 1 interface 2 "JetKVM USB Emulation Device" rev 2.00/1.00 addr 2 uhidev2: iclass 3/1 ums2 at uhidev2: 8 buttons, Z and W dir wsmouse2 at ums2 mux 0 umass0 at uhub0 port 3 configuration 1 interface 3 "JetKVM USB Emulation Device" rev 2.00/1.00 addr 2 umass0: using SCSI over Bulk-Only scsibus3 at umass0: 2 targets, initiator 0 cd0 at scsibus3 targ 1 lun 0: removable serial.1d6b010491378ca9a814 ugen0 at uhub0 port 10 "Intel Bluetooth" rev 2.00/0.02 addr 3 vscsi0 at root scsibus4 at vscsi0: 256 targets softraid0 at root scsibus5 at softraid0: 256 targets root on sd0a (d125b0465dbe558f.a) swap on sd0b dump on sd0b inteldrm0: 1920x1200, 32bpp wsdisplay0 at inteldrm0 mux 1: console (std, vt100 emulation), using wskbd0 wsdisplay0: screen 1-5 added (std, vt100 emulation) iwm0: hw rev 0x310, fw ver 46.7e3e4b69.0, address 20:16:b9:bf:8f:83 uhub1 detached usb1 detached xhci1: command ring abort timeout xhci1: reset timeout xhci1 detached pci8 detached ppb7 detached aq0 detached pci7 detached ppb6 detached pci6 detached ppb5 detached pci5 detached ppb4 detached pci4 detached ppb3 detached pci3 detached ppb2 detached ppb2 at pci2 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02 pci3 at ppb2 bus 3 ppb3 at pci3 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci4 at ppb3 bus 4 "Intel JHL6340 Thunderbolt 3" rev 0x02 at pci4 dev 0 function 0 not configured ppb4 at pci3 dev 1 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci5 at ppb4 bus 12 ppb5 at pci3 dev 2 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: msi pci6 at ppb5 bus 16 xhci1 at pci6 dev 0 function 0 "Intel JHL6340 Thunderbolt 3" rev 0x02: can't map mem space