From nobody Fri Oct 18 06:25:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1718290252865254.8985702423571; Thu, 13 Jun 2024 07:50:52 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 9A2681126; Thu, 13 Jun 2024 10:50:51 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 31888E3E; Thu, 13 Jun 2024 10:50:30 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 02F73CB3; Thu, 13 Jun 2024 10:50:28 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 6C5A8CBC for ; Thu, 13 Jun 2024 10:50:24 -0400 (EDT) Received: from mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-144-1rTqgo1oMQaEfudL3gwWbQ-1; Thu, 13 Jun 2024 10:50:22 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id CE2EC19560AB for ; Thu, 13 Jun 2024 14:50:21 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.22.9.138]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 56A461955E82 for ; Thu, 13 Jun 2024 14:50:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: *** X-Spam-Status: No, score=3.0 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718290224; h=from:from: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; bh=6bv9aWw+QzrezuD2l8IBB1U/f2S3ltng8H4Cnv6CXZg=; b=ACXqhuJoD3PWBAyH2LpYausLN53MRIe9gLySNMqeJiWAdPWdwSxfBSwHnuZKqfux19Yylb 0lb9T10mAzrGyOIwHW8ZNZkkbHDTsOz71WJ4Li5wImQahkK0/FQwzqlVxos+/cJ4Mcm6/V l0KV+69RVUyJ7gLq8ZvNow4zxyXHK5w= X-MC-Unique: 1rTqgo1oMQaEfudL3gwWbQ-1 From: Jonathon Jongsma To: devel@lists.libvirt.org Subject: [PATCH] qemu: Don't specify vfio-pci.ramfb when ramfb is false Date: Thu, 13 Jun 2024 09:50:19 -0500 Message-ID: <20240613145019.733121-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 5ESJUAFS43Y5XVDXQMRW7RPMGIXSWGYD X-Message-ID-Hash: 5ESJUAFS43Y5XVDXQMRW7RPMGIXSWGYD X-MailFrom: jjongsma@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1718290254204100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Commit 7c8e606b64c73ca56d7134cb16d01257f39c53ef attempted to fix the specification of the ramfb property for vfio-pci devices, but it failed when ramfb is explicitly set to 'off'. This is because only the 'vfio-pci-nohotplug' device supports the 'ramfb' property. Since we use the base 'vfio-pci' device unless ramfb is enabled, attempting to set the 'ramfb' parameter to 'off' this will result in an error like the following: error: internal error: QEMU unexpectedly closed the monitor (vm=3D'rhel'): 2024-06-06T04:43:22.896795Z qemu-kvm: -device {"driver":"vfio-pci","host":"0000:b1:00.4","id":"hostdev0","display":"on ","ramfb":false,"bus":"pci.7","addr":"0x0"}: Property 'vfio-pci.ramfb' not found. This also more closely matches what is done for mdev devices. Resolves: https://issues.redhat.com/browse/RHEL-28808 Signed-off-by: Jonathon Jongsma Reviewed-by: Michal Privoznik --- src/qemu/qemu_command.c | 6 ++++-- .../hostdev-pci-display-ramfb.x86_64-latest.args | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 2d0eddc79e..1e9de6460e 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4760,12 +4760,14 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, g_autofree char *host =3D virPCIDeviceAddressAsString(&pcisrc->addr); const char *failover_pair_id =3D NULL; const char *driver =3D NULL; + /* 'ramfb' property must be omitted unless it's to be enabled */ + bool ramfb =3D pcisrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON; =20 /* caller has to assign proper passthrough driver name */ switch (pcisrc->driver.name) { case VIR_DEVICE_HOSTDEV_PCI_DRIVER_NAME_VFIO: /* ramfb support requires the nohotplug variant */ - if (pcisrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON) + if (ramfb) driver =3D "vfio-pci-nohotplug"; else driver =3D "vfio-pci"; @@ -4798,7 +4800,7 @@ qemuBuildPCIHostdevDevProps(const virDomainDef *def, "p:bootindex", dev->info->effectiveBootIndex, "S:failover_pair_id", failover_pair_id, "S:display", qemuOnOffAuto(pcisrc->display), - "T:ramfb", pcisrc->ramfb, + "B:ramfb", ramfb, NULL) < 0) return NULL; =20 diff --git a/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.= args b/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args index e6e538ef1c..a681504c3d 100644 --- a/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args +++ b/tests/qemuxmlconfdata/hostdev-pci-display-ramfb.x86_64-latest.args @@ -29,6 +29,6 @@ XDG_CONFIG_HOME=3D/var/lib/libvirt/qemu/domain--1-QEMUGue= st2/.config \ -audiodev '{"id":"audio1","driver":"none"}' \ -vnc 127.0.0.1:0,audiodev=3Daudio1 \ -device '{"driver":"vfio-pci-nohotplug","host":"0000:06:12.5","id":"hostde= v0","display":"on","ramfb":true,"bus":"pci.0","addr":"0x2"}' \ --device '{"driver":"vfio-pci","host":"0000:06:13.6","id":"hostdev1","displ= ay":"off","ramfb":false,"bus":"pci.0","addr":"0x3"}' \ +-device '{"driver":"vfio-pci","host":"0000:06:13.6","id":"hostdev1","displ= ay":"off","bus":"pci.0","addr":"0x3"}' \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,resource= control=3Ddeny \ -msg timestamp=3Don --=20 2.45.1