RE: Query on IOMMU

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: kvm-owner@xxxxxxxxxxxxxxx [kvm-owner@xxxxxxxxxxxxxxx] on behalf of Chris Wright [chrisw@xxxxxxxxxxxx]
> Sent: 21 December 2010 17:12
> To: Prasad Joshi
> Cc: Chris Wright; kvm@xxxxxxxxxxxxxxx
> Subject: Re: Query on IOMMU

>>* Prasad Joshi (P.G.Joshi@xxxxxxxxxxxxxxxxxxxxx) wrote:
> > From: Chris Wright [chrisw@xxxxxxxxxxxx]
>
> >> I have enabled IOMMU in the BIOS, but I am not sure why it is still asking to enabled IOMMU in BIOS. Do I need to worry about this?
>
> > It's unfortunate wording.  It's telling you that the GART is missing,
> > which is fine because you have an IOMMU.
>
> >> Besides I don't see the DMAR message similar to the one mentioned on the link
> >> http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM
>
> > That wiki page is specific to Intel VT-d.  You have an AMD box with IOMMU,
> > so all looks fine.
>
> Yes I am using AMD processor and ASUS motherboard. Both of them have the IOMMU support, atleast it is mentioned on the Xen VT-d

> Looks like we need some additional info in the wiki.  Care to create an
> account and add the info?

Sure I would love to.

> > Are you interested in using the IOMMU to do direct PCI device assignment
> > to a guest?
>
> Thanks a lot for your reply. Yes I am interested in working on GPU pass-through to Virtual Machine. But for now I am trying to pass-through a network card to VM.
>
> root@prasad-kvm:~/VMDisks# qemu-system-x86_64 -hda Ubuntu-10.10-amd64.img -m 1024M -device pci-assign,host=01:05.0
> Failed to assign device "(null)" : Device or resource busy
> *** The driver 'pci-stub' is occupying your device 0000:01:05.0.
> ***
> *** You can try the following commands to free it:
> ***
> *** $ echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/new_id
> *** $ echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/unbind
> *** $ echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/bind
> *** $ echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/remove_id
> ***

> Heh, this error is a little odd.  It's telling you the pci-stub
> driver already has this device.  Then it's telling you to unbind it
> from pci-stub, and bind it to pci-stub.  That error message is meant to
> tell you that the real host driver (in your case e100) has the device,
> unbind from it, and bind to pci-stub.

> qemu-system-x86_64: -device pci-assign,host=01:05.0: Device 'pci-assign' could not be initialized
> root@prasad-kvm:~/VMDisks# echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/new_id
> root@prasad-kvm:~/VMDisks# echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/unbind
> root@prasad-kvm:~/VMDisks# echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/bind
> root@prasad-kvm:~/VMDisks# echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/remove_id
> root@prasad-kvm:~/VMDisks# qemu-system-x86_64 -hda Ubuntu-10.10-amd64.img -m 1024M -device pci-assign,host=01:05.0
> Failed to assign device "(null)" : Device or resource busy
> *** The driver 'pci-stub' is occupying your device 0000:01:05.0.
>
>
> [  605.015852] e100 0000:01:05.0: BAR 0: can't reserve [mem 0xf9cff000-0xf9cfffff]
> [  605.015855] kvm_vm_ioctl_assign_device: Could not get access to device regions

> This is what is returning -EBUSY and triggering the error message.

> The device was previously owned by e100, now it shows it is owned by pci_stub. Initially the pci_stub.ko module was not loaded, I had to load it manually so that these assignment commands would work.

> And it looks like it is not working yet.  Is that correct?

Yes this is still not working.

> Can you start fresh (make sure the e100 is loaded and functional), and
> do the following:

Better I rebooted the machine.

> verify it's starting with e100
> # ls -l /sys/bus/pci/devices/0000:01:05.0/driver    <-- should show e100

> add device id to pci-stub driver
> # modprobe pci-stub
> # echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/new_id

> unbind e100 from device
> # echo "0000:01:05.0" > /sys/bus/pci/drivers/e100/unbind

> bind pci-stub to device
> # echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/bind

> remove the id from pci-stub so that subsequent probing will pick up e100
> # echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/remove_id

> verify it worked
> # ls -l /sys/bus/pci/devices/0000:01:05.0/driver    <-- should show pci-stub

> Launch your VM...assigned device should show up in VM now.

It still fails with the same error, here is the screen shot.

root@prasad-kvm:/sys# uptime 
 17:29:11 up 2 min,  3 users,  load average: 0.93, 0.52, 0.20

root@prasad-kvm:/sys# ls -l /sys/bus/pci/devices/0000:01:05.0/driver
lrwxrwxrwx 1 root root 0 2010-12-21 17:26 /sys/bus/pci/devices/0000:01:05.0/driver -> ../../../../bus/pci/drivers/e100

root@prasad-kvm:/sys# lsmod | grep pci_stub

root@prasad-kvm:/sys# modprobe pci_stub

root@prasad-kvm:/sys# lsmod | grep pci_stub
pci_stub                1590  0 

root@prasad-kvm:/sys# echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/new_id 

root@prasad-kvm:/sys# echo "0000:01:05.0" > /sys/bus/pci/drivers/e100/unbind 

root@prasad-kvm:/sys# echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/bind 

root@prasad-kvm:/sys# echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/remove_id 

root@prasad-kvm:/sys# ls -l /sys/bus/pci/devices/0000:01:05.0/driver
lrwxrwxrwx 1 root root 0 2010-12-21 17:31 /sys/bus/pci/devices/0000:01:05.0/driver -> ../../../../bus/pci/drivers/pci-stub

root@prasad-kvm:~/VMDisks# modprobe kvm_amd

root@prasad-kvm:~/VMDisks# lsmod | grep -i kvm
kvm_amd                56416  0 
kvm                   348987  1 kvm_amd

root@prasad-kvm:~/VMDisks# qemu-system-x86_64 -hda Ubuntu-10.10-amd64.img -m 1024M -device pci-assign,host=01:05.0
Failed to assign device "(null)" : Device or resource busy
*** The driver 'pci-stub' is occupying your device 0000:01:05.0.
***
*** You can try the following commands to free it:
***
*** $ echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/new_id
*** $ echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/unbind
*** $ echo "0000:01:05.0" > /sys/bus/pci/drivers/pci-stub/bind
*** $ echo "8086 1229" > /sys/bus/pci/drivers/pci-stub/remove_id
***
qemu-system-x86_64: -device pci-assign,host=01:05.0: Device 'pci-assign' could not be initialized
root@prasad-kvm:~/VMDisks# echo $?
1
root@prasad-kvm:~/VMDisks# 

The VM does not boot.

> thanks,
> -chris
> ----
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux