From nobody Tue Feb 10 14:49:51 2026 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=1651266273; cv=none; d=zohomail.com; s=zohoarc; b=ghgq/Gw6CKTadm8xzjUE44KW7EyzlsbkZ9RYGBsm6ngZVi5d867I2DmJ03fIetQ+KPI5IjsHwpOrBUQzni7gJtJpy5JAnbqgZuVyAgyf5YtlkVRYZ+RoX2wdgiLCxyNWROoj75bDMNx0YSjapaVC0TxO3D2gW13cLwLQo5QGkTI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1651266273; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=xo6afaX1dCFisLeoM2l4pswu2JREQDMC7mXHi0pLHYs=; b=LDDFpg+oK9DuAFvjSig4Qigv5QaGuVnmXZVCiF3R8DEUPItxxYGmsQYrwLQ462espCRbbPBjEDZ0Ez2xHJmls/83qkFJbajv7QjOpuIZzinyHGugxDGGP4cqQFzY8qunZi6Wc2eHtWGFnQdTnR7exb4RTvxZx5jzoj3fygpcD2E= 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 1651266273958115.49583468222352; Fri, 29 Apr 2022 14:04:33 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.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-540-f-pW6QBANk65ffRksyDy6w-1; Fri, 29 Apr 2022 17:04:29 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 808083811A3D; Fri, 29 Apr 2022 21:04:26 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5587D111E3FB; Fri, 29 Apr 2022 21:04:23 +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 06AD6194704D; Fri, 29 Apr 2022 21:04:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id EC1A6194704B for ; Fri, 29 Apr 2022 21:04:21 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id C2097407E1C1; Fri, 29 Apr 2022 21:04:21 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.18.107]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 988B3407E1C0 for ; Fri, 29 Apr 2022 21:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651266273; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xo6afaX1dCFisLeoM2l4pswu2JREQDMC7mXHi0pLHYs=; b=YiPm3aXbYXbkf4Lay3xRR0C66hTUeUFndzLEskPFvDktnC1Hm/9iYTZU3bNKLbLEeBcgop 659PP/Ig+uaXUXcP32/wC998N1AmWZhM+xxLH0Hw2MMkGHqcCFfOVZkcvCgSWIKALYdzw3 yV3GDuPyRIlIWzeqv1OmmIwrjISyL/8= X-MC-Unique: f-pW6QBANk65ffRksyDy6w-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH] conf: ensure only one vgpu has ramfb enabled Date: Fri, 29 Apr 2022 16:04:21 -0500 Message-Id: <20220429210421.1553949-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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 2.78 on 10.11.54.3 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: 1651266274940100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Validate the domain configuration to ensure that if there are more than one vgpu assigned to a domain, only one of them has 'ramfb' enabled. This was never a supported configuration. QEMU failed confusingly when attempting to start a domain with this configuration. This change attempts to provide better information about the error. https://bugzilla.redhat.com/show_bug.cgi?id=3D2079760 Signed-off-by: Jonathon Jongsma Reviewed-by: Martin Kletzander --- src/conf/domain_validate.c | 19 ++++++++-- ...v-display-ramfb-multiple.x86_64-latest.err | 1 + .../hostdev-mdev-display-ramfb-multiple.xml | 38 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multi= ple.x86_64-latest.err create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multi= ple.xml diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index 68190fc3e2..f4d6e6e0c5 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -1194,20 +1194,33 @@ virDomainDefDuplicateDiskInfoValidate(const virDoma= inDef *def) } =20 static int -virDomainDefDuplicateHostdevInfoValidate(const virDomainDef *def) +virDomainDefHostdevValidate(const virDomainDef *def) { size_t i; size_t j; + bool ramfbEnabled =3D false; =20 for (i =3D 0; i < def->nhostdevs; i++) { + virDomainHostdevDef *dev =3D def->hostdevs[i]; + for (j =3D i + 1; j < def->nhostdevs; j++) { - if (virDomainHostdevMatch(def->hostdevs[i], + if (virDomainHostdevMatch(dev, def->hostdevs[j])) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Hostdev already exists in the domain configuration"= )); return -1; } } + + if (dev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_= MDEV && + dev->source.subsys.u.mdev.ramfb =3D=3D VIR_TRISTATE_SWITCH_ON)= { + if (ramfbEnabled) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only one vgpu device can have 'ramfb' en= abled")); + return -1; + } + ramfbEnabled =3D true; + } } =20 return 0; @@ -1664,7 +1677,7 @@ virDomainDefValidateInternal(const virDomainDef *def, if (virDomainDefDuplicateDiskInfoValidate(def) < 0) return -1; =20 - if (virDomainDefDuplicateHostdevInfoValidate(def) < 0) + if (virDomainDefHostdevValidate(def) < 0) return -1; =20 if (virDomainDefDuplicateDriveAddressesValidate(def) < 0) diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple.x86= _64-latest.err b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple= .x86_64-latest.err new file mode 100644 index 0000000000..07ce47abf7 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple.x86_64-lat= est.err @@ -0,0 +1 @@ +unsupported configuration: Only one vgpu device can have 'ramfb' enabled diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple.xml= b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple.xml new file mode 100644 index 0000000000..1fe53726b5 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb-multiple.xml @@ -0,0 +1,38 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + + + + + + + + +
+ + + + +
+ + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 41fd032f19..e334c59eb7 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1896,6 +1896,7 @@ mymain(void) QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VFIO_PCI_DISPLAY); DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb"); + DO_TEST_CAPS_LATEST_PARSE_ERROR("hostdev-mdev-display-ramfb-multiple"); DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-vfio-zpci", --=20 2.35.1