From nobody Mon Feb 9 10:27:23 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=1630937211; cv=none; d=zohomail.com; s=zohoarc; b=T3nuR3hTHQyf3I7f37t35kBQOS6pzaquiNwQihRdGQZAlIz/JjtJfPrLxPVS0V4LLbg3MlXaJVeKyvhtYocpvL/PCobNOkVodZxdewyq3PPRFQW1BUyAYYmjWXelr4+IUOqqqCed17Zv8o0OYcF9ld7tAFCvex22XKw14JC5XBg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630937211; 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=8jggdD51Gt6FbMAjbcmY+6lZwsWZtA9PwdCdFS9VWtU=; b=f9UX/dJUzrpgAHF8WMpyQ6uVUOsYwh+hCEqbIVK8cNt5p2W9EKRnyTUFuCoieQp/mG6CXu/15qYC85dMbWT70ZbYuz8uqtQcwOFtlAg2jqUjw0InfPc0IvyJCbKF3tQmX1ihlq+lGQU0wBuU+WmUjIM37kgzk2zfYg1oTbyVr8Y= 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 1630937211419682.2188543436342; Mon, 6 Sep 2021 07:06:51 -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-301-evQZg_aePzaJ4ChqXoo-vQ-1; Mon, 06 Sep 2021 10:06:48 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E340F5134; Mon, 6 Sep 2021 14:06:43 +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 C68EE6B541; Mon, 6 Sep 2021 14:06:43 +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 9A1F7180B44F; Mon, 6 Sep 2021 14:06:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 186E6diw031508 for ; Mon, 6 Sep 2021 10:06:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id AE51C5D9F4; Mon, 6 Sep 2021 14:06:39 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-13-25.pek2.redhat.com [10.72.13.25]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB7BC5D9DE; Mon, 6 Sep 2021 14:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630937210; 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=8jggdD51Gt6FbMAjbcmY+6lZwsWZtA9PwdCdFS9VWtU=; b=VVxiWJb1aVX/SNmMkzOX0bAkwpr1F4f3cpjBe1eWDmOYDhsJxJSv9L2V+FGDvXy+f5ICFb 5YD5WuWjV2AP2fBSHkfozcfvpULMJvVwfvI6hlWn1nI8hrFUtSX/uKqgnw1ETS7XdlFAD1 DqAo2+m95QhvKtkIJTgofMRoFw83T8k= X-MC-Unique: evQZg_aePzaJ4ChqXoo-vQ-1 From: Han Han To: libvir-list@redhat.com Subject: [PATCH 2/3] conf: Add page_per_vq for driver element Date: Mon, 6 Sep 2021 22:06:05 +0800 Message-Id: <20210906140606.3846921-3-hhan@redhat.com> In-Reply-To: <20210906140606.3846921-1-hhan@redhat.com> References: <20210906140606.3846921-1-hhan@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Han Han , gavi@nvidia.com 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.15 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: 1630937213135100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Han Han --- 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 | 7 +++++++ 5 files changed, 38 insertions(+) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 479a3acfbb..961676ac6b 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -3546,6 +3546,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` +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 11fa24f398..fb97364e15 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -6789,6 +6789,11 @@ + + + + + =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6127513117..1abfe29dd9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1629,6 +1629,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 @@ -6311,6 +6315,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 @@ -20699,6 +20707,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 c7e6df7981..e21683a71f 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2725,6 +2725,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 60f7ccdddd..f22f952464 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -134,6 +134,13 @@ 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