From nobody Tue Feb 10 14:49:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1689692034; cv=none; d=zohomail.com; s=zohoarc; b=gfnMeo4/CN3K7sMp4Xd1Lta+PLVkltyuRntVPmw6YLfFjeNuxXG28rAHMm+Fgljw6JPfZ/ZIJPAaoO1OI5LbJIhjU6Do83CpAe2qSQ4AvLMxNAdJ0EdIlAVV9jixqfDWtblAfb2MKyJzhOoYWPgJRXlleooN2rC0dZwbBAY36L8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689692034; 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=MP1pfogPdU95X5rlgVtHYkZD5C6QKi4ydY03AabQMdY=; b=SjZ7T4PQfMc9bgucF5R9cPfLdJbHGvgQkJlDc/e0LExsjpvOBC8jj7i+zBXwWeLTPcVicxR3lvruAORmQxGT63PLLn8kfI3LkHVI2u3Xxhr1PoGgXbNUYrEDMte4CymTf80XX/s+fsyZD7lWMLY3Nhn3gz3KTSyvdibOIZgGVkI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 1689692034573277.64276643813673; Tue, 18 Jul 2023 07:53:54 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-587--U833SOnPye8IwE4mQp-Ew-1; Tue, 18 Jul 2023 10:53:47 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 75DF91831F53; Tue, 18 Jul 2023 14:48:41 +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 1E712200C0C4; Tue, 18 Jul 2023 14:48:40 +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 E1812194658F; Tue, 18 Jul 2023 14:48:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5108E19465A4 for ; Tue, 18 Jul 2023 14:48:27 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id B7C5C492CAC; Tue, 18 Jul 2023 14:48:27 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.32.196]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 70946492B01 for ; Tue, 18 Jul 2023 14:48:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689692033; 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=MP1pfogPdU95X5rlgVtHYkZD5C6QKi4ydY03AabQMdY=; b=U7FlaY8AXCbErbRYW/xI3YpisTPtvXuy8T9kFmXgfkk3yhn96lBD9WHxkkII9uCZHP8DVW p9R/4WsOE0JS8hYe+8+N48yz1k4MttNV/RengR8oHIYXqOeIK5nOEmKTXFmTsIZEULu+lX 1DXdUD3w7R7fMEy3+rM1mk2LDWbukwU= X-MC-Unique: -U833SOnPye8IwE4mQp-Ew-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jonathon Jongsma To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: require memfd memory for virtio 'blob' support Date: Tue, 18 Jul 2023 09:48:26 -0500 Message-ID: <20230718144826.3943030-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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.4 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: 1689692036083100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The virtio-gpu 'blob' support was insufficiently validated. Qemu requires a memfd memory backing in order to use udmabuf and enable blob support. Example error: $ virsh start rhel9 error: Failed to start domain 'rhel9' error: internal error: qemu unexpectedly closed the monitor: 2023-07-18= T02:33:57.083178Z qemu-kvm: -device {"driver":"virtio-vga","id":"video0","m= ax_outputs":1,"blob":true,"bus":"pcie.0","addr":"0x1"}: cannot enable blob = resources without udmabuf Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- src/qemu/qemu_validate.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index 7e09e2c52f..139e6f3d62 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2598,6 +2598,7 @@ qemuValidateDomainDeviceDefHostdev(const virDomainHos= tdevDef *hostdev, =20 static int qemuValidateDomainDeviceDefVideo(const virDomainVideoDef *video, + const virDomainDef *def, virQEMUCaps *qemuCaps) { virDomainCapsDeviceVideo videoCaps =3D { 0 }; @@ -2714,11 +2715,18 @@ qemuValidateDomainDeviceDefVideo(const virDomainVid= eoDef *video, } =20 if (video->type =3D=3D VIR_DOMAIN_VIDEO_TYPE_VIRTIO) { - if (video->blob !=3D VIR_TRISTATE_SWITCH_ABSENT && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_BLOB)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("this QEMU does not support 'blob' for virtio= -gpu devices")); - return -1; + if (video->blob !=3D VIR_TRISTATE_SWITCH_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_GPU_BLOB)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("this QEMU does not support 'blob' for vi= rtio-gpu devices")); + return -1; + } + if (video->blob =3D=3D VIR_TRISTATE_SWITCH_ON + && def->mem.source !=3D VIR_DOMAIN_MEMORY_SOURCE_MEMFD) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'blob' support for virtio-gpu devices re= quires a memfd memory backend")); + return -1; + } } } =20 @@ -5217,7 +5225,7 @@ qemuValidateDomainDeviceDef(const virDomainDeviceDef = *dev, qemuCaps); =20 case VIR_DOMAIN_DEVICE_VIDEO: - return qemuValidateDomainDeviceDefVideo(dev->data.video, qemuCaps); + return qemuValidateDomainDeviceDefVideo(dev->data.video, def, qemu= Caps); =20 case VIR_DOMAIN_DEVICE_DISK: return qemuValidateDomainDeviceDefDisk(dev->data.disk, def, qemuCa= ps); --=20 2.41.0