From nobody Mon Feb 9 04:14:11 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1634278212; cv=none; d=zohomail.com; s=zohoarc; b=GiUMJKZXcP0aGPzPtsoG6/ktXledYTDwRB1HG+EjBmn7jJLCDVBDnzCGTKkXG4z5pptTgZ8nbRHsGyez4T+r5tK6u2h4IcTJNgsmbfclJWLezgXk8Apn5xlj7SrkUp5CtchgbwiCVcM6VTyp4Xxt9A4pkuFx0LKyOfNZq63pAH8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1634278212; h=Content-Type:Content-Transfer-Encoding:Cc: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=UanWBJhiQjB66gY/izdrDCiIIV2cA7leDQaEVNrKzEw=; b=gZlzF4iuQHSRPhyuYqmKGY2ILlyKMBvUYNvb4Knrz68LbLT0n5PE9XpPE4BccK+MVoDYLf5K+3fl3os6d0tvW/bhsM9XRDNGl4XroBwf4uBZ4eNM11XKcpdpZh76g4iXZMat4wMS2mT7ts08n95uMnDvwssAThz4mFk7HOsaUto= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1634278212790836.5383453991192; Thu, 14 Oct 2021 23:10:12 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-401-OiH8Y7OeN9SUQ7r18-2dzA-1; Fri, 15 Oct 2021 02:10:10 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 83C348042A5; Fri, 15 Oct 2021 06:10:05 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0158C60583; Fri, 15 Oct 2021 06:10:05 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A032F1819AC1; Fri, 15 Oct 2021 06:10:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 19F69fXl013897 for ; Fri, 15 Oct 2021 02:09:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1E175B8540; Fri, 15 Oct 2021 06:09:41 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-13-70.pek2.redhat.com [10.72.13.70]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9EBAD5C1BB; Fri, 15 Oct 2021 06:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634278211; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=UanWBJhiQjB66gY/izdrDCiIIV2cA7leDQaEVNrKzEw=; b=RNtAsLqhewfydBUfjPgAq1DRtQyNLv0elG4O1QHSZ+5KkHRpLMZa90Hiq39422psii8Tuv O4k9jNGy7ijLWCunPtx2sPV8QKqW/aN7lWiKodmCAPwAE82ecy4r1V1ynPLDcTS4b8RKfm HIBB4FOWpzXY0qQOkQvI37lyFqKLEpw= X-MC-Unique: OiH8Y7OeN9SUQ7r18-2dzA-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH v3 1/2] conf: Add page_per_vq for driver element Date: Fri, 15 Oct 2021 14:09:29 +0800 Message-Id: <20211015060930.1163897-2-hhan@redhat.com> In-Reply-To: <20211015060930.1163897-1-hhan@redhat.com> References: <20211015060930.1163897-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Han Han , Gavi Teitz X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com 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: 1634278213740100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Han Han Signed-off-by: Gavi Teitz --- docs/formatdomain.rst | 9 +++++++++ docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 16 ++++++++++++++++ src/conf/domain_conf.h | 1 + src/conf/domain_validate.c | 6 ++++++ 5 files changed, 37 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 80aaf4b033..9bf59936e5 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3577,6 +3577,15 @@ virtqueues are actually used depends on the feature = negotiation between QEMU, vhost backends and guest drivers. Possible values are ``on`` or ``off``. :since:`Since 6.3.0 (QEMU and KVM only)` =20 +This optional attribute ``page_per_vq`` controls the layout of the notific= ation +capabilities exposed to the guest. When enabled, each virtio queue will ha= ve a +dedicated page on the device BAR exposed to the guest. It is recommended t= o be +used when vDPA is enabled on the hypervisor, as it enables mapping the +notification area to the physical device, which is only supported in page +granularity. The default is determined by QEMU. :since:`Since 7.8.0 (QEMU = 2.8)` +Note: In general you should leave this option alone, unless you are very c= ertain +you know what you are doing. + :anchor:`` =20 Virtio transitional devices diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 6f33d1e774..26990c4d6d 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6825,6 +6825,11 @@ + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 818c177e72..6fcf86ba58 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1636,6 +1636,10 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver, &(*virtio)->packed) < 0) return -1; =20 + if (virXMLPropTristateSwitch(driver, "page_per_vq", VIR_XML_PROP_NONE, + &(*virtio)->page_per_vq) < 0) + return -1; + return 0; } =20 @@ -6321,6 +6325,10 @@ virDomainVirtioOptionsFormat(virBuffer *buf, virBufferAsprintf(buf, " packed=3D'%s'", virTristateSwitchTypeToString(virtio->packed)); } + if (virtio->page_per_vq !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, " page_per_vq=3D'%s'", + virTristateSwitchTypeToString(virtio->page_per_v= q)); + } } =20 =20 @@ -20816,6 +20824,14 @@ virDomainVirtioOptionsCheckABIStability(virDomainV= irtioOptions *src, virTristateSwitchTypeToString(src->packed)); return false; } + if (src->page_per_vq !=3D dst->page_per_vq) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device page_per_vq option '%s' does not " + "match source '%s'"), + virTristateSwitchTypeToString(dst->page_per_vq), + virTristateSwitchTypeToString(src->page_per_vq)); + return false; + } return true; } =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e9a9298d86..1ac802feca 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2740,6 +2740,7 @@ struct _virDomainVirtioOptions { virTristateSwitch iommu; virTristateSwitch ats; virTristateSwitch packed; + virTristateSwitch page_per_vq; }; =20 =20 diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index f023d22f23..80401cf8c7 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -135,6 +135,12 @@ virDomainCheckVirtioOptionsAreAbsent(virDomainVirtioOp= tions *virtio) "for virtio devices")); return -1; } + + if (virtio->page_per_vq !=3D VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("page_per_vq option is only supported for virtio = devices")); + return -1; + } return 0; } =20 --=20 2.31.1