Ath12k pci passthrough problem in qemu

Hello.
I've looked for it in many ways, but I can't solve it, so I'm posting a question.

I don't know what the -34 error is output from guest dmesg.
Surprisingly, it works fine when if i boot usb and try it as a host, it works fine.

Therefore, my guess is that there is a problem with pci passthrough or qemu setting in the host rather than module/firmware.

Host; Fedora 41 6.11.4-301.fc41.x86_64

lspci -nn

06:00.0 Network controller [0280]: Qualcomm Technologies, Inc WCN785x Wi-Fi 7(802.11be) 320MHz 2x2 [FastConnect 7800] [17cb:1107] (rev 01)

/etc/default/grub

GRUB_CMDLINE_LINUX="rhgb quiet intel_iommu=on i915.enable_guc=3 i915.max_vfs=1 modprobe.blacklist=ath12k pci=noaer vfio-pci.ids=17cb:1107"

Guest; openwrt-24.10.0-x86-64-generic-ext4-combined.img.gz

opkg install

iw iwinfo kmod-batman-adv kmod-cfg80211 kmod-mac80211 libiwinfo-lua luci-proto-batman-adv wireless-regdb wpad-mesh-mbedtls ath12k-firmware-wcn7850 kmod-ath12k

qemu/virt-manager setting

<domain type="kvm">
  <os>
    <type arch="x86_64" machine="pc-i440fx-9.1">hvm</type>
    <boot dev="hd"/>
  </os>
{...}
<hostdev mode="subsystem" type="pci" managed="yes">
  <driver name="vfio"/>
  <source>
    <address domain="0x0000" bus="0x06" slot="0x00" function="0x0"/>
  </source>
  <alias name="hostdev0"/>
  <address type="pci" domain="0x0000" bus="0x00" slot="0x05" function="0x0"/>
</hostdev>

guest dmesg

[    8.406122] ath12k_pci 0000:00:05.0: BAR 0: assigned [mem 0x100000000-0x1001fffff 64bit]
[    8.411276] ath12k_pci 0000:00:05.0: MSI vectors: 1
[    8.412940] ath12k_pci 0000:00:05.0: Hardware name: wcn7850 hw2.0
[    8.512113] ath12k_pci 0000:00:05.0: link down error during global reset
[    8.526787] mhi mhi0: BHI offset: 0xffffffff is out of range: 0x200000
[    8.527711] ath12k_pci 0000:00:05.0: failed to set mhi state: INIT(0)
[    8.528627] ath12k_pci 0000:00:05.0: failed to start mhi: -34
[    8.529401] ath12k_pci 0000:00:05.0: failed to power up :-34
[    8.580852] ath12k_pci 0000:00:05.0: failed to create soc core: -34
[    8.582389] ath12k_pci 0000:00:05.0: failed to init core: -34
[    8.583854] ------------[ cut here ]------------
[    8.585069] WARNING: CPU: 1 PID: 1126 at 0xffffffff81139f63
[    8.586334] Modules linked in: ath12k(O+) video pppox ppp_generic nft_reject_ipv6 nft_reject_ipv4 nft_reject_inet nft_reject nft_redir nft_quota nft_numgen nft_nat nft_masq nft_log nft_limit nft_hash nft_flow_offload nft_fib_ipv6 nft_fib_ipv4 nft_fib nft_ct nft_chain_nat nf_tables nf_nat nf_flow_table nf_conntrack mac80211(O) lzo cfg80211(O) wmi slhc r8169 qrtr_mhi qrtr qmi_helpers(O) nfnetlink nf_reject_ipv6 nf_reject_ipv4 nf_log_syslog nf_defrag_ipv6 nf_defrag_ipv4 mhi_pci_generic mhi_net mhi lzo_rle lzo_decompress lzo_compress libcrc32c forcedeth e1000e drm_suballoc_helper drm_exec drm_display_helper drm_buddy crc_ccitt compat(O) bnx2 i2c_dev dwmac_intel dwmac_generic stmmac_platform stmmac ixgbe e1000 amd_xgbe mdio nls_utf8 nls_iso8859_1 nls_cp437 pcs_xpcs ena sha512_ssse3 sha512_generic seqiv sha3_generic jitterentropy_rng drbg michael_mic hmac geniv rng cmac crypto_acompress igb igc vfat fat button_hotplug(O) tg3 realtek phylink mii
[    8.602325] CPU: 1 PID: 1126 Comm: kmodloader Tainted: G           O       6.6.73 #0
[    8.603884] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
[    8.605723] RIP: 0010:0xffffffff81139f63
[    8.606559] Code: 81 a4 24 e8 00 00 00 ff ff f7 ff 4c 89 e7 e8 44 1d 00 00 e9 27 fe ff ff 49 8d bc 24 98 00 00 00 ff d0 0f 1f 00 e9 13 ff ff ff <0f> 0b 49 c7 84 24 28 01 00 00 00 00 00 00 e9 11 fe ff ff 48 89 cf
[    8.610078] RSP: 0018:ffffc90000afb9d0 EFLAGS: 00010086
[    8.611246] RAX: 0000000000000880 RBX: ffff88800438fa00 RCX: ffff888004c45150
[    8.612719] RDX: ffff88800438fa80 RSI: ffff88800438fa00 RDI: ffff888003e17000
[    8.614169] RBP: ffffc90000afba08 R08: 0000000000000018 R09: ffff888004c45100
[    8.615650] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888003e17000
[    8.617138] R13: ffff888004631bc0 R14: ffff888003e17208 R15: ffff888003e17114
[    8.618813] FS:  00007f34ee134b28(0000) GS:ffff88803ec80000(0000) knlGS:0000000000000000
[    8.620683] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[    8.622043] CR2: 00007f34edfe6000 CR3: 000000000439c000 CR4: 0000000000350ee0
[    8.623622] Call Trace:
[    8.624383]  <TASK>
[    8.625049]  ? 0xffffffff8103a650
[    8.625949]  ? 0xffffffff810d7b00
[    8.626895]  ? 0xffffffff81139f63
[    8.627809]  ? 0xffffffff81ac01de
[    8.628803]  ? 0xffffffff81ae6730
[    8.629689]  ? 0xffffffff81ae6858
[    8.630572]  ? 0xffffffff81c00bbb
[    8.631446]  ? 0xffffffff81139f63
[    8.632452]  0xffffffffa082014a [ath12k@000000009d86fe97+0x3d000]
[    8.634057]  0xffffffffa0821686 [ath12k@000000009d86fe97+0x3d000]
[    8.635586]  0xffffffff814dbf80
[    8.636504]  0xffffffff81689958
[    8.637522]  0xffffffff81689b73
[    8.638447]  0xffffffff81689c4f
[    8.639377]  0xffffffff81689e26
[    8.640377]  ? 0xffffffff81689da0
[    8.641394]  0xffffffff816875f2
[    8.642374]  0xffffffff81689179
[    8.643283]  0xffffffff81688925
[    8.644249]  ? 0xffffffffa084c010 [ath12k@000000009d86fe97+0x3d000]
[    8.645963]  0xffffffff8168ade9
[    8.646918]  ? 0xffffffffa084c010 [ath12k@000000009d86fe97+0x3d000]
[    8.648760]  0xffffffff814da5cd
[    8.649778]  0xffffffffa084c034 [ath12k@000000009d86fe97+0x3d000]
[    8.651506]  0xffffffff81000812
[    8.652629]  ? 0xffffffff8129228e
[    8.653677]  0xffffffff8115c753
[    8.654665]  0xffffffff8115e5af
[    8.655677]  0xffffffff8115e86e
[    8.656757]  ? 0xffffffff8115e86e
[    8.658001]  0xffffffff8115e9a5
[    8.659071]  0xffffffff8100360a
[    8.660286]  0xffffffff81ae5ecd
[    8.661404]  0xffffffff81c00130
[    8.662482] RIP: 0033:0x7f34ee0ec968
[    8.663681] Code: 4c 89 4c 24 48 4c 8b 4c 24 60 48 89 54 24 10 48 8b 7e 08 48 89 74 24 18 48 8b 51 18 c7 44 24 08 28 00 00 00 48 8b 76 10 0f 05 <48> 89 c7 e8 ab 5d fe ff 48 83 c4 58 c3 41 57 41 56 41 55 41 54 55
[    8.668666] RSP: 002b:00007ffd18c48bf0 EFLAGS: 00000206 ORIG_RAX: 00000000000000af
[    8.670822] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f34ee0ec968
[    8.672904] RDX: 0000000000405485 RSI: 00000000000b0770 RDI: 00007f34edf37030
[    8.675094] RBP: 0000000000407300 R08: 0000000000000000 R09: 0000000000000802
[    8.677201] R10: 0000000000000000 R11: 0000000000000206 R12: 00007f34edf37030
[    8.679393] R13: 0000000000000003 R14: 0000000000405485 R15: 00000000000b0770
[    8.681534]  </TASK>
[    8.682348] ---[ end trace 0000000000000000 ]---
[    9.152424] ath12k_pci: probe of 0000:00:05.0 failed with error -34

It is known as reset domain in virtualisation.
Since pci bus 0 resets along single device you have to use other bus ( usually latest m2 or pcie slot) or pass through whole bus, which is unlikely to work having 5 other devices attached.
Also ich guest gives bigger device mem ranges.

hey, Thanks for kindly anwser.

  • domain resets mean Xen virt right? I'm using on kvm/qemu so...
  • I've attach to one/single wifi m.2 to pcie slot. this wifi/bluetooth chips are m.2 wifi / usb bluetooth combo.

lspci -vt

-[0000:00]-+-00.0  Intel Corporation Device 461c
           +-02.0  Intel Corporation Alder Lake-N [UHD Graphics]
           +-02.1  Intel Corporation Alder Lake-N [UHD Graphics]
           +-0d.0  Intel Corporation Alder Lake-N Thunderbolt 4 USB Controller
           +-14.0  Intel Corporation Alder Lake-N PCH USB 3.2 xHCI Host Controller
           +-14.1  Intel Corporation Device 54ee
           +-14.2  Intel Corporation Alder Lake-N PCH Shared SRAM
           +-16.0  Intel Corporation Alder Lake-N PCH HECI Controller
           +-17.0  Intel Corporation Alder Lake-N SATA AHCI Controller
           +-1c.0-[01]----00.0  Intel Corporation Ethernet Controller I226-V
           +-1c.1-[02]----00.0  Intel Corporation Ethernet Controller I226-V
           +-1c.2-[03]----00.0  Intel Corporation Ethernet Controller I226-V
           +-1c.3-[04]----00.0  Intel Corporation Ethernet Controller I226-V
           +-1c.6-[05]----00.0  JMicron Technology Corp. JMB58x AHCI SATA controller
           +-1d.0-[06]----00.0  Qualcomm Technologies, Inc WCN785x Wi-Fi 7(802.11be) 320MHz 2x2 [FastConnect 7800]
           +-1d.1-[07]----00.0  Samsung Electronics Co Ltd NVMe SSD Controller PM9A1/PM9A3/980PRO
           +-1f.0  Intel Corporation Alder Lake-N PCH eSPI Controller
           +-1f.3  Intel Corporation Alder Lake-N PCH High Definition Audio Controller
           +-1f.4  Intel Corporation Alder Lake-N SMBus
           \-1f.5  Intel Corporation Alder Lake-N SPI (flash) Controller
  • host memory is 32gb single slot, guest memory gives 512-1024mb ish. and running single guest openwrt. is that problem?

Where is that extra USB controller?

Here!
ID 2c7c:0130

lsusb -vt

/:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/1p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
/:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/2p, 20000M/x2
    ID 1d6b:0003 Linux Foundation 3.0 root hub
/:  Bus 003.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
    ID 1d6b:0002 Linux Foundation 2.0 root hub
    |__ Port 001: Dev 002, If 0, Class=Hub, Driver=hub/4p, 480M
        ID 1a40:0101 Terminus Technology Inc. Hub
        |__ Port 003: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
            ID 1a40:0101 Terminus Technology Inc. Hub
        |__ Port 004: Dev 006, If 0, Class=Wireless, Driver=usbfs, 12M
            ID 2c7c:0130 Quectel Wireless Solutions Co., Ltd.
        |__ Port 004: Dev 006, If 1, Class=Wireless, Driver=usbfs, 12M
            ID 2c7c:0130 Quectel Wireless Solutions Co., Ltd.
    |__ Port 007: Dev 003, If 0, Class=Audio, Driver=snd-usb-audio, 480M
        ID 0bda:4be2 Realtek Semiconductor Corp.
    |__ Port 007: Dev 003, If 1, Class=Audio, Driver=snd-usb-audio, 480M
        ID 0bda:4be2 Realtek Semiconductor Corp.
    |__ Port 007: Dev 003, If 2, Class=Audio, Driver=snd-usb-audio, 480M
        ID 0bda:4be2 Realtek Semiconductor Corp.
    |__ Port 007: Dev 003, If 3, Class=Human Interface Device, Driver=usbhid, 480M
        ID 0bda:4be2 Realtek Semiconductor Corp.
/:  Bus 004.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/4p, 10000M
    ID 1d6b:0003 Linux Foundation 3.0 root hub

So pass it through and bridge too?

Yep, I'll try. but it does not working either... :frowning:

You have to unlink usb and hub pci devices from host foor passthrough. This happens with multiport wired cards too.

@brada4

Hmm...

Multiple PCI device was physically linked to motherboard; therefore, it cannot be separated. If it's right to see it as it is.

USB device too, but it can be disconnect by not using Bluetooth.

I know that the WiFi/Bluetooth combo is working differently with the PCI and USB signals.
Will it operate normally if the USB device signal part is disconnect?