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

Re: [libvirt] [PATCH 02/16] conf: Introduce new hostdev device type mdev



On 06.02.2017 13:19, Erik Skultety wrote:
> A mediated device will be identified by the host PCI address of the
> parent physical device which is backing the given mediated device, and a
> UUID of the user pre-created mediated device. The data necessary to
> identify a mediated device can be easily extended in the future, once we
> need to enable managed='yes' in which case a hint from the upper
> management layer about which mediated device type (e.g. vGPU type)
> should an instance be created on.
> 
> Signed-off-by: Erik Skultety <eskultet redhat com>
> ---
>  src/conf/domain_conf.c              |  7 ++++++-
>  src/conf/domain_conf.h              | 10 ++++++++++
>  src/qemu/qemu_cgroup.c              |  5 +++++
>  src/qemu/qemu_domain.c              |  1 +
>  src/qemu/qemu_hotplug.c             |  2 ++
>  src/security/security_apparmor.c    |  3 +++
>  src/security/security_dac.c         |  2 ++
>  src/security/security_selinux.c     |  2 ++
>  tests/domaincapsschemadata/full.xml |  1 +
>  9 files changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index c06b128..38ffc95 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -649,7 +649,8 @@ VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST,
>                "usb",
>                "pci",
>                "scsi",
> -              "scsi_host")
> +              "scsi_host",
> +              "mdev")
>  
>  VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend,
>                VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST,
> @@ -6453,6 +6454,8 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node,
>          if (virDomainHostdevSubsysSCSIVHostDefParseXML(sourcenode, def) < 0)
>              goto error;
>          break;
> +    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
> +        break;
>  
>      default:
>          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> @@ -13281,6 +13284,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr xmlopt,
>              }
>              break;
>          case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB:
> +        case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
>          case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
>              break;
>          }
> @@ -14172,6 +14176,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
>              return 1;
>          else
>              return 0;
> +    case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
>      case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
>          return 0;
>      }
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 507ace8..3a1009a 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -54,6 +54,7 @@
>  # include "virgic.h"
>  # include "virperf.h"
>  # include "virtypedparam.h"
> +# include "virpci.h"
>  
>  /* forward declarations of all device types, required by
>   * virDomainDeviceDef
> @@ -295,6 +296,7 @@ typedef enum {
>      VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI,
>      VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI,
>      VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST,
> +    VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV,
>  
>      VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST
>  } virDomainHostdevSubsysType;
> @@ -369,6 +371,13 @@ struct _virDomainHostdevSubsysSCSI {
>      } u;
>  };
>  
> +typedef struct _virDomainHostdevSubsysMediatedDev virDomainHostdevSubsysMediatedDev;
> +typedef virDomainHostdevSubsysMediatedDev *virDomainHostdevSubsysMediatedDevPtr;
> +struct _virDomainHostdevSubsysMediatedDev {
> +    virPCIDeviceAddress addr;               /* parent device's host address */
> +    char uuidstr[VIR_UUID_STRING_BUFLEN];   /* mediated device's uuid string */

Either this or VIR_UUID_BUFLEN for storing UUID in raw format, which is
what we typically do. But I don't care that much.

> +};
> +

Michal


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