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

Re: [Xen-devel] [PATCH 6/7] libxl_qmp, Introduce libxl__qmp_pci_add.



On Fri, Oct 7, 2011 at 13:43, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote:
> On Fri, 2011-10-07 at 13:10 +0100, Anthony PERARD wrote:
>> This function insert a PCI passthrough device in qemu.
>>
>> Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
>> ---
>> Âtools/libxl/libxl_internal.h | Â Â2 +
>> Âtools/libxl/libxl_qmp.c   Â|  89 
>> ++++++++++++++++++++++++++++++++++++++++++
>> Â2 files changed, 91 insertions(+), 0 deletions(-)
>>
>> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
>> index 4dd0f91..78e1be2 100644
>> --- a/tools/libxl/libxl_internal.h
>> +++ b/tools/libxl/libxl_internal.h
>> @@ -119,6 +119,7 @@ typedef struct {
>> Â} libxl__device;
>>
>> Â#define XC_PCI_BDF Â Â Â Â Â Â "0x%x, 0x%x, 0x%x, 0x%x"
>> +#define PCI_DEVFN(slot, func) Â ((((slot) & 0x1f) << 3) | ((func) & 0x07))
>
> No need to include the domain or dev in this? The name is pretty weird
> if you don't include the dev portion. ÂLooks like this is actually a
> vdevfn? xl has an open coded instance of this pattern for that -- worth
> adding a public macro?

I have actual copy the macro from qemu, and I think "slot === dev". I
think the macro come from linux/pci.h.
But yes, I use it to store the vdevfn.

> FWIW pcidev_encode_bdf() exists which encodes the whole lot from a
> libxl_device_pci, if that what you end up needing.

If the vdefvn should contain the virtual bus and domain number, so
yes, that will be the function I need.

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.