How to Reset/Cycle power to a PCIe device ???

NinthWave

Member
Sep 27, 2021
37
0
11
44
Montreal, CANADA
Proxmox < Debian 11 < Docker/Portainer
Machine q35, UEFI Bios

I have an Hauppauge HVR-2250.
iommu=on is set
VM has the pcie device added.

If the server (Proxmox) is freshly started, when the VM is started, the card is discovered and seems to be in working order:

Code:
root@debianq35:~# dmesg | grep saa7164
[    3.378991] CORE saa7164[0]: subsystem: 0070:8851, board: Hauppauge WinTV-HVR2250 [card=7,autodetected]
[    3.379006] saa7164[0]/0: found at 0000:01:00.0, rev: 129, irq: 16, latency: 0, mmio: 0xc1000000
[    3.617478] saa7164_downloadfirmware() no first image
[    3.617527] saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw)
[    3.662792] saa7164 0000:01:00.0: firmware: direct-loading firmware NXP7164-2010-03-10.1.fw
[    3.662802] saa7164_downloadfirmware() firmware read 4019072 bytes.
[    3.662804] saa7164_downloadfirmware() firmware loaded.
[    3.662808] saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072
[    3.662814] saa7164_downloadfirmware() FirmwareSize = 0x1fd6
[    3.662815] saa7164_downloadfirmware() BSLSize = 0x0
[    3.662816] saa7164_downloadfirmware() Reserved = 0x0
[    3.662817] saa7164_downloadfirmware() Version = 0x1661c00
[   10.777498] saa7164_downloadimage() Image downloaded, booting...
[   10.889495] saa7164_downloadimage() Image booted successfully.
[   13.293044] saa7164_downloadimage() Image downloaded, booting...
[   14.898837] saa7164_downloadimage() Image booted successfully.
[   14.950875] saa7164[0]: Hauppauge eeprom: model=88061
[   15.604417] dvbdev: DVB: registering new adapter (saa7164)
[   15.604429] saa7164 0000:01:00.0: DVB: registering adapter 0 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[   18.730510] dvbdev: DVB: registering new adapter (saa7164)
[   18.730524] saa7164 0000:01:00.0: DVB: registering adapter 1 frontend 0 (Samsung S5H1411 QAM/8VSB Frontend)...
[   18.766335] saa7164[0]: registered device video0 [mpeg]
[   18.992805] saa7164[0]: registered device video1 [mpeg]
[   19.204774] saa7164[0]: registered device vbi0 [vbi]
[   19.204834] saa7164[0]: registered device vbi1 [vbi]
[   19.206700] saa7164 driver loaded

If I restart the VM, the tuner card won't work. Here is the dmesg up until fail: app.php/pastebin/?mode=download&s=12

No matter how many times I restart the VM, the card won't work,

I thought it was a Debian problem so I first asked at Debian forum. One guy parsed the code and found this: [1] https://sources.debian.org/src/linux/6. ... 1337#L1337

Meanwhile, I realized that if I reboot the host (Proxmox), then the card will boot up nicely.

Because of that plus the fact the guys at Debian forum think the source of the problem might be Proxmox, here I am asking for help.
 
If that may help:
Code:
root@pve1:/etc/pve/qemu-server# cat 111.conf
agent: 1
bios: ovmf
boot: order=scsi0;net0
cores: 4
efidisk0: local-zfs:vm-111-disk-0,efitype=4m,size=1M
hostpci0: 0000:06:00,pcie=1
machine: q35
memory: 2048
meta: creation-qemu=7.1.0,ctime=1673236541
name: debian-test
net0: virtio=12:DD:C6:9A:0D:D7,bridge=vmbr0
net1: virtio=02:AD:86:C9:7F:D1,bridge=vmbr1,tag=10
net2: virtio=8E:22:CD:A9:98:BB,bridge=vmbr1,tag=40
numa: 0
ostype: l26
scsi0: backups:111/vm-111-disk-0.qcow2,discard=on,iothread=1,size=20G,ssd=1
scsihw: virtio-scsi-single
smbios1: uuid=380399d1-1458-4738-82a8-cef1eb2bcd26
sockets: 1
vmgenid: 1da0eeda-9c27-4dab-b1d9-b8b6f33e3ace
 
So the be clear, I'd like Proxmox to properly power cycle the passthroughed PCIe devices when a VM is rebooted.

Is there a way to do that from the host or should I try all the solutions presented at post#3 at the Guest level ?
 
Please let us know if you find a way to do that. I fear that it very much depends on the hardware and cannot really be done. Some device don't reset properly, not matter which method is used. For some devices, the Linux kernel/VFIO provide a quirk or someone on the internet finds a work-around. That's why projects such as vendor-reset exist.

EDIT: The hardware can, due to it's physical nature, interfere with other hardware. PCI(e) passthrough is a niche use case that hardware manufacturers mostly don't test nor design for. The Proxmox developers (and the Debian and Linux kernel developers) do give it a best effort but they cannot guarantee that it will always work, or work at all, given all possible combinations.
 
Last edited:
indeed only very very speciality pc do have a kind of function.. but the boot process do check and reassign the card. But for a tv tuner stuff, just simply get an usb one or just do a reboot.
 
@leesteken and @Docop2
I think I am resigned to just reboot.
I don't watch enough TV to buy a new tuner. Besides, this is at home so once all those containers will be in working order, I won't have to reboot that often and no-one will charge me for downtime.
 
Just wanted to say that I'm probably the only other person in existence with a HVR2250, in a VM in Proxmox, and have the same issue as you. I discovered the same thing a long time ago: a fresh boot of the host will enable the tuner, but rebooting the VM will break it from that point forward. At this point, I pretty much only use it to watch the ball drop on New Years once a year, but damn if there was a way for this to work consistently, I'd be so happy.

Even though, like you, I don't reboot my VMs very often at all, but I watch over-the-air TV even less. So whenever I want to try it out again, it's always in this broken state, because odds are I rebooted the VM months ago, or whatever.

Please keep this thread updated if you find any information outside of here. Having the host power cycle power to the card sounds like a no-go, but maybe a different way of passing the card through, or something else, I have no idea.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!