Issue

can't passthrough video card, says device not detected

posted in Hypervisor
Saturday, October 26 2013, 05:55 AM
bob
bob
Offline
0
Mostly copy pasted from a forum, I am trying to follow a guide to be able to passthrough my graphics card to a Windows guest. My video card is an AMD 7970 ghz, motherboard is Asrock extreme4 z87, CPU is i7-4771, VT-d is enabled and I can pass a PCI USB card without any problems. My dom0 is Kubuntu 13.10, using Xen version: 4.3.0 (preserve-AD).


When starting my Windows guest I had the following error:

Error: pci: PCI Backend and pci-stub don't own device 0000:02:00.0

after doing some searching I learned that I need to unbind the PCI devices and rebind them to the pciback interface. I found the following instructions:

echo 0000:08:00.0 > /sys/bus/pci/devices/0000:08:00.0/driver/unbind
echo 0000:08:00.0 > /sys/bus/pci/drivers/pciback/new_slot
echo 0000:08:00.0 > /sys/bus/pci/drivers/pciback/bind

The first thing I do this for is my PCI USB card. It works perfectly, and I am able to pass the device to my VM. Then I try to do it for my video card, which is a Radeon 7970. The relevant output of lspci:

02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
02:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT HDMI Audio [Radeon HD 7970 Series]

When I sudo -i to root and issue the command: echo 0000:02:00.0 > /sys/bus/pci/devices/0000:02:00.0/driver/unbind

I have the following result: -bash: /sys/bus/pci/devices/0000:02:00.0/driver/unbind: No such file or directory

when I issue the command for the audio portion of the device it just hangs. I investigated the issue a little by going to the relevant directories and looking around:

pwd: /sys/bus/pci/devices/0000:02:00.0

ls:

boot_vga consistent_dma_mask_bits drm local_cpus power resource resource4 subsystem_vendor
broken_parity_status d3cold_allowed enable modalias remove resource0 rom uevent
class device irq msi_bus rescan resource0_wc subsystem vendor
config dma_mask_bits local_cpulist numa_node reset resource2 subsystem_device


so I think the reason it doesn't unbind is because there is no driver directory and nothing called unbind. When I go to the audio area:

pwd: /sys/bus/pci/devices/0000:02:00.1

broken_parity_status d3cold_allowed enable modalias power resource subsystem_device
class device irq msi_bus remove resource0 subsystem_vendor
config dma_mask_bits local_cpulist msi_irqs rescan sound uevent
consistent_dma_mask_bits driver local_cpus numa_node reset subsystem vendor

So there actually is a driver directory and it contains a file called unbind:

pwd: /sys/bus/pci/devices/0000:02:00.1/driver
ls: 0000:00:03.0 0000:00:1b.0 0000:02:00.1 bind module new_id remove_id uevent unbind

I don't know how to continue from here. I wish that I could unbind my discrete video card components as easily as I did my PCI USB card. Please help .

I should also add that if I attempt the following:

echo 0000:02:00.0 > /sys/bus/pci/drivers/pciback/new_slot
echo 0000:02:00.0 > /sys/bus/pci/drivers/pciback/bind

the first command works fine but the second gives me the error: -bash: echo: write error: No such device

I should also add that my dom0 is kubuntu

edit: I just tried: echo -n 0000:02:00.0 > /sys/bus/pci/drivers/radeon/unbind , this results in it hanging

edit: lspci -k

02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
Subsystem: Hightech Information System Ltd. Tahiti XT2 [Radeon HD 7970 GHz Edition]
02:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT HDMI Audio [Radeon HD 7970 Series]
Subsystem: Hightech Information System Ltd. Device aaa0
Kernel driver in use: snd_hda_intel

So it doesn't look like the video controller of the 7970 is bound to any driver, which explains why unbinding it doesn't work. But it doesn't explain why my terminal hangs when I try to unbind the audio device, or why I can't bind the video controller to pciback.

sudo echo 0000:02:00.0 > /sys/bus/pci/drivers/pciback/bind
echo: write error: No such device

Why doesn't it think this is a real device? It is in the output of lspci .

edit: After a fresh reboot lspci -k actually shows

02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
Subsystem: Hightech Information System Ltd. Tahiti XT2 [Radeon HD 7970 GHz Edition]
Kernel driver in use: radeon

so doing

echo -n 0000:02:00.0 > /sys/bus/pci/drivers/radeon/unbind

to unbind the driver actually works, as after doing that lspci -k shows

02:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Tahiti XT [Radeon HD 7970/R9 280X]
Subsystem: Hightech Information System Ltd. Tahiti XT2 [Radeon HD 7970 GHz Edition]

I doubt it matters, but when I issue that command as root it drops me down to my user account again. I think that I might have provided too much detail in this message, as I've figured out many of the issues myself. To be clear, right now the issue I am stuck on is:

sudo echo 0000:02:00.0 > /sys/bus/pci/drivers/pciback/bind
echo: write error: No such device
Responses (3)
  • Accepted Answer

    Friday, November 15 2013, 12:20 PM - #permalink
    0
    Sorry about the late reply; I have been on the road for the past couple of weeks.

    I suggest you take this question to the xen-users list, if you haven't already. It is sufficiently complex that it will find a better audience there.

    It is not necessary to actually join the list if you don't want to; just send the message and wait for responses.

    The instructions can be found under Help > Mailing List from the header atop this page.
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, November 17 2013, 11:19 PM - #permalink
    0
    Its likely you'll need to edit mkinitcpio to add pciback to modules so xen grabs it before the OS.

    At least that's what it would be on arch to fix. Look for your equivalent.
    The reply is currently minimized Show
  • Accepted Answer

    Sunday, November 17 2013, 11:32 PM - #permalink
    0
    See this post on my blog for a better explanation.

    http://blog.ktz.me/?p=166
    The reply is currently minimized Show
Your Reply