Skip to content

Commit

Permalink
Revert patches that break libxl API
Browse files Browse the repository at this point in the history
This patch reverts eight patches from staging.

The offending patch is the one that introduced libxl_pci_bdf (last one
in the list). The rest depend on that patch so they are also reverted.

8bf0fab "libxl / libxlu: support 'xl pci-attach/detach' by name"
e114165 "docs/man: modify xl-pci-configuration(5) to add 'name' field to PCI_SPEC_STRING"
93c16ae "xl: support naming of assignable devices"
5ab684c "libxl: introduce libxl_pci_bdf_assignable_add/remove/list/list_free(), ..."
66c2fbc "libxl: convert internal functions in libxl_pci.c..."
f73c5dd "docs/man: modify xl(1) in preparation for naming of assignable devices"
96ed6ff "libxlu: introduce xlu_pci_parse_spec_string()"
929f231 "libxl: introduce 'libxl_pci_bdf' in the idl..."

Signed-off-by: Wei Liu <wl@xen.org>
  • Loading branch information
liuw committed Dec 16, 2020
1 parent 5a324e1 commit ac6a0af
Show file tree
Hide file tree
Showing 15 changed files with 431 additions and 799 deletions.
25 changes: 2 additions & 23 deletions docs/man/xl-pci-configuration.5.pod
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ is not specified, or if it is specified with an empty value (whether
positionally or explicitly).

B<NOTE>: In context of B<xl pci-detach> (see L<xl(1)>), parameters other than
B<bdf> or B<name> will be ignored.
B<bdf> will be ignored.

=head1 Positional Parameters

Expand All @@ -70,11 +70,7 @@ B<*> to indicate all functions of a multi-function device.

=item Default Value

None. This parameter is mandatory in its positional form. As a non-positional
parameter it is also mandatory unless a B<name> parameter is present, in
which case B<bdf> must not be present since the B<name> will be used to find
the B<bdf> in the list of assignable devices. See L<xl(1)> for more information
on naming assignable devices.
None. This parameter is mandatory as it identifies the device.

=back

Expand Down Expand Up @@ -198,21 +194,4 @@ B<NOTE>: This overrides the global B<rdm> option.

=back

=item B<name>=I<STRING>

=over 4

=item Description

This is the name given when the B<BDF> was made assignable. See L<xl(1)> for
more information on naming assignable devices.

=item Default Value

None. This parameter must not be present if a B<bdf> parameter is present.
If a B<bdf> parameter is not present then B<name> is mandatory as it is
required to look up the B<BDF> in the list of assignable devices.

=back

=back
19 changes: 7 additions & 12 deletions docs/man/xl.1.pod.in
Original file line number Diff line number Diff line change
Expand Up @@ -1595,23 +1595,19 @@ List virtual network interfaces for a domain.

=over 4

=item B<pci-assignable-list> [I<-n>]
=item B<pci-assignable-list>

List all the B<BDF> of assignable PCI devices. See
L<xl-pci-configuration(5)> for more information. If the -n option is
specified then any name supplied when the device was made assignable
will also be displayed.
L<xl-pci-configuration(5)> for more information.

These are devices in the system which are configured to be
available for passthrough and are bound to a suitable PCI
backend driver in domain 0 rather than a real driver.

=item B<pci-assignable-add> [I<-n NAME>] I<BDF>
=item B<pci-assignable-add> I<BDF>

Make the device at B<BDF> assignable to guests. See
L<xl-pci-configuration(5)> for more information. If the -n option is
supplied then the assignable device entry will the named with the
given B<NAME>.
L<xl-pci-configuration(5)> for more information.

This will bind the device to the pciback driver and assign it to the
"quarantine domain". If it is already bound to a driver, it will
Expand All @@ -1626,11 +1622,10 @@ not to do this on a device critical to domain 0's operation, such as
storage controllers, network interfaces, or GPUs that are currently
being used.

=item B<pci-assignable-remove> [I<-r>] I<BDF>|I<NAME>
=item B<pci-assignable-remove> [I<-r>] I<BDF>

Make a device non-assignable to guests. The device may be identified
either by its B<BDF> or the B<NAME> supplied when the device was made
assignable. See L<xl-pci-configuration(5)> for more information.
Make the device at B<BDF> not assignable to guests. See
L<xl-pci-configuration(5)> for more information.

This will at least unbind the device from pciback, and
re-assign it from the "quarantine domain" back to domain 0. If the -r
Expand Down
77 changes: 22 additions & 55 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: 2 additions & 6 deletions tools/golang/xenlight/types.gen.go

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

48 changes: 7 additions & 41 deletions tools/include/libxl.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,25 +463,6 @@
*/
#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_HAVE_PCI_ASSIGNABLE_BDF indicates that the
* libxl_pci_bdf_assignable_add/remove/list/list_free() functions all
* exist.
*/
#define LIBXL_HAVE_PCI_ASSIGNABLE_BDF 1

/*
* LIBXL_HAVE_DEVICE_PCI_NAME indicates that the 'name' field of
* libxl_device_pci is defined.
*/
#define LIBXL_HAVE_DEVICE_PCI_NAME 1

/*
* libxl ABI compatibility
*
Expand Down Expand Up @@ -2370,9 +2351,9 @@ int libxl_device_events_handler(libxl_ctx *ctx,
LIBXL_EXTERNAL_CALLERS_ONLY;

/*
* Functions related to making PCI devices with the specified BDF
* assignable -- that is, bound to the pciback driver, ready to be given to
* a guest via libxl_pci_device_add.
* Functions related to making devices assignable -- that is, bound to
* the pciback driver, ready to be given to a guest via
* libxl_pci_device_add.
*
* - ..._add() will unbind the device from its current driver (if
* already bound) and re-bind it to pciback; at that point it will be
Expand All @@ -2384,31 +2365,16 @@ int libxl_device_events_handler(libxl_ctx *ctx,
* rebind is non-zero, attempt to assign it back to the driver
* from whence it came.
*
* - ..._list() will return a list of the PCI BDFs available to be
* - ..._list() will return a list of the PCI devices available to be
* assigned.
*
* add and remove are idempotent: if the device in question is already
* added or is not bound, the functions will emit a warning but return
* SUCCESS.
*/
int libxl_pci_bdf_assignable_add(libxl_ctx *ctx, libxl_pci_bdf *pcibdf,
const char *name, int rebind);
int libxl_pci_bdf_assignable_remove(libxl_ctx *ctx, libxl_pci_bdf *pcibdf,
int rebind);
libxl_pci_bdf *libxl_pci_bdf_assignable_list(libxl_ctx *ctx, int *num);
void libxl_pci_bdf_assignable_list_free(libxl_pci_bdf *list, int num);
libxl_pci_bdf *libxl_pci_bdf_assignable_name2bdf(libxl_ctx *ctx,
const char *name);
char *libxl_pci_bdf_assignable_bdf2name(libxl_ctx *ctx,
libxl_pci_bdf *pcibdf);

/* Compatibility functions - Use libxl_pci_bdf_assignable_* instead */
int libxl_device_pci_assignable_add(libxl_ctx *ctx, libxl_device_pci *pci,
int rebind);
int libxl_device_pci_assignable_remove(libxl_ctx *ctx, libxl_device_pci *pci,
int rebind);
libxl_device_pci *libxl_device_pci_assignable_list(libxl_ctx *ctx,
int *num);
int libxl_device_pci_assignable_add(libxl_ctx *ctx, libxl_device_pci *pci, int rebind);
int libxl_device_pci_assignable_remove(libxl_ctx *ctx, libxl_device_pci *pci, int rebind);
libxl_device_pci *libxl_device_pci_assignable_list(libxl_ctx *ctx, int *num);
void libxl_device_pci_assignable_list_free(libxl_device_pci *list, int num);

/* CPUID handling */
Expand Down
8 changes: 1 addition & 7 deletions tools/include/libxlutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,10 @@ int xlu_disk_parse(XLU_Config *cfg, int nspecs, const char *const *specs,
* resulting disk struct is used with libxl.
*/

/*
* PCI BDF
*/
int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_pci_bdf *bdf, const char *str);

/*
* PCI specification parsing
*/
int xlu_pci_parse_spec_string(XLU_Config *cfg, libxl_device_pci *pci,
const char *str);
int xlu_pci_parse_bdf(XLU_Config *cfg, libxl_device_pci *pcidev, const char *str);

/*
* RDM parsing
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].bdf.domain;
bus = d_config->pcidevs[i].bdf.bus;
devfn = PCI_DEVFN(d_config->pcidevs[i].bdf.dev,
d_config->pcidevs[i].bdf.func);
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);
nr_entries = 0;
rc = libxl__xc_device_get_rdm(gc, 0,
seg, bus, devfn, &nr_entries, &xrdm);
Expand Down
3 changes: 1 addition & 2 deletions tools/libs/light/libxl_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -4746,11 +4746,10 @@ 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_BDF(a, b) ((a)->domain == (b)->domain && \
#define COMPARE_PCI(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 ac6a0af

Please sign in to comment.