]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: add support for 'edid' attribute to video model
authorMark Cave-Ayland <mark.caveayland@nutanix.com>
Thu, 7 Aug 2025 11:05:09 +0000 (12:05 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Thu, 14 Aug 2025 10:47:05 +0000 (12:47 +0200)
Add the ability to enable/disable exposing the EDID information to the guest.
The edid attribute can specified in the domain XML as below:

    <video>
        <model type='virtio' edid='off'/>
    </video>

If the edid attribute is unspecified, it is not generated so that the
virtualisation platform will continue to use its default.

The edid attribute is only valid for the vga, boch and virtio display models
and is currently only implemented for the QEMU driver.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
docs/formatdomain.rst
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/domain_validate.c
src/conf/schemas/domaincommon.rng
src/qemu/qemu_command.c

index d3c04d8b2aa97299d277e0d1b4d89b9d79c9d108..9f7311b6d5590c9a3b779769cb93b696ae9ba479 100644 (file)
@@ -7110,6 +7110,14 @@ A video device.
    sub-element is valid for model types "vga", "qxl", "bochs", "gop",
    and "virtio".
 
+   :since:`Since 11.7.0` (QEMU driver only), the ``model`` element may have an
+   optional ``edid`` attribute that can be set to ``on`` or ``off``. If the
+   ``edid`` attribute is not specified then the device will use its default value.
+   Otherwise setting ``edid`` to ``on`` will expose the device EDID blob to the
+   guest, whilst setting it to ``off`` will hide the device EDID blob from the
+   guest. The ``edid`` attribute is only valid for model types ``vga``, ``bochs``,
+   and ``virtio``.
+
 ``acceleration``
    Configure if video acceleration should be enabled.
 
index cb096f2e1ed956ba1143c1f2eac6496d95255a38..7766e302ec7c3b17a5ec39f655ace76e0b45ccfe 100644 (file)
@@ -13547,6 +13547,9 @@ virDomainVideoModelDefParseXML(virDomainVideoDef *def,
     if (virXMLPropTristateSwitch(node, "blob", VIR_XML_PROP_NONE, &def->blob) < 0)
         return -1;
 
+    if (virXMLPropTristateSwitch(node, "edid", VIR_XML_PROP_NONE, &def->edid) < 0)
+        return -1;
+
     return 0;
 }
 
@@ -21051,6 +21054,14 @@ virDomainVideoDefCheckABIStability(virDomainVideoDef *src,
         }
     }
 
+    if (src->edid != dst->edid) {
+        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                       _("Target video card edid %1$s does not match source %2$s"),
+                       virTristateSwitchTypeToString(dst->type),
+                       virTristateSwitchTypeToString(src->type));
+        return false;
+    }
+
     if (!virDomainVirtioOptionsCheckABIStability(src->virtio, dst->virtio))
         return false;
 
@@ -26657,6 +26668,8 @@ virDomainVideoDefFormat(virBuffer *buf,
         virBufferAddLit(buf, " primary='yes'");
     if (def->blob != VIR_TRISTATE_SWITCH_ABSENT)
         virBufferAsprintf(buf, " blob='%s'", virTristateSwitchTypeToString(def->blob));
+    if (def->edid != VIR_TRISTATE_SWITCH_ABSENT)
+        virBufferAsprintf(buf, " edid='%s'", virTristateSwitchTypeToString(def->edid));
     if (def->accel || def->res) {
         virBufferAddLit(buf, ">\n");
         virBufferAdjustIndent(buf, 2);
index 984e5bfc7651fbbf1e11e5a9e3cafe4c2a606e23..eca820892ec9533517597962930ffc7a8b2397c5 100644 (file)
@@ -1895,6 +1895,7 @@ struct _virDomainVideoDef {
     virDomainDeviceInfo info;
     virDomainVirtioOptions *virtio;
     virDomainVideoBackendType backend;
+    virTristateSwitch edid;
 };
 
 /* graphics console modes */
index 40edecef8377e6c385d8401dfbcb2b6d5d4a9b86..60a2e46b7ec09f10e74a40e1a94179fe75a1d68a 100644 (file)
@@ -231,6 +231,17 @@ virDomainVideoDefValidate(const virDomainVideoDef *video,
         }
     }
 
+    if ((video->type != VIR_DOMAIN_VIDEO_TYPE_BOCHS) &&
+        (video->type != VIR_DOMAIN_VIDEO_TYPE_VGA) &&
+        (video->type != VIR_DOMAIN_VIDEO_TYPE_VIRTIO)) {
+            if (video->edid != VIR_TRISTATE_SWITCH_ABSENT) {
+                virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
+                               _("video type '%1$s' does not support edid"),
+                               virDomainVideoTypeToString(video->type));
+                return -1;
+            }
+    }
+
     return 0;
 }
 
index 9782dca1476ddf94005a90b8c14174f7a91d4cef..e369fb6e81c647959a14ae5792c0cf014b21ed3a 100644 (file)
                 <ref name="virOnOff"/>
               </attribute>
             </optional>
+            <optional>
+              <attribute name="edid">
+                <ref name="virOnOff"/>
+              </attribute>
+            </optional>
             <optional>
               <element name="acceleration">
                 <optional>
index 4e4f1e87ebbc1ee9f2acae1ecd8495b67164ecf4..e8de386f30fc417250e9c571f8827602e2eca08b 100644 (file)
@@ -4739,6 +4739,9 @@ qemuBuildDeviceVideoCmd(virCommand *cmd,
             return -1;
     }
 
+    if (virJSONValueObjectAdd(&props, "T:edid", video->edid, NULL) < 0)
+        return -1;
+
     if (video->res) {
         if (virJSONValueObjectAdd(&props,
                                   "p:xres", video->res->x,