From nobody Fri Oct 18 05:16:13 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1694469237; cv=none; d=zohomail.com; s=zohoarc; b=V7OusJIsir2GgXkiS1SyNfBjoZzt+HGo1C2opnPThZUyJQkDmaIxoSuab59N4HsZJD6Y+Hrk9RDQPPyEjlaIpUlwRW2ljDhIxVwgr/B6HGUwOXYCf7lYv8d1ftYKypVudjbMo/+uxyNF2onP99tRA8ivgDE3sWDC+1jI/T0OLBs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1694469237; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=1p62pwciV9LptM3TfxiC97Mzd6pLw662i+neGYHcK/Q=; b=NOEc4lRKYbRJS2M8rO+u+J84CoC3ZhQHgou787hGyxrIB+vDm1xf+1P+dy0YExqlMVlr5wvwdvTT3TLv7vw6cezdVHCGz5oHNKCXxKZ6QwllGDPF3xApKo57mFHRb0LqbV8kBNvDLDUz9w49Tth2N9WS4nB+Ka6TthkwYNekmC4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1694469237574917.3602313137711; Mon, 11 Sep 2023 14:53:57 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-590-xsSPjiEZMlaoKOkdJjT2Hg-1; Mon, 11 Sep 2023 17:53:54 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 93F9529AB404; Mon, 11 Sep 2023 21:53:50 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7DCB40C2064; Mon, 11 Sep 2023 21:53:49 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 7C21E19465A4; Mon, 11 Sep 2023 21:53:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 771491946597 for ; Mon, 11 Sep 2023 21:53:48 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 668EA40C6EBF; Mon, 11 Sep 2023 21:53:48 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.34.54]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4306140C6EA8 for ; Mon, 11 Sep 2023 21:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694469236; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=1p62pwciV9LptM3TfxiC97Mzd6pLw662i+neGYHcK/Q=; b=HduZuJS0mJrA37b9o97+zsCgDm+jChgsUl8QqF+6at1YcwwEVBClN0/3Q9VxckhOeA1C+4 d78I6JtM+1SClmB4DVShGOC2Bv9Up8QpPDeLqtW0eS0Ue8x9Tsni6high/8a1pfWtLTJsb iQGEw+wlQCb1uB/VPU6gihsQ7JlaKnI= X-MC-Unique: xsSPjiEZMlaoKOkdJjT2Hg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH v2 1/5] conf: add ability to configure a vdpa block disk device Date: Mon, 11 Sep 2023 16:53:43 -0500 Message-ID: <20230911215347.1160427-2-jjongsma@redhat.com> In-Reply-To: <20230911215347.1160427-1-jjongsma@redhat.com> References: <20230911215347.1160427-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1694469239551100003 Content-Type: text/plain; charset="utf-8"; x-default="true" vDPA block devices can be configured as follows: Signed-off-by: Jonathon Jongsma --- docs/formatdomain.rst | 19 +++++++++++++++++-- src/ch/ch_monitor.c | 1 + src/conf/domain_conf.c | 8 ++++++++ src/conf/schemas/domaincommon.rng | 13 +++++++++++++ src/conf/storage_source_conf.c | 7 ++++++- src/conf/storage_source_conf.h | 2 ++ src/libxl/xen_xl.c | 1 + src/qemu/qemu_block.c | 6 ++++++ src/qemu/qemu_command.c | 1 + src/qemu/qemu_migration.c | 2 ++ src/qemu/qemu_snapshot.c | 4 ++++ src/qemu/qemu_validate.c | 1 + src/storage_file/storage_source.c | 1 + 13 files changed, 63 insertions(+), 3 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index bc469e5f9f..a65edc6703 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -2678,6 +2678,11 @@ paravirtualized driver is specified via the ``disk``= element. + + + + + ... =20 @@ -2688,8 +2693,9 @@ paravirtualized driver is specified via the ``disk`` = element. ``type`` Valid values are "file", "block", "dir" ( :since:`since 0.7.5` ), "network" ( :since:`since 0.8.7` ), or "volume" ( :since:`since 1.0.= 5` ), - or "nvme" ( :since:`since 6.0.0` ), or "vhostuser" ( :since:`since 7= .1.0` ) - and refer to the underlying source for the disk. :since:`Since 0.0.3` + or "nvme" ( :since:`since 6.0.0` ), or "vhostuser" ( :since:`since 7= .1.0` ), + or "vhostvdpa" ( :since:`since 9.8.0 (QEMU 8.1.0)`) and refer to the + underlying source for the disk. :since:`Since 0.0.3` ``device`` Indicates how the disk is to be exposed to the guest OS. Possible va= lues for this attribute are "floppy", "disk", "cdrom", and "lun", default= ing to @@ -2879,6 +2885,15 @@ paravirtualized driver is specified via the ``disk``= element. ```` XML for this disk type. Additionally features such as blo= ckjobs, incremental backups and snapshots are not supported for this disk ty= pe. =20 + ``vhostvdpa`` + Enables the hypervisor to connect to a vDPA block device. Requires s= hared + memory configured for the VM, for more details see ``access`` mode f= or + ``memoryBacking`` element (See `Memory Backing`_). + + The ``source`` element has a mandatory attribute ``dev`` that specif= ies + the fully-qualified path to the vhost-vdpa character device (e.g. + ``/dev/vhost-vdpa-0``). + With "file", "block", and "volume", one or more optional sub-elements ``seclabel`` (See `Security label`_) can be used to override the domain security labeling policy for just that source file. diff --git a/src/ch/ch_monitor.c b/src/ch/ch_monitor.c index 200ad6c77b..1691a4efb6 100644 --- a/src/ch/ch_monitor.c +++ b/src/ch/ch_monitor.c @@ -197,6 +197,7 @@ virCHMonitorBuildDiskJson(virJSONValue *disks, virDomai= nDiskDef *diskdef) case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_LAST: default: virReportEnumRangeError(virStorageType, diskdef->src->type); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 2c8727de54..1f14ef6f23 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7522,6 +7522,10 @@ virDomainStorageSourceParse(xmlNodePtr node, if (virDomainDiskSourceVHostUserParse(node, src, xmlopt, ctxt) < 0) return -1; break; + case VIR_STORAGE_TYPE_VHOST_VDPA: + if (!(src->vdpadev =3D virXMLPropStringRequired(node, "dev"))) + return -1; + break; case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -22386,6 +22390,10 @@ virDomainDiskSourceFormat(virBuffer *buf, virDomainDiskSourceVhostuserFormat(&attrBuf, &childBuf, src->vhost= user); break; =20 + case VIR_STORAGE_TYPE_VHOST_VDPA: + virBufferEscapeString(&attrBuf, " dev=3D'%s'", src->vdpadev); + break; + case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincom= mon.rng index 2f9ba31c0a..1fe9ccb70e 100644 --- a/src/conf/schemas/domaincommon.rng +++ b/src/conf/schemas/domaincommon.rng @@ -1811,6 +1811,7 @@ + =20 @@ -2381,6 +2382,18 @@ =20 + + + vhostvdpa + + + + + + + + + (ioemu:)?(fd|hd|sd|vd|xvd|ubd)[a-zA-Z0-9_]+<= /param> diff --git a/src/conf/storage_source_conf.c b/src/conf/storage_source_conf.c index dcac3a8ff6..f57cb3241d 100644 --- a/src/conf/storage_source_conf.c +++ b/src/conf/storage_source_conf.c @@ -47,7 +47,8 @@ VIR_ENUM_IMPL(virStorage, "network", "volume", "nvme", - "vhostuser" + "vhostuser", + "vhostvdpa" ); =20 =20 @@ -834,6 +835,7 @@ virStorageSourceCopy(const virStorageSource *src, def->tlsCertdir =3D g_strdup(src->tlsCertdir); def->tlsHostname =3D g_strdup(src->tlsHostname); def->query =3D g_strdup(src->query); + def->vdpadev =3D g_strdup(src->vdpadev); =20 if (src->sliceStorage) def->sliceStorage =3D virStorageSourceSliceCopy(src->sliceStorage); @@ -958,6 +960,7 @@ virStorageSourceIsSameLocation(virStorageSource *a, break; =20 case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_FILE: case VIR_STORAGE_TYPE_BLOCK: @@ -1054,6 +1057,7 @@ virStorageSourceIsLocalStorage(const virStorageSource= *src) * Therefore, we have to return false here. */ case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_LAST: case VIR_STORAGE_TYPE_NONE: return false; @@ -1246,6 +1250,7 @@ virStorageSourceIsRelative(virStorageSource *src) case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: return false; diff --git a/src/conf/storage_source_conf.h b/src/conf/storage_source_conf.h index f13e7c756a..f99579bce2 100644 --- a/src/conf/storage_source_conf.h +++ b/src/conf/storage_source_conf.h @@ -43,6 +43,7 @@ typedef enum { VIR_STORAGE_TYPE_VOLUME, VIR_STORAGE_TYPE_NVME, VIR_STORAGE_TYPE_VHOST_USER, + VIR_STORAGE_TYPE_VHOST_VDPA, =20 VIR_STORAGE_TYPE_LAST } virStorageType; @@ -299,6 +300,7 @@ struct _virStorageSource { char *configFile; /* some storage systems use config file as part of the source definition */ char *query; /* query string for HTTP based protocols */ + char *vdpadev; size_t nhosts; virStorageNetHostDef *hosts; size_t ncookies; diff --git a/src/libxl/xen_xl.c b/src/libxl/xen_xl.c index ab1941454d..f175359307 100644 --- a/src/libxl/xen_xl.c +++ b/src/libxl/xen_xl.c @@ -1525,6 +1525,7 @@ xenFormatXLDiskSrc(virStorageSource *src, char **srcs= tr) case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index dcdf883926..0b4c2dbcf4 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -873,6 +873,11 @@ qemuBlockStorageSourceGetBackendProps(virStorageSource= *src, return NULL; break; =20 + case VIR_STORAGE_TYPE_VHOST_VDPA: + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("vhostvdpa disk type not yet supported")); + return NULL; + case VIR_STORAGE_TYPE_VHOST_USER: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("unable to create blockdev props for vhostuser di= sk type")); @@ -2320,6 +2325,7 @@ qemuBlockStorageSourceCreateGetStorageProps(virStorag= eSource *src, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: return 0; =20 case VIR_STORAGE_TYPE_NONE: diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a912ed064f..778958700b 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1636,6 +1636,7 @@ qemuBuildDriveSourceStr(virDomainDiskDef *disk, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index b209e18dff..801b904a73 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -347,6 +347,7 @@ qemuMigrationDstPrecreateDisk(virConnectPtr *conn, case VIR_STORAGE_TYPE_DIR: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -1618,6 +1619,7 @@ qemuMigrationSrcIsSafe(virDomainDef *def, break; =20 case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_BLOCK: case VIR_STORAGE_TYPE_DIR: diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index ec853686d3..cdc8e12cff 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -446,6 +446,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapsh= otDiskDef *snapdisk, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -464,6 +465,7 @@ qemuSnapshotPrepareDiskExternalInactive(virDomainSnapsh= otDiskDef *snapdisk, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -507,6 +509,7 @@ qemuSnapshotPrepareDiskExternalActive(virDomainSnapshot= DiskDef *snapdisk, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, @@ -668,6 +671,7 @@ qemuSnapshotPrepareDiskInternal(virDomainDiskDef *disk, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: virReportError(VIR_ERR_INTERNAL_ERROR, diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 1346bbfb44..165ab3a66a 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -607,6 +607,7 @@ qemuValidateDomainDefNvram(const virDomainDef *def, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("unsupported nvram disk type '%1$s'"), virStorageTypeToString(src->type)); diff --git a/src/storage_file/storage_source.c b/src/storage_file/storage_s= ource.c index b97bbde619..2cfe3bc325 100644 --- a/src/storage_file/storage_source.c +++ b/src/storage_file/storage_source.c @@ -583,6 +583,7 @@ virStorageSourceUpdatePhysicalSize(virStorageSource *sr= c, case VIR_STORAGE_TYPE_VOLUME: case VIR_STORAGE_TYPE_NVME: case VIR_STORAGE_TYPE_VHOST_USER: + case VIR_STORAGE_TYPE_VHOST_VDPA: case VIR_STORAGE_TYPE_NONE: case VIR_STORAGE_TYPE_LAST: return -1; --=20 2.41.0