VM and pci passthrough - Page 1
Forum section: electronics / general

author: msuffidy
author_rank: Frequent Contributor
timestamp: July 27, 2022, 07:59:45 pm
content: In order to use a certain card in a vm of win7 32 under linux, I unbound all other pci devices in the iommu group as the desired card. So when this happens I can't use my motherboard gigabit nic and the cdrom is not connected, as well as some USB ports connected to the Southbridge. So up to now I sort of took it that I could never use those devices (until rebooting) again. Then I was thinking about it and wondering why I could not just have the host system talk to the devices in their new locations? It could be that they are not accessible due to environmental fencing at that point? Also it could be doable if Linux itself was being hypervised, but I don't want to deal with it. Just wondering if anyone knew if the computer itself could reclaim some of these vfio-pci devices? As it stands I am using a USB wireless dongle to be sending this.

author: msuffidy
author_rank: Frequent Contributor
timestamp: July 27, 2022, 10:44:25 pm
content: Have to review it but this sounds like a good overview of the problem.

author: msuffidy
author_rank: Frequent Contributor
timestamp: July 28, 2022, 05:03:55 am
content: Another mostly day wasted on trying various combinations of things and not working. I am not pursuing it, but there was some potential to install the gigabit nic on the the vm side and somehow bond all the networks into one, or to somehow tunnel through the vm side to openwrt to unpack. I was also looking at maybe a usb to usb transfer on some sort between a openwrt router and the computer. A small but beneficial spin off was I noticed if I got the vm to claim the cdrom sata driver, I then have the cdrom in windows. So at that point I can copy it back to the host through a windows share. I am not messing with the ACS patch but there was a ACS option I left on in the BIOS that had no immediate effects.

author: msuffidy
author_rank: Frequent Contributor
timestamp: July 28, 2022, 06:03:35 pm
content: I made 2 shell scripts for before and after the vm is used so I can get the devices back by going between them. There is an issue with suspend after using the VM in fedora 34. It involves unbinding/binding to the /sys tree and rmmoding the vfio-pci module.OK GOT IT TOTALLY TOGGLING NOW: a bit of a hauppage[root@FRZNWSTE hacks]# cat unsafe-enter#!/bin/bashrmmod r8169rmmod firewire_ohcirmmod emu10k1_gpecho "1" > /sys/bus/pci/devices/0000:06:00.0/removeecho 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbindecho 0000:01:00.1 > /sys/bus/pci/devices/0000:01:00.1/driver/unbind# echo 0000:03:00.0 > /sys/bus/pci/devices/0000:03:00.0/driver/unbindecho 0000:05:01.0 > /sys/bus/pci/devices/0000:05:01.0/driver/unbind# echo 0000:05:01.1 > /sys/bus/pci/devices/0000:05:01.1/driver/unbind# echo 0000:05:01.2 > /sys/bus/pci/devices/0000:05:01.2/driver/unbind# echo 0000:06:00.0 > /sys/bus/pci/devices/0000:06:00.0/driver/unbind[root@FRZNWSTE hacks]# cat exit-win7#!/bin/bashrmmod vfio-pcirmmod snd_emu10k1_synthrmmod snd_emu10k1echo "1" > /sys/bus/pci/devices/0000:01:00.0/removeecho "1" > /sys/bus/pci/devices/0000:01:00.1/removeecho "1" > /sys/bus/pci/devices/0000:03:00.0/removeecho "1" > /sys/bus/pci/devices/0000:05:01.2/removeecho "1" > /sys/bus/pci/devices/0000:05:01.1/removeecho "1" > /sys/bus/pci/devices/0000:05:01.0/removeecho "1" > /sys/bus/pci/rescanI was having trouble with a HD TV over the air PCIe card. It seemed to be totally unstable doing the whatever, and what seems to work is removing it from the transaction BUS 6. Then I can suspend again also.

author: msuffidy
author_rank: Frequent Contributor
timestamp: August 02, 2022, 12:56:39 am
content: Yes I was looking at those sort of options to solve the problem, but I like the cards where they are and I almost pursued a usb etthernet dongle, but it was not supported at this time for linux. I can do 60mbit through my wireless n 2.4 tp link dongle as it is. I have the option to stop the vm and put the system back to the way it was. It was tedious but it is over now and works in the on off manner.

author: msuffidy
author_rank: Frequent Contributor
timestamp: August 03, 2022, 12:10:37 am
content: Weird thing is I was out getting some free scraps off the internet on my bike and I think maybe I got what I need, but it is 100 not 1000. So well. Better.

author: msuffidy
author_rank: Frequent Contributor
timestamp: August 03, 2022, 02:24:26 am
content: I was just testing out that unit and it seems to not be working thus far and USB 1 which all together makes it a bad solution. Linux sort of sees the usb device but the cable is always unplugged and the link led never comes on the unit.

author: msuffidy
author_rank: Frequent Contributor
timestamp: August 03, 2022, 04:27:24 pm
content: Again it is slower than my wireless N dongle which seems to be working properly anyway, but my guess is the lan side got blown somehow. The correct driver is loaded but the link and tx leds never go on. The router sees the link is set up. I took it apart no obvious problems. Giving up on that one.

author: msuffidy
author_rank: Frequent Contributor
timestamp: August 04, 2022, 07:39:53 pm
content: OK It bugged me so I got a usb 3 to gigabit adapter for $20.40 Canadian today. It is working properly and had native drivers for Fedora Core 34 as I checked it out before buying. The graph there shows a file copy between 2 computers on my home gigabit lan, it does not reflect access speed to the internet.