Skip to content

Commit

Permalink
libxl: introduce 'libxl_pci_bdf' in the idl...
Browse files Browse the repository at this point in the history
... and use in 'libxl_device_pci'

This patch is preparatory work for restricting the type passed to functions
that only require BDF information, rather than passing a 'libxl_device_pci'
structure which is only partially filled. In this patch only the minimal
mechanical changes necessary to deal with the structural changes are made.
Subsequent patches will adjust the code to make better use of the new type.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Wei Liu <wl@xen.org>
Acked-by: Nick Rosbrook <rosbrookn@ainfosec.com>
  • Loading branch information
Paul Durrant authored and liuw committed Dec 15, 2020
1 parent 8bc342b commit 929f231
Show file tree
Hide file tree
Showing 10 changed files with 167 additions and 117 deletions.
77 changes: 55 additions & 22 deletions tools/golang/xenlight/helpers.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions tools/golang/xenlight/types.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions tools/include/libxl.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,12 @@
*/
#define LIBXL_HAVE_DEVICE_PCI_ASSIGNABLE_LIST_FREE 1

/*
* LIBXL_HAVE_PCI_BDF indicates that the 'libxl_pci_bdf' type is defined
* is embedded in the 'libxl_device_pci' type.
*/
#define LIBXL_HAVE_PCI_BDF 1

/*
* libxl ABI compatibility
*
Expand Down
8 changes: 4 additions & 4 deletions tools/libs/light/libxl_dm.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,10 @@ int libxl__domain_device_construct_rdm(libxl__gc *gc,
for (i = 0; i < d_config->num_pcidevs; i++) {
unsigned int n, nr_entries;

seg = d_config->pcidevs[i].domain;
bus = d_config->pcidevs[i].bus;
devfn = PCI_DEVFN(d_config->pcidevs[i].dev,
d_config->pcidevs[i].func);
seg = d_config->pcidevs[i].bdf.domain;
bus = d_config->pcidevs[i].bdf.bus;
devfn = PCI_DEVFN(d_config->pcidevs[i].bdf.dev,
d_config->pcidevs[i].bdf.func);
nr_entries = 0;
rc = libxl__xc_device_get_rdm(gc, 0,
seg, bus, devfn, &nr_entries, &xrdm);
Expand Down
3 changes: 2 additions & 1 deletion tools/libs/light/libxl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4746,10 +4746,11 @@ void libxl__xcinfo2xlinfo(libxl_ctx *ctx,
* devices have same identifier. */
#define COMPARE_DEVID(a, b) ((a)->devid == (b)->devid)
#define COMPARE_DISK(a, b) (!strcmp((a)->vdev, (b)->vdev))
#define COMPARE_PCI(a, b) ((a)->domain == (b)->domain && \
#define COMPARE_BDF(a, b) ((a)->domain == (b)->domain && \
(a)->bus == (b)->bus && \
(a)->dev == (b)->dev && \
(a)->func == (b)->func)
#define COMPARE_PCI(a, b) COMPARE_BDF(&((a)->bdf), &((b)->bdf))
#define COMPARE_USB(a, b) ((a)->ctrl == (b)->ctrl && \
(a)->port == (b)->port)
#define COMPARE_USBCTRL(a, b) ((a)->devid == (b)->devid)
Expand Down

0 comments on commit 929f231

Please sign in to comment.