qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [QEMU][RFC PATCH 4/6] xen-pci: Register PCI in Xen


From: Stefano Stabellini
Subject: Re: [Qemu-devel] [QEMU][RFC PATCH 4/6] xen-pci: Register PCI in Xen
Date: Fri, 23 Mar 2012 11:02:05 +0000
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)

On Thu, 22 Mar 2012, Anthony Liguori wrote:
> On 03/22/2012 11:01 AM, Julien Grall wrote:
> > QEMU will now register PCI in Xen. It will usefull to forward
> > IO config space to the right QEMU.
> >
> > Before to register a PCI device, QEMU will check with XenStore if it is
> > autorized to register the PCI associate to a given BDF.
> >
> > Signed-off-by: Julien Grall<address@hidden>
> 
> As a general rule, any time you call to XenStore from QEMU, you're doing 
> something wrong.
> 
> You should explicitly launch QEMU with the PCI devices that you want it to 
> have. 
>   If there are platform devices you don't want it to have, then you need to 
> construct a machine that lacks those devices.
> 
> Random hooks in non-Xen code that call into XenStore are always wrong.

Maybe the best thing to do is to have a set of machine specific options
to select what devices need to be built in the machine.
Most devices already can be dynamically selected: NICs, usb, acpi,
cirrus, etc.
We already have a Xen machine (xenfv_machine) that uses pc_init1 to
initialize it.
We could have a simple bitmask to determine what devices need to be
enabled, then in pc_init1 we could have something like:

if (devices & VGA_ENABLE) {
    pc_vga_init();
}

Given the number of enable variable already present in the code
(pci_enabled, acpi_enabled, usb_enabled, xen_enabled,
 cirrus_vga_enabled, ...), it might end up actually making the code more
readable. The flexibility could end up being useful in the generic case
as well, for testing if nothing else.

We would still need to call xc_hvm_register_pcidev to register PCI
devices in Xen, but we wouldn't expect to fail unless there was a
misconfiguration somewhere. In that case we could just exit.



Now the problem is: there isn't a simple way to specify the BDF where
you want to create the device; pci_create_simple takes a devfn but most
of the higher level functions (pc_vga_init, pci_nic_init_nofail, ...)
don't export the parameter at the moment.
We would need to be able to tell pc_vga_init where to create the card,
so we would have to export the devfn as a parameter.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]