Thanks Alex for your prompt reply! I'll gather all the information you requested, make some more tests with command line qemu and then write back. In the meantime, I'll briefly comment on same of your lines:

> Looks like you're still trying to create an SDL window since I believe  that's on by default, add -nographic

I'll try that. However, I thought that the purpose of this line (in the arch tutorial at [1]) was to show a running VM with seabios. How can I see what's going on in the VM with no graphic?

> Not good.  This is using the vfio-vga-reset branches?

No. I'm just using the fedora-virt-preview repository [2]. I would like to test that branch. Is it:

git://github.com/awilliam/linux-vfio.git
git://github.com/awilliam/qemu-vfio.git

with vfio-vga-reset, right?

* Are there any recommended build options apart of:

CONFIG_VFIO_IOMMU_TYPE1=y
CONFIG_VFIO=y
CONFIG_VFIO_PCI=y
CONFIG_VFIO_PCI_VGA=y

* This is not the version in fedora-virt-preview repo so I need to recompile qemu as well, right?
* Should I stop using the virt-preview repo completely? It also ships libvirtd and seabios packages I think...

> Cayman, is this a Radeon HD 6xxx [...] retrieving the BIOS from the device?

It is a radeon HD 7850. I would say there are no rom-related failures on dmesg but I'll check it again and report.

> Remove or patch them for what?

I have two gpu: nvidia quadro 4000 which is the primary and the radeon which is the one to pass through. I read in [3, 4] that someone needed to patch the nvidia binary driver. I can also get rid of that and nouveau altogether, but then, how can I check what the VM is doing without X?

Best,

Mario

[1] https://bbs.archlinux.org/viewtopic.php?id=162768&p=1
[2] http://fedoraproject.org/wiki/Virtualization_Preview_Repository
[3] http://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04296.html
[4] http://lists.gnu.org/archive/html/qemu-devel/2013-05/msg04300.html




On 27 June 2013 17:03, Alex Williamson <alex.williamson@redhat.com> wrote:
On Thu, 2013-06-27 at 16:35 +0200, Mario Ceresa wrote:
> Thanks Alex, now the driver is working fine.
>
> I spent the last two days making tests and the results are as folows:
>
> 1. from qemu command line I never get past the "This VM has no graphic
> card" messages even if I change the number of the pci id to the one I bound
> to vfio-pci (05:00). I'm still trying to learn how to control quemu by
> command line so most likely I'm using the wrong spell here :)
>
> qemu-system-x86_64 --enable-kvm -M q35 -m 1024 -cpu host \
> -smp 6,sockets=1,cores=6,threads=1 \
> -bios /usr/share/qemu/bios.bin -vga none \
> -device ioh3420,bus=pcie.0,addr=1c.0,multifunction=on,port=1,chassis=1,id=root.1
> \
> -device vfio-pci,host=05:00.0,bus=root.1,addr=00.0,multifunction=on,x-vga=on \
> -device vfio-pci,host=05:00.1,bus=root.1,addr=00.1

Looks like you're still trying to create an SDL window since I believe
that's on by default, add -nographic

> 2. With virt-manager I'm able to go a bit further once I add the two ids as
> PCI passthrough devices:
>
> 2.1 I can run a copy of Fedora 18 that loads the open source radeon driver.
> It doesn't seem to be really accelerated though but I suppose it's working
> because when I reset/poweroff the host resets :)

Not good.  This is using the vfio-vga-reset branches?

> However I have the following errors in the log:
>
> * Expecting atombios for cayman GPU
> * Fatal error during GPU init
> * probe of <pci id here> failed with -22

Cayman, is this a Radeon HD 6xxx series?  Are there any messages in the
host log file or dmesg about retrieving the BIOS from the device?

> 2.2 I'm not able to use radeon binary drivers from rpmfusion on this VM. X
> always dies with "No recognized devices"
>
> 2.3 I created a new winxp test machine and installed radeon binary drivers
> on it but the card is not detected. It does appear as "Unrecognized VGA
> adapter" so it seems that it is exposed, at least partially.

libvirt is going to be using 440fx, unless there's a q35 option for it
now.  The older chipset is not tested as well and libvirt will put the
emulated and passthrough graphics on the same bus, which makes things
more difficult.

> I'm a bit out of my wits by now, is there any way to see how virt-manager
> calls qemu?

/var/log/libvirt/qemu/$VM

> Do I have to remove nvidia binary driver or patch them? (the primary gpu is
> a quadro 4000)

Remove or patch them for what?  If you want to assign that device, yes,
the nvidia binary driver needs to be unbound from the device and you
must then use the vfio-vga-reset branches to get the device into a fresh
state to be assigned.  Note that assigning a primary GPU from the host
still has issues with removing the host VGA console from using it.
Thanks,

Alex