From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v2 4/4] libxl: Add interface for querying hypervisor about PCI topology Date: Mon, 19 Jan 2015 17:32:39 +0000 Message-ID: <1421688759.10440.176.camel@citrix.com> References: <1420510737-22813-1-git-send-email-boris.ostrovsky@oracle.com> <1420510737-22813-5-git-send-email-boris.ostrovsky@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1420510737-22813-5-git-send-email-boris.ostrovsky@oracle.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Boris Ostrovsky Cc: keir@xen.org, ufimtseva@gmail.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, dario.faggioli@citrix.com, ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, chegger@amazon.com, jbeulich@suse.com, wei.liu2@citrix.com, Roger Pau Monne List-Id: xen-devel@lists.xenproject.org On Mon, 2015-01-05 at 21:18 -0500, Boris Ostrovsky wrote: > tools/libxl/libxl_freebsd.c | 12 +++++++ > tools/libxl/libxl_netbsd.c | 12 +++++++ These are stubs, CCing some relevant folks to see if they would like to provide an implementation. > diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c > index cd87614..888f068 100644 > --- a/tools/libxl/libxl.c > +++ b/tools/libxl/libxl.c > @@ -5121,6 +5121,64 @@ libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nb_cpu_out) > return ret; > } > > +libxl_pcitopology *libxl_get_pci_topology(libxl_ctx *ctx, int *num_devs) > +{ > + GC_INIT(ctx); > + xc_pcitopoinfo_t tinfo; > + DECLARE_HYPERCALL_BUFFER(xen_sysctl_pcitopo_t, pcitopo); > + libxl_pcitopology *ret = NULL; > + int i, rc; > + > + tinfo.num_devs = libxl__pci_numdevs(gc); > + if (tinfo.num_devs <= 0) { > + LIBXL__LOG(ctx, XTL_ERROR, "Unable to determine number of PCI devices"); Please use the shorter LOG*() macros, which will avoid long lines and some wrapping. > diff --git a/tools/libxl/libxl.h b/tools/libxl/libxl.h > index 0a123f1..eb83f0a 100644 > --- a/tools/libxl/libxl.h > +++ b/tools/libxl/libxl.h > @@ -1070,6 +1070,10 @@ void libxl_vminfo_list_free(libxl_vminfo *list, int nb_vm); > libxl_cputopology *libxl_get_cpu_topology(libxl_ctx *ctx, int *nb_cpu_out); > void libxl_cputopology_list_free(libxl_cputopology *, int nb_cpu); > > +#define LIBXL_PCITOPOLOGY_INVALID_ENTRY (~(uint32_t)0) > +libxl_pcitopology *libxl_get_pci_topology(libxl_ctx *ctx, int *num_dev); > +void libxl_pcitopology_list_free(libxl_pcitopology *, int num_dev); Needs a #define LIBXL_HAVE_FOO #define to advertise the new functionality. > diff --git a/tools/libxl/libxl_linux.c b/tools/libxl/libxl_linux.c > index ea5d8c1..07428c0 100644 > --- a/tools/libxl/libxl_linux.c > +++ b/tools/libxl/libxl_linux.c > @@ -279,3 +279,74 @@ libxl_device_model_version libxl__default_device_model(libxl__gc *gc) > { > return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN; > } > + > +/* These two routines are "inspired" by pciutils */ "inspired" in a licensing consistent way? Nothing else above the comments made by others. Ian.