From nobody Mon Feb 9 19:52:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1570829286; cv=none; d=zoho.com; s=zohoarc; b=UK1F7iJypAuYEXq8LCP6E+PXYpz1I99nOuc744fdDUlNLZRW3HTL9Cvtgoyb1yxInRzsH4Br8OTzVAaZo9JZFjuOXYqttZwHjsMRsK6hYPaE9k/I8uze1hrTkWCb7Neea2nLzRa+HbSdPY3ko1mV3I3J9ccH/Y8ijqeVKxfpC34= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570829286; h=Content-Type:Content-Transfer-Encoding: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=camRJ9PXziS+dAEHFnaQlu7Q/AL6nYIZsOd6lJmxar8=; b=BRCYKyl4FbGen47zNKpFb+m7lgfv7wbDuT6t1Y4qFddgNXcnVgdAQ0siWhLfOdfueAdmEhqFE5pSMk/EQG+zQ7Ew1x+YdkzXMxbcYqUkrng+LixajCOYFjFJ3Q/w5tsi8vs6piYl/aGrZWe/mydXDEeYney0rqDkHJNOcv/iTQc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 157082928618178.41957040849786; Fri, 11 Oct 2019 14:28:06 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id A724980F83; Fri, 11 Oct 2019 21:28:04 +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 7DC46601A3; Fri, 11 Oct 2019 21:28:04 +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 4060A180B536; Fri, 11 Oct 2019 21:28:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9BLRxK6007312 for ; Fri, 11 Oct 2019 17:27:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8DB26031D; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) Received: from himantopus.redhat.com (ovpn-118-45.phx2.redhat.com [10.3.118.45]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AE667600CC; Fri, 11 Oct 2019 21:27:59 +0000 (UTC) From: Jonathon Jongsma To: libvir-list@redhat.com Date: Fri, 11 Oct 2019 16:27:52 -0500 Message-Id: <20191011212752.27139-7-jjongsma@redhat.com> In-Reply-To: <20191011212752.27139-1-jjongsma@redhat.com> References: <20191011212752.27139-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 6/6] qemu: add 'ramfb' attribute for mediated devices 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 11 Oct 2019 21:28:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The 'ramfb' attribute provides a framebuffer to the guest that can be used as a boot display for the vgpu For example, the following configuration can be used to provide a vgpu with a boot display:
Signed-off-by: Jonathon Jongsma --- docs/formatdomain.html.in | 8 ++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 11 ++++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 17 ++++++++- ...tdev-mdev-display-ramfb.x86_64-latest.args | 37 +++++++++++++++++++ .../hostdev-mdev-display-ramfb.xml | 33 +++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 8 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_6= 4-latest.args create mode 100644 tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 7ec57135f6..81e8cafe87 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4846,6 +4846,14 @@ graphical framebuffer in order= to use this attribute, currently only supported with VNC, Spice and egl-headless graphics devices. + + Since version 5.9.0, there is an op= tional + ramfb attribute for devices with + model=3D'vfio-pci'. Supported values are either + on or off (default is 'off'). When + enabled, this attribute provides a memory framebuffer device to = the + guest. This framebuffer will be used as a boot display when a v= gpu + device is the primary display.

Note: There are also some implications on the usage of guest's address type depending on the model attribute, diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index ead5a25068..57e0dcf6ed 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -4769,6 +4769,11 @@ vfio-ap + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c1705a07b6..d6cf2132d7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8161,6 +8161,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, VIR_AUTOFREE(char *) backendStr =3D NULL; VIR_AUTOFREE(char *) model =3D NULL; VIR_AUTOFREE(char *) display =3D NULL; + VIR_AUTOFREE(char *) ramfb =3D NULL; =20 /* @managed can be read from the xml document - it is always an * attribute of the toplevel element, no matter what type of @@ -8176,6 +8177,7 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, rawio =3D virXMLPropString(node, "rawio"); model =3D virXMLPropString(node, "model"); display =3D virXMLPropString(node, "display"); + ramfb =3D virXMLPropString(node, "ramfb"); =20 /* @type is passed in from the caller rather than read from the * xml document, because it is specified in different places for @@ -8284,6 +8286,15 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, display); return -1; } + + if (ramfb && + (mdevsrc->ramfb =3D virTristateSwitchTypeFromString(ramfb)) <= =3D 0) { + virReportError(VIR_ERR_XML_ERROR, + _("unknown value '%s' for attribute " + "'ramfb'"), + ramfb); + return -1; + } } =20 switch (def->source.subsys.type) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index b7ae57aa9d..c73034b5a7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -262,6 +262,7 @@ struct _virDomainHostdevSubsysMediatedDev { int model; /* enum virMediatedDeviceModelType= */ int display; /* virTristateSwitch */ char uuidstr[VIR_UUID_STRING_BUFLEN]; /* mediated device's uuid stri= ng */ + int ramfb; /* virTristateSwitch */ }; =20 typedef enum { diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 50cc3bdf7c..049a5b54d9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5417,6 +5417,17 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, return virBufferContentAndReset(&buf); } =20 +static const char * +qemuBuildHostdevMdevModelTypeString(virDomainHostdevSubsysMediatedDevPtr m= dev) +{ + /* when the 'ramfb' attribute is set, we must use the nohotplug variant + * rather than 'vfio-pci' */ + if (mdev->model =3D=3D VIR_MDEV_MODEL_TYPE_VFIO_PCI && + mdev->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON) + return "vfio-pci-nohotplug"; + + return virMediatedDeviceModelTypeToString(mdev->model); +} =20 char * qemuBuildHostdevMediatedDevStr(const virDomainDef *def, @@ -5431,7 +5442,7 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *de= f, if (!(mdevPath =3D virMediatedDeviceGetSysfsPath(mdevsrc->uuidstr))) return NULL; =20 - dev_str =3D virMediatedDeviceModelTypeToString(mdevsrc->model); + dev_str =3D qemuBuildHostdevMdevModelTypeString(mdevsrc); =20 if (!dev_str) return NULL; @@ -5449,6 +5460,10 @@ qemuBuildHostdevMediatedDevStr(const virDomainDef *d= ef, if (dev->info->bootIndex) virBufferAsprintf(&buf, ",bootindex=3D%u", dev->info->bootIndex); =20 + if (mdevsrc->ramfb =3D=3D VIR_TRISTATE_SWITCH_ON) + virBufferAsprintf(&buf, ",ramfb=3D%s", + virTristateSwitchTypeToString(mdevsrc->ramfb)); + if (virBufferCheckError(&buf) < 0) return NULL; =20 diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-lates= t.args b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-latest.ar= gs new file mode 100644 index 0000000000..30d2f83318 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.x86_64-latest.args @@ -0,0 +1,37 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest2 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest2/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name guest=3DQEMUGuest2,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-no-acpi \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-vnc 127.0.0.1:0 \ +-device qxl-vga,id=3Dvideo0,ram_size=3D67108864,vram_size=3D67108864,\ +vram64_size_mb=3D0,vgamem_mb=3D16,max_outputs=3D1,bus=3Dpci.0,addr=3D0x2 \ +-device vfio-pci-nohotplug,id=3Dhostdev0,\ +sysfsdev=3D/sys/bus/mdev/devices/53764d0e-85a0-42b4-af5c-2046b460b1dc,disp= lay=3Don,\ +bus=3Dpci.0,addr=3D0x3,ramfb=3Don \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml b/tests/= qemuxml2argvdata/hostdev-mdev-display-ramfb.xml new file mode 100644 index 0000000000..2e7851b2b0 --- /dev/null +++ b/tests/qemuxml2argvdata/hostdev-mdev-display-ramfb.xml @@ -0,0 +1,33 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219136 + 219136 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + + +

+ + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 834a289532..cd51754260 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -1638,6 +1638,7 @@ mymain(void) DO_TEST_PARSE_ERROR("hostdev-mdev-display-missing-graphics", QEMU_CAPS_DEVICE_VFIO_PCI, QEMU_CAPS_VFIO_PCI_DISPLAY); + DO_TEST_CAPS_LATEST("hostdev-mdev-display-ramfb"); DO_TEST_PARSE_ERROR("hostdev-vfio-zpci-wrong-arch", QEMU_CAPS_DEVICE_VFIO_PCI); DO_TEST("hostdev-vfio-zpci", --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list