Sdhci pci passthrough problem

sdhci_pci fails to probe in domU that has the device passed to it with:

sdhci-pci 0000:00:06.0: probe with driver sdhci-pci failed with error -22

The reader works fine in dom0.

I’ve disabled memory ballooning for this domU.
I’ve tried to enable permissive mode and no strict reset for the device.

HW: Novacustom NV41

DomU runs on Debian 12 template.
The same happens when using different kernels:

  • dom0 supplied (6.10.10-1-fc37)
  • domU supplied (linux-image-6.1.0-25-amd64 6.1.106-3)
  • custom build vanilla Linux from recent master (ad46e8f95e93) with config mostly copied from Debian kernel (+dbg options enabled)

Running:

# echo 1 > /sys/bus/pci/devices/0000\:00\:06.0/remove
# echo 1 > /sys/bus/pci/rescan

dmesg:

[  280.501056] pci 0000:00:06.0: PME# disabled
[  280.501081] pci 0000:00:06.0: vgaarb: pci_notify
[  280.501126] bus: 'pci': remove device 0000:00:06.0
[  280.501130] PM: Removing info for pci:0000:00:06.0
[  280.501303] device: 'wakeup4': device_unregister
[  280.501367] pci 0000:00:06.0: vgaarb: pci_notify
[  280.501386] pci 0000:00:06.0: device released
// Rescan triggered here
[  297.517140] pci_bus 0000:00: scanning bus
[  297.519837] pci 0000:00:06.0: [1217:8621] type 00 class 0x080501 PCIe Endpoint
[  297.522243] pci 0000:00:06.0: BAR 0 [mem 0xf2012000-0xf2012fff]
[  297.523691] pci 0000:00:06.0: BAR 1 [mem 0xf2013000-0xf2013fff]
[  297.539615] device: '0000:00:06.0': device_add
[  297.539656] device: 'wakeup4': device_add
[  297.542821] bus: 'pci': add device 0000:00:06.0
[  297.542872] PM: Adding info for pci:0000:00:06.0
[  297.542881] pci 0000:00:06.0: vgaarb: pci_notify
[  297.544617] pci_bus 0000:00: bus scan returning with max=00
[  297.544643] pci 0000:00:06.0: BAR 0 [mem 0xf2000000-0xf2000fff]: assigned
[  297.545591] pci 0000:00:06.0: BAR 1 [mem 0xf2001000-0xf2001fff]: assigned
[  297.546302] pci 0000:00:06.0: bus: 'pci': __driver_probe_device: matched device with driver sdhci-pci
[  297.546314] pci 0000:00:06.0: bus: 'pci': really_probe: probing driver sdhci-pci with device
[  297.546323] sdhci-pci 0000:00:06.0: no default pinctrl state
[  297.546335] sdhci-pci 0000:00:06.0: vgaarb: pci_notify
[  297.546343] sdhci-pci 0000:00:06.0: runtime IRQ mapping not provided by arch
[  297.546348] sdhci-pci 0000:00:06.0: SDHCI controller found [1217:8621] (rev 1)
[  297.548460] sdhci-pci 0000:00:06.0: probe with driver sdhci-pci failed with error -22
[  297.548640] sdhci-pci 0000:00:06.0: vgaarb: pci_notify

Logs from dom0:
/var/log/xen/console/guest-dev-upstream-dm.log:

[2024-10-04 04:14:17] from-vchan: {"execute":"device_add","id":2020372736,"arguments":{"driver":"xen-pci-passthrough","id":"pci-pt-2d_00.0","hostaddr":"0000:2d:00.0","permissive":true}}
[2024-10-04 04:14:17] 
[2024-10-04 04:14:17] [00:06.0] xen_pt_realize: Assigning real physical device 2d:00.0 to devfn 0x30
[2024-10-04 04:14:17] [00:06.0] xen_pt_register_regions: IO region 0 registered (size=0x00001000 base_addr=0x80500000 type: 0x0)
[2024-10-04 04:14:17] [00:06.0] xen_pt_register_regions: IO region 1 registered (size=0x00001000 base_addr=0x80501000 type: 0x0)
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x000e mismatch! Emulated=0x0080, host=0x0000, syncing to 0x0000.
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x0010 mismatch! Emulated=0x0000, host=0x80500000, syncing to 0x80500000.
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x0014 mismatch! Emulated=0x0000, host=0x80501000, syncing to 0x80501000.
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x006e mismatch! Emulated=0x0000, host=0x0043, syncing to 0x0003.
[2024-10-04 04:14:17] [00:06.0] xen_pt_pm_ctrl_reg_init_off: PCI power management control passthrough is off
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x004a mismatch! Emulated=0x0000, host=0x0180, syncing to 0x0080.
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x0084 mismatch! Emulated=0x0000, host=0x5908f80, syncing to 0x5908f80.
[2024-10-04 04:14:17] [00:06.0] xen_pt_config_reg_init: Offset 0x0092 mismatch! Emulated=0x0000, host=0x0011, syncing to 0x0011.
[2024-10-04 04:14:17] [00:06.0] xen_pt_pci_intx: intx=1
[2024-10-04 04:14:17] [00:06.0] xen_pt_realize: Real physical device 2d:00.0 registered successfully
[2024-10-04 04:14:17] from-unix: {"return": {}, "id": 2020372736}

Seems that somebody had the same issue but didn’t pursue it: HCL - Tuxedo InfinityBook S 15 - Gen8 (NS50AU) Unfortunately in my case USB card reader is useless.

Anybody got idea how to fix/debug this?

If you need /dev/mmcblk* device with MMC interface then some USB card readers have it:

1 Like

I haven’t thought of using a part of internals of some computer and searched only for external readers. I’ll try to acquire one and see if it works for me.

Workaround aside I’d love to have the built-in reader working too. :wink:

You can check if it works in KVM and if it works there then it could be a Xen issue and then you can try asking the Xen devs:

1 Like