[libvirt PATCH 2/4] nodedev: support auto-start property for mdevs
Michal Prívozník
mprivozn at redhat.com
Wed May 19 08:46:25 UTC 2021
On 5/14/21 11:28 PM, Jonathon Jongsma wrote:
> From: Boris Fiuczynski <fiuczy at linux.ibm.com>
>
> This adds a new element to the mdev capabilities xml schema that
> represents the start policy for a defined mediated device. The actual
> auto-start functionality is handled behind the scenes by mdevctl, but it
> wasn't yet hooked up in libvirt.
>
> Signed-off-by: Boris Fiuczynski <fiuczy at linux.ibm.com>
> Signed-off-by: Jonathon Jongsma <jjongsma at redhat.com>
> ---
> docs/formatnode.html.in | 10 ++++++++++
> docs/schemas/nodedev.rng | 11 ++++++++++
> src/conf/node_device_conf.c | 20 ++++++++++++++++++-
> src/conf/node_device_conf.h | 12 +++++++++++
> src/libvirt_private.syms | 2 ++
> src/node_device/node_device_driver.c | 7 ++++++-
> .../mdevctl-list-multiple.out.xml | 4 ++++
> ...v_3627463d_b7f0_4fea_b468_f1da537d301b.xml | 1 +
> ...v_ee0b88c4_f554_4dc1_809d_b2a01e8e48ad.xml | 1 +
> 9 files changed, 66 insertions(+), 2 deletions(-)
>
> diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
> index a60562e4fe..1a31133c4c 100644
> --- a/src/conf/node_device_conf.h
> +++ b/src/conf/node_device_conf.h
> @@ -124,6 +124,17 @@ typedef enum {
>
> VIR_ENUM_DECL(virNodeDevDRM);
>
> +typedef enum {
> + /* Keep in sync with VIR_ENUM_IMPL in node_device_conf.c */
I know you copied this from pre-existing code, but it shouldn't be there
either. If this enum ever changes and corresponding VIR_ENUM_IMPL() is
not updated, compiler throws an error. I admit it's very well hidden,
but if you look at VIR_ENUM_IMPL() macro definition in
src/util/virenum.h at the very end of it is a G_STATIC_ASSERT() which
ensures that VIR_ENUM_IMPL() has as many items as the value of _LAST.
> + VIR_NODE_DEV_MDEV_START_MANUAL,
> + VIR_NODE_DEV_MDEV_START_AUTO,
> +
> + VIR_NODE_DEV_MDEV_START_LAST
> +} virNodeDevMdevStartType;
> +
> +VIR_ENUM_DECL(virNodeDevMdevStart);
> +
> +
> typedef struct _virNodeDevCapSystemHardware virNodeDevCapSystemHardware;
> struct _virNodeDevCapSystemHardware {
> char *vendor_name;
> @@ -151,6 +162,7 @@ struct _virNodeDevCapMdev {
> char *type;
> unsigned int iommuGroupNumber;
> char *uuid;
> + virNodeDevMdevStartType start;
> virMediatedDeviceAttr **attributes;
> size_t nattributes;
> };
Michal
More information about the libvir-list
mailing list