From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543489; cv=none; d=zohomail.com; s=zohoarc; b=JV8FvGmcihmEaqRZPFySsgmsslSx22uiRAUSmHmIp+T5ylQ5d23coEbQ+N7mazwJzQ8AkgvZ+KTxvqtupBmaw2BLAIXHusTnx/U22sT9XETLNf6CocqzVhUIanx6JTWyD1o9z94kN8GnaJCd2mRCVXYKRrvKM/2MvCHjBQk/9tg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543489; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=aPSDtc80QxBay9GHhGU8jyIiLkLfb59Aeoc3NEAiIBw=; b=hQRue8IFV/xP5o836ZUKOd6daaj5DnUKfQa6VKZ5SPtzRCOknPNgKKEh3NCJDR7dsF/LcCqMX+Koqjnbe5S0Zf2Q632eAQCN96YJSvoRyYEPrg0sHYLo8QGXp8s6ydxwhDji0FTDJk3Ie8EbeBFlcXzCJkQTIOqeSITlHj5Nmkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543489974585.7686206123989; Fri, 31 Jul 2026 17:18:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379719.1624134 (Exim 4.92) (envelope-from ) id 1wpxQF-0000ym-Tu; Sat, 01 Aug 2026 00:17:51 +0000 Received: by outflank-mailman (output) from mailman id 1379719.1624134; Sat, 01 Aug 2026 00:17:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQF-0000xZ-PV; Sat, 01 Aug 2026 00:17:51 +0000 Received: by outflank-mailman (input) for mailman id 1379719; Sat, 01 Aug 2026 00:17:50 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQE-0000rr-3E for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:50 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQD-00AjZN-Cv for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:49 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3a84-e002-0a2a0a5209dd-0a2a4501e7a8-40 for ; Sat, 01 Aug 2026 02:17:48 +0200 Received: from [98.137.68.206] (helo=sonic304-25.consmr.mail.gq1.yahoo.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b2b-5984-0a2a45010019-628944ce9cb4-3 for ; Sat, 01 Aug 2026 02:17:48 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:46 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:41 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543466; bh=aPSDtc80QxBay9GHhGU8jyIiLkLfb59Aeoc3NEAiIBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=odcmwXJKuXz0mR8QwvIHWS5CWZdlP4zmZcTbRTSPwnxtghiNAD6/TQex0uG1kZ6c87VlVa0VXjbadj8/iDFtpe6am+9BQCY6jN5mUEMv3s50T+5AhJWeLNjG1hZWpM0D7iYXuYsKvJkdVmMAejowRt3d2fAi/cRXbJC5B5AliX8vVu4fnumhfjXsP4Nk+/MxQwJaf1gchf77Pv+ncoOpGJD5hyhuIs7sy8pF7dkl6zZs9gNwEzz90cd3udKQxc/uZNP5sh7ONYhA/JqjTV0a0qESReB/8TRfHGLNu7msiJotCM9HBwgALv/mWip+ppAN6SfwFMkBhvNID11aZQ6M8A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785543466; bh=g9vcxOFW9WO8GJRAE0inlaJ0qmxWPRXJTYNL6abXrOx=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=agPsYFLa4qHJiBe2k21l+dYlmkBwUxm3cth0vIKcnMgRADMnduqqybndvN3sbVV7rTsnaakIBjTg0ZH9f3DXHi3JwzXl7yVQrCGq2O6q4dJfr+K2cAaZEnY3nk4+47osWt8xfWk3xIH36lr6iJHMQcQPzaq7IvgSLioTr6eOoX3rZ4d7T4godBmJiaR4RxARMWDUMxbxqc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kvb16bXNx3NXs1mo6HOsWSp_ZYzWewn5cSXdf50o20QUEbNo 9_.BJhAXVrhI7cZtuhb9AC7IZNGx_X7.4zButAgEFLzVBnbpR.vj7lAvssDPohKsN11N2QmnSTsM YafAcaGuu0cYUoCZDC2OJstesALPInKyJwTG7QAxyzuK738Spt_zuXmk.KWA_fCCy6DasO2AxkUt wVNIXxvJbrp9bqROng.XPyyY3NFhkqLhPWlcEJ0L4B5p0l2HhEhcdrcyMt4TveGUKcS44WoJMDsF dfJ.VpvUc1CxkAX5_aHBtYgrRrhs_CJ_m3Y77ESLdUzBlOwFc X-Sonic-MF: X-Sonic-ID: 19268ac6-fb05-4394-9e7e-926ddebd28c2 From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 1/6] xen/igd: get PCH info from host sysfs Date: Fri, 31 Jul 2026 20:17:25 -0400 Message-ID: <20260801001737.16509-2-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 5698 X-purgate-ID: tlsNG-d62444/1785543468-BDC79757-73620B74/0/0 X-purgate-type: clean X-purgate-size: 5851 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543491880158500 Content-Type: text/plain; charset="utf-8" The igd_combo_id_infos[] data is out of date with many devices missing from igd_combo_id_infos[]. For newer devices not in igd_combo_id_infos[], get the infos from the host sysfs. If logging is configured, print log messages displaying the PCH info used for the guest. Introduce helper function xen_pt_get_host_pch_info() to facilitate getting the necessary information from sysfs. Treat failure to get the host PCH device id as an unrecoverable error that causes guest creation to fail. If access to the host PCH device revision id fails, print a warning message and use a default value of 0x1 in that case. Also, use errp in xen_igd_passthrough_isa_bridge_create() to set errors from xen_pt_get_host_pch_info() and cleanup on error path with xen_host_pci_device_put(&s->real_device) and object_unparent(OBJECT(&d->rom)) for errors when creating creating the IGD PCH bridge. Add cleanup with object_unparent(OBJECT(&d->rom)) for errors when setting up VGA BIOS for GFX passthrough. Signed-off-by: Chuck Zmudzinski --- Changes in v4: - re-wrote xen_pt_get_host_pch_info() using functions from xen-host-pci-device.h - add more error handling to clean up better after if errors occur - don't consider failure to get the PCH device revision id a fatal error but instead print a warning message and use a default value of 0x1 hw/xen/xen_pt.c | 10 +++++++++- hw/xen/xen_pt_graphics.c | 39 +++++++++++++++++++++++++++++++++++++-- include/hw/xen/xen_igd.h | 3 ++- 3 files changed, 48 insertions(+), 4 deletions(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 0fe9c0a..c8f08b5 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -862,12 +862,20 @@ static void xen_pt_realize(PCIDevice *d, Error **errp) if (*errp) { error_append_hint(errp, "Setup VGA BIOS of passthrough" " GFX failed"); + object_unparent(OBJECT(&d->rom)); xen_host_pci_device_put(&s->real_device); return; } =20 /* Register ISA bridge for passthrough GFX. */ - xen_igd_passthrough_isa_bridge_create(s, &s->real_device); + xen_igd_passthrough_isa_bridge_create(s, &s->real_device, errp); + if (*errp) { + error_append_hint(errp, "Failed to create PCH bridge" + " for passthrough GFX"); + object_unparent(OBJECT(&d->rom)); + xen_host_pci_device_put(&s->real_device); + return; + } } =20 /* Handle real device's MMIO/PIO BARs */ diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index 7df9344..b37f9b7 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -2,6 +2,7 @@ * graphics passthrough */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qapi/error.h" #include "hw/xen/xen_pt.h" #include "hw/xen/xen_igd.h" @@ -376,8 +377,33 @@ static void pt_graphics_register_types(void) } type_init(pt_graphics_register_types) =20 +static void xen_pt_get_host_pch_info(uint16_t *pch_dev_id, uint8_t *pch_re= v_id, + Error **errp) +{ + g_autofree XenHostPCIDevice *pch_dev =3D g_new(XenHostPCIDevice, 1); + + xen_host_pci_device_get(pch_dev, 0, 0, 0x1f, 0, errp); + if (*errp) { + goto error; + } + + *pch_dev_id =3D pch_dev->device_id; + + if (xen_host_pci_get_byte(pch_dev, PCI_REVISION_ID, pch_rev_id)) { + *pch_rev_id =3D 0x1; + warn_report("failed to get host PCH revision for Intel IGD, settin= g it to 0x1"); + } + + xen_host_pci_device_put(pch_dev); + return; + +error: + error_append_hint(errp, "failed to get host PCH device for Intel IGD"); +} + void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, - XenHostPCIDevice *dev) + XenHostPCIDevice *dev, + Error **errp) { PCIBus *bus =3D pci_get_bus(&s->dev); struct PCIDevice *bridge_dev; @@ -394,7 +420,16 @@ void xen_igd_passthrough_isa_bridge_create(XenPCIPasst= hroughState *s, } } =20 + /* Newer devices get PCH infos from host sysfs */ + if ((pch_dev_id =3D=3D 0xffff) || !pch_rev_id) { + xen_pt_get_host_pch_info(&pch_dev_id, &pch_rev_id, errp); + } + + XEN_PT_LOG(&s->dev, "PCH device id: 0x%x\n", pch_dev_id); + XEN_PT_LOG(&s->dev, "PCH revision: 0x%x\n", pch_rev_id); + if (pch_dev_id =3D=3D 0xffff) { + error_setg(errp, "failed to get PCH device id"); return; } =20 @@ -406,7 +441,7 @@ void xen_igd_passthrough_isa_bridge_create(XenPCIPassth= roughState *s, * Note that vendor id is always PCI_VENDOR_ID_INTEL. */ if (!bridge_dev) { - fprintf(stderr, "set igd-passthrough-isa-bridge failed!\n"); + error_setg(errp, "set igd-passthrough-isa-bridge failed!"); return; } pci_config_set_device_id(bridge_dev->config, pch_dev_id); diff --git a/include/hw/xen/xen_igd.h b/include/hw/xen/xen_igd.h index 7ffca06..da51f09 100644 --- a/include/hw/xen/xen_igd.h +++ b/include/hw/xen/xen_igd.h @@ -22,7 +22,8 @@ uint32_t igd_read_opregion(XenPCIPassthroughState *s); void xen_igd_reserve_slot(PCIBus *pci_bus); void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val); void xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, - XenHostPCIDevice *dev); + XenHostPCIDevice *dev, + Error **errp); =20 static inline bool is_igd_vga_passthrough(XenHostPCIDevice *dev) { --=20 2.52.0 From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543494; cv=none; d=zohomail.com; s=zohoarc; b=WxWFsS3jZv7qDmcb0t9xRaO6HfpPAulYYTNJd2vEJHMaN602C1or4ZVS2rKfsws/ZsfiCQYs0dKvzPf+qEX05rcAx6E14FbIPn9w7+c5nUQTmZZRSIaqtssVSGHOIFaMnueJA/cHAaxxv1g09UUT6DyuGtb4pOx13kg4+MIfBb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543494; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=e+hFrPKjm/qktFvrEGDQAvmP2RXLyh9VDR7iL4Z1uvE=; b=MXzwSKviMY91v/2vdiFOvNsx1zNh/Uf9T0ikpRaSFXRFusay4QHjO3m3+QeQ87WSuMuii92GzhSkCfFzpMsaIf0yEE0bixQSzCAnDxrGMP52gFv+84y5u+krASz1A8xmubo1CXw2LlR8c+Uf0jlPqwNhO7NTFVjVcB9qn1DLHDg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543494852331.30273134222864; Fri, 31 Jul 2026 17:18:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379721.1624156 (Exim 4.92) (envelope-from ) id 1wpxQH-0001XR-Hr; Sat, 01 Aug 2026 00:17:53 +0000 Received: by outflank-mailman (output) from mailman id 1379721.1624156; Sat, 01 Aug 2026 00:17:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQH-0001XK-EH; Sat, 01 Aug 2026 00:17:53 +0000 Received: by outflank-mailman (input) for mailman id 1379721; Sat, 01 Aug 2026 00:17:52 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQF-0000ut-Ts for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:51 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQE-00FX1B-Pu for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:50 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3ada-2eae-0a2a0a5409dd-0a2a450bdfc6-30 for ; Sat, 01 Aug 2026 02:17:50 +0200 Received: from [98.137.65.31] (helo=sonic315-55.consmr.mail.gq1.yahoo.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b2c-b7e8-0a2a450b0019-6289411f9269-3 for ; Sat, 01 Aug 2026 02:17:50 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:48 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:42 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543468; bh=e+hFrPKjm/qktFvrEGDQAvmP2RXLyh9VDR7iL4Z1uvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=YTkrELbZWKdR6MlF3on4FPg7soY/Dc92529AE8IAES+R9eHjMSTIQtUmJV53clCHzIxdW1PBg8jCqy/IkNylsIIMjLLgzJhXKYTzoaafStyZThLBKnOc8WILBxLgWjCp/Yqx0e9Fv4xFldUN+8xYuFOfh2zU1bVivDxgPZ5JkLm9Zv/pWJiw9TbHdqja/TFS0frXbaJbCmrYiJjfaw/R5PW+0Dr9aqLa38J3PvIslk6IFXq+f+nn8jR4MuSMj7sk3joDSqxLF9bUfgJjVV1qzCtugdHqfjN4PwxmLwBrEzhB7Wu4sJPL9HaQp+n2gCV29kv/W3J1uBsL8QGI4tSTfg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo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KdZ.wBJQ7ZQrNy 6wr9lEG331x_kBpL53uFTLpyZQeHXSuPDw6T6zfa5QOKNDlCLWlH7KQwwa3MPWTPJZdTnYc.eVnm pP21mfpuMizuG7gn9bSpkPGT7paL_bvbR9wpnq4ZUrMUOLcqelltsLL47gIkR9aklUNRvQP9QHR8 3Inud10EKm1qS5AewB1nL7KgR0LPKtnQPV6Wp7lIkUlFrvzDwn4850jA_E3Rp5BMB1aM5ahXlURX yoZv1hv1UqKFhqV18f2KLSzP1uFWC1UfzycfhPkNrk6_uq27bBbcE4zrMKrXqeCICMqGFkVdZzOv RZiE_Wjwmux3REQgiXSqzwubTOixMLdlhrJgutvA_utRTRed6VZvTY08df0PauK4V4IiSLSmrf7. peCrAcEVTPs0TI9pwUfr4rBx0kiD2PVeEf_La2_810yj3yjJ7JV1k1Zr.UoD629GBTWokb7IIIZg LJ_qLeyMWKHtUdwM.kIzlX02aKzPpeJBPcBWML9iyo6oLAMBDCsmWGNL2_UUJhRQdHpB.j6fvYpq 0050.U8NXXacnZfDFs3sVPNZ0QnTYgCPPQVLT7kl9xAMe99VpMQ-- X-Sonic-MF: X-Sonic-ID: e5ab0868-b2cf-4cbb-9ca7-34935d8b786d From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 2/6] xen/igd: don't register rom bar twice Date: Fri, 31 Jul 2026 20:17:26 -0400 Message-ID: <20260801001737.16509-3-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 1266 X-purgate-ID: tlsNG-42698a/1785543470-1BAD09EA-624BBA8F/0/0 X-purgate-type: clean X-purgate-size: 1305 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543495523158500 Content-Type: text/plain; charset="utf-8" This also fixes a failed assertion in pci [1] for Qemu version 10 and higher when passing through an Intel IGD with an option ROM to the guest. [1] f6fc01c78666 ("hw/pci: Assert a bar is not registered multiple times") Fixes: 881213f1b9c5 ("xen, gfx passthrough: retrieve VGA BIOS to work") Signed-off-by: Chuck Zmudzinski --- Changes in v4: - Use 12 digits for commit hashes hw/xen/xen_pt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index c8f08b5..4d159a2 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -459,6 +459,7 @@ static int xen_pt_register_regions(XenPCIPassthroughSta= te *s, uint16_t *cmd) { int i =3D 0; XenHostPCIDevice *d =3D &s->real_device; + const pcibus_t romsize =3D s->dev.io_regions[PCI_ROM_SLOT].size; =20 /* Register PIO/MMIO BARs */ for (i =3D 0; i < PCI_ROM_SLOT; i++) { @@ -495,7 +496,7 @@ static int xen_pt_register_regions(XenPCIPassthroughSta= te *s, uint16_t *cmd) } =20 /* Register expansion ROM address */ - if (d->rom.base_addr && d->rom.size) { + if (!romsize && d->rom.base_addr && d->rom.size) { uint32_t bar_data =3D 0; =20 /* Re-set BAR reported by OS, otherwise ROM can't be read. */ --=20 2.52.0 From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543496; cv=none; d=zohomail.com; s=zohoarc; b=K2jE2O8eIvr6bZyigZwLFmn7vCNxrmcPAQenKgwgpV6FGiQq0WB0zh47QlEbr0EQFaoiw4e3VMPV2iOsJ6Tw2UWREAROKBBxB28f0wfLjJlWWO0lO3EioRTISSk39j+U2CDsWzai0iIu2SbYHS7uohWXHA46kWs7Bz/zIkTc7JQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543496; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=MtlsR1zLIBzo7DokWP/PBZ1CtP2Neyt/oQv1hSzEZAA=; b=NeNEnI0LuNLWRnLjbR+z7MzHa9hIBR9m2/O0TTXC/oBZ1aijoATEFQlZVfdrMi/3TJOUxew4C2M2prNwDsy2ECh/hBgM25Q9NkyCcCdD6cXti0m+cr/uKaxgMixFJF1naBpmcoeHqjH74eISBWiS9bFKH92mfgu3FVTr+xGiX9E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543496219813.1515653350527; Fri, 31 Jul 2026 17:18:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379718.1624130 (Exim 4.92) (envelope-from ) id 1wpxQF-0000v2-M4; Sat, 01 Aug 2026 00:17:51 +0000 Received: by outflank-mailman (output) from mailman id 1379718.1624130; Sat, 01 Aug 2026 00:17:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQF-0000uu-Ho; Sat, 01 Aug 2026 00:17:51 +0000 Received: by outflank-mailman (input) for mailman id 1379718; Sat, 01 Aug 2026 00:17:50 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQE-0000rs-2x for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:50 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQD-00Firx-DI for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:49 +0200 Received: from [10.42.69.6] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3ae6-bab6-0a2a0a5309dd-0a2a4506dbea-24 for ; Sat, 01 Aug 2026 02:17:48 +0200 Received: from [98.137.69.83] (helo=sonic314-20.consmr.mail.gq1.yahoo.com) by tlsNG-16d1c6.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b2b-195a-0a2a45060019-628945539ebc-3 for ; Sat, 01 Aug 2026 02:17:48 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:46 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:45 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543466; bh=MtlsR1zLIBzo7DokWP/PBZ1CtP2Neyt/oQv1hSzEZAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=l2NAnr2ZeOl00G7zLAfZYUgGGgl3bASj4jRKmAak+9N9/hG24pcUM/LzEn1xl4fJMjpfmcW4O10lvFpATFzfX9CpSfIxtRInzt+3HuBZgIclDqkLODwk2pyWHNVYX8+90vj2YMDizy7uAq4+8YT8E+L2LsbsA4zCApdIWya8uXQV7SXi6LiOzWpYAkul/mTRfIIfjducGFC2IwrAvlqgsviu77t5dtvaEjydWtiMDY/SFD10L5fq9wfzVPmpwSymGDgqyVAVC1NkefvikFb7qmsxJGz7dIwosXSVTfZz2nnjp2n1LIDoYf9SETOVXytPLvpYKgBL8ziU2Ib9lpG//A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785543466; bh=5ahFWUv8lvDNModk7E2uOFUzvRNOZLW3kzh0fNuw3rd=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=jO+g+4wGJ7JwN/G8/5y3TWUhOu2HKR7nJQIFCXXO393SFuJqbxDeBBqXBqrGsrFqwWdQOFyUupbAHB1smtjynyOEMHFUJDHF8fAi3ToXpWO1MWY2CfKSXylgzU80L2OjI5f5sf2I3iscHYz6y06UZ7q841cp9qKyA+xxUy4EDnCjOCmS9DSwOU6xwdg6lCzQbjxD3wWJAeJGryRhxTXUVF++gV8j8vAOBYDFKbMAbyQhB45w9AFcnBvkRNgtwPvtn/+TuRte86J35QG2Se41UmlkR5NxJOn92kuXBWh32mlbWr+ZSBjiSoae3gY1JjBsm7HQI1yfNsRLS342FASJtQ== X-YMail-OSG: gT3lLSsVM1lm2IGDDEANNWhuhXhBu9oXnaJGyZ28aKnJKr8IBok0tFrcXySMacJ Wpy9JYTmVsUvpQ8aYqe2.J23IobED.xdg1MZV3gvbzI1KpvLzxoLL4mCVb4DKGv7KSXc8gnChmPu 1lxcASxzyA0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UyMb3axdpXNZg1WOlfx9F4KxaIgOlb8n X-Sonic-MF: X-Sonic-ID: 6e72e470-4730-41e5-b846-8856782acdd4 From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 3/6] xen/igd: fixup device id before registering rom Date: Fri, 31 Jul 2026 20:17:27 -0400 Message-ID: <20260801001737.16509-4-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 3164 X-purgate-ID: tlsNG-16d1c6/1785543468-F6C7777B-A84B88A1/0/0 X-purgate-type: clean X-purgate-size: 3246 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543497551158500 Content-Type: text/plain; charset="utf-8" With the current implementation, Seabios does not see the fixup of the device id done here and consequently Seabios does not load the VGA bios and the guest screen does not light up until the guest OS graphics driver is loaded. So there is no VGA output from the passed through Intel IGD from either Seabios or the guest bootloader with the current implementation in cases when the device id needs fixing. Fix this by waiting until after doing fixup of the device id before registering the option ROM. With this patch, Seabios sees the fixup done here and loads the VGA bios, and both Seabios and the guest bootloader light up the guest screen in cases when fixup of the device id is needed. Also, remove unused header hw/core/loader.h. Fixes: 881213f1b9c5 ("xen, gfx passthrough: retrieve VGA BIOS to work") Signed-off-by: Chuck Zmudzinski --- Changes in v4: - Add a Fixes tag hw/xen/xen_pt_graphics.c | 3 +++ hw/xen/xen_pt_load_rom.c | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index b37f9b7..0ae95cc 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -223,6 +223,9 @@ void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHos= tPCIDevice *dev, } } =20 + pci_register_bar(&s->dev, PCI_ROM_SLOT, 0, &s->dev.rom); + s->dev.has_rom =3D true; + /* Currently we fixed this address as a primary for legacy BIOS. */ physical_memory_write(0xc0000, bios, bios_size); } diff --git a/hw/xen/xen_pt_load_rom.c b/hw/xen/xen_pt_load_rom.c index 319efca..407b630 100644 --- a/hw/xen/xen_pt_load_rom.c +++ b/hw/xen/xen_pt_load_rom.c @@ -4,14 +4,22 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/error-report.h" -#include "hw/core/loader.h" #include "hw/pci/pci.h" #include "xen_pt.h" =20 /* - * Scan the assigned devices for the devices that have an option ROM, and = then - * load the corresponding ROM data to RAM. If an error occurs while loadin= g an - * option ROM, we just ignore that option ROM and continue with the next o= ne. + * Normally xen_pt_register_regions will handle loading the option ROM, + * but in some cases, such as for the Intel IGD, the option ROM might + * need to be modified. + * + * For such cases, use this function to get a pointer to the option ROM + * from sysfs. Caller has the responsibility to edit the option ROM as + * needed, call pci_register_bar to register the modified option ROM, + * and set has_rom to true for the PCI device. + * + * This function must be called before xen_pt_register_regions is called + * because if xen_pt_register_regions is called first, it will register + * the option ROM and any attempt to register it again will fail. */ void *pci_assign_dev_load_option_rom(PCIDevice *dev, int *size, unsigned int domain, @@ -76,8 +84,6 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, goto close_rom; } =20 - pci_register_bar(dev, PCI_ROM_SLOT, 0, &dev->rom); - dev->has_rom =3D true; *size =3D st.st_size; close_rom: /* Write "0" to disable ROM */ --=20 2.52.0 From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543502; cv=none; d=zohomail.com; s=zohoarc; b=iX+kdzglxLge4rDydAqP4q97nSqNR6/KmY+WAkq+YqdkD9SSShsW9z28FhLyh2+n+Zuvek26cTOk+M0oPDh556SYxREuiKv+sex0AdOKkKlEdUP1li6pKE7LJ6VDs9XN+CxBwppapu5LIrJA28MEsF8E8Pwx+8sEiTK4xXlbow8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543502; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=dt4PNu6AZ8WmochcJSUTO58mxubi+byKBAAny8f1ZfI=; b=Xil7W2tPdQYtNkS5UgD47ysIbfMFBLAAfsv3iOGXqH/3wVYT5NPyTw78bGuMjTCEGGbNveoxRnfO4AlB/OGaqmNbrNJhf2w85IrOFzvsI2YHqxaE6cwr7D2ZFC4TMyAMbazL4d59zPP8OYDwQNpucNCScgUnphrpOxNGxUpAADA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543502874564.1241152289768; Fri, 31 Jul 2026 17:18:22 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379725.1624183 (Exim 4.92) (envelope-from ) id 1wpxQO-0002Mw-F4; Sat, 01 Aug 2026 00:18:00 +0000 Received: by outflank-mailman (output) from mailman id 1379725.1624183; Sat, 01 Aug 2026 00:18:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQO-0002Mm-9x; Sat, 01 Aug 2026 00:18:00 +0000 Received: by outflank-mailman (input) for mailman id 1379725; Sat, 01 Aug 2026 00:17:58 +0000 Received: from mx.expurgate.net ([194.145.224.20]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQM-0002CL-6m for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:58 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQL-00FX1B-K0 for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:57 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3a86-2eae-0a2a0a5409dd-0a2a450cce78-44 for ; Sat, 01 Aug 2026 02:17:54 +0200 Received: from [98.137.64.206] (helo=sonic303-25.consmr.mail.gq1.yahoo.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b30-f479-0a2a450c0019-628940ceb171-3 for ; Sat, 01 Aug 2026 02:17:53 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:52 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:46 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543472; bh=dt4PNu6AZ8WmochcJSUTO58mxubi+byKBAAny8f1ZfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=N9WwHxoB+cf3cO+Co06Yt+h8kaZi09MEcr8dsgrkRZjvSYks/E2U/RUsfSCMDCJ5EbQq8bFpRiSj4z8sM2XsEk7e/+RNQINe24YUDWi2aVVHHbCBz95r387g4xUXOW9Vlod5CgXmMmAAmzIgA96GbeEozdnNmXgfFrzINvsyQg5Y1bHhWxPhOTLXynFGFOZPcAFBSK6GhQrCzg1T/2kNDLCeAVfhr1Qpg3zGO7PPnXf6SYD+v972nBg/D/eeIDZTC7rK3hBX66P/ByxvhAMAkOCfjUbLCmZtG4fmLURSn5bCAtjIaOoVGQ4sHiNuF23oXREJBoLidNXBluGgN/ktgg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785543472; bh=uijYDbf63QNZRyqSO+BcjNAdvkUvYboCyFEczonTTzC=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=r/iLX5neOxLm1Hizrb85XBD85w5EzXJZZ8eub5uQw6xuLCA59zaDclf6AFPv8uY8IoMeT0kvgb+jB6m0hxfYoGaNbrOoiAwhLZJ0WyWrGxsRlldsu2vqjT2iF7r5DMCgvVhmPwJrM7Aobh9xl5M7otYR4T19PQEiE5EmN5hsoD4ozilwGGCKcpqthlTeCRaaJmEJZwFM0NuL6Qq2WneLEkNl/luUHL/f807PPj5xpwPTItm4lS27aVlCnItQx9I9BmRZlXYZ4nh6a1DucfEZrpGdIwmkAp1nJuAyntHllEmCKok7+xSAD+XRNyv9M83FRQ9HZJw4gnnjj6aFZT0eQA== X-YMail-OSG: OB._0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7xTXuaM_WX5KU9WAoJjjEt5TdpO4GhrPE8lEbDb2 O7qxsO9vYc.gBTyHmwg__.QdRz.fHIsn9AC.kop66w.LeJbK4vrF2AKivfAprBdQFk8UM3o8F20T r87KSJZ6c5tp3msZ2VRwI_fIpIYm1ujTHSmn4WTVtrSV512mc5A-- X-Sonic-MF: X-Sonic-ID: 4ab60735-23cf-4f17-a1e3-b99ab0ce6955 From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 4/6] xen/igd: enable guest creation when ROM read fails Date: Fri, 31 Jul 2026 20:17:28 -0400 Message-ID: <20260801001737.16509-5-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 4798 X-purgate-ID: tlsNG-d25034/1785543474-776D6A5B-17B7CE2F/0/0 X-purgate-type: clean X-purgate-size: 4906 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543503725158501 Content-Type: text/plain; charset="utf-8" For newer IGD devices, the host option ROM is not readable from sysfs and this results in a call to error_fail() that causes Qemu to exit(1) so guest creation fails with the current implementation for many newer IGD devices. But this read failure need not be a fatal error causing guest creation to fail because the guest does not need the option ROM to successfully boot and run. The guest only needs the option ROM for getting graphics output from the guest during early boot before the guest OS loads the Intel IGD graphics drivers. To fix this, allow guest creation to continue by avoiding setting errp if the attempt to read the host ROM file from sysfs fails. In this case, the memory for the guest option ROM has been allocated so free that memory by calling object_unparent(OBJECT(&s->dev.rom)) before continuing. Replace the error_report() and error_printf() messages for this case when the option ROM cannot be read via sysfs with a suitable info_report() message. In the case when the host option ROM cannot be read via the sysfs interface, xen_pt_register_regions() will attempt to setup the option ROM for the guest the same way it would for any other Xen passthrough PCI device that has an option ROM. Signed-off-by: Chuck Zmudzinski --- Changes in v4: - v4 is the first version of the series that has this patch This patch provides initial support for many newer Intel IGD devices so, at least, guest creation will not fail if such newer Intel IGD devices are passed through to a Xen HVM guest. But this patch alone is not sufficient for proper operation of the Intel IGD for many, if not all, of the newer Intel IGD devices when passed through to a Xen HVM guest. There are two main problems with more recent, modern devices: 1. The newer divices might require patches to the Intel OpRegion and also an extended video bios table (VBT). Without support for these aspects of the newer devices, the experience will not be great and in many cases the Intel IGD still will not function properly in the guest. 2. The newer devices only work with UEFI AFAICT, and the Ovmf* platforms provided by the upsream edk2 project do not provide support for the Intel IGD. It appears the problem is that the ekd2 project deems the fact that the hardware manufacturer does not provide the necessary firmware, the EFI graphics output protocol (GOP) driver, in the ordinary way by making the EFI GOP driver accessible in virtual environments via the option ROM of the real PCI device, to be a reason to reject patches that add support for the Intel IGD. This, however, is not a fatal problem since it only affects the guest during early boot when OVMF or the bootloader is running and the guest OS graphics drivers have not yet been loaded. Lack of support for the Intel IGD in OVMF does not seem to affect the experience negatively once the guest OS graphics drivers have been loaded. So efforts to address this problem are only important in cases when it is necessary to get graphics output from OVMF and/or the guest bootloader. The next two patches in this patchset address these two problems. Of those two patches, the first one is more necessary, and the second of those two patches is only needed to provide graphics output from the guest during early boot. hw/xen/xen_pt_graphics.c | 7 +++++++ hw/xen/xen_pt_load_rom.c | 5 +---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index 0ae95cc..a124233 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -187,6 +187,13 @@ void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHo= stPCIDevice *dev, return; } =20 + /* Case when the host ROM file from sysfs could not be read */ + if (!bios_size) { + object_unparent(OBJECT(&s->dev.rom)); + bios =3D NULL; + return; + } + if (bios_size < sizeof(struct rom_header)) { error_setg(errp, "VGA: VBIOS image corrupt (too small)"); return; diff --git a/hw/xen/xen_pt_load_rom.c b/hw/xen/xen_pt_load_rom.c index 407b630..eaf0ae1 100644 --- a/hw/xen/xen_pt_load_rom.c +++ b/hw/xen/xen_pt_load_rom.c @@ -77,10 +77,7 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, memset(ptr, 0xff, dev->romsize); =20 if (!fread(ptr, 1, st.st_size, fp)) { - error_report("pci-assign: Cannot read from host %s", rom_file); - error_printf("Device option ROM contents are probably invalid " - "(check dmesg).\nSkip option ROM probe with rombar=3D= 0, " - "or load from file with romfile=3D\n"); + info_report("pci-assign: Cannot read Option ROM %s from host", rom= _file); goto close_rom; } =20 --=20 2.52.0 From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543500; cv=none; d=zohomail.com; s=zohoarc; b=CMo7LiOGO4Ea7x87H4veuHta6cmBE/0z8poIulmNA1I22TQldTuqUMRYVw0M+4wayM+b/4kGKie0dpBCM0q4TNDDcezECR5lUojUQSR3dz64rk6Rgy5XQuIabg/63BPfndbMpCqnBGq+gM5x46QpZNNRjqSNYabE7d7uGhw8WJo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543500; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ffO8qrCy0LABWluXubgddMD+88wzPHM657OWh8V4ys8=; b=My34LjIAZ4/aEtuMKAL2SDD14C52x8mCmsMkQrUIvaD1bJR9e2MGJES5vXhDefmq54LtvRpLNNlh2xYb7PyINEU+7ObQL+m8QaQV7Rz0FGdmoutZJCG6uQES0YIOOYUiR+CDUn44VOsBxTSEjwNQGhv1yQ5jThOUUG0cR6iT5kQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543500458111.41689855053562; Fri, 31 Jul 2026 17:18:20 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379722.1624165 (Exim 4.92) (envelope-from ) id 1wpxQK-0001ob-Pw; Sat, 01 Aug 2026 00:17:56 +0000 Received: by outflank-mailman (output) from mailman id 1379722.1624165; Sat, 01 Aug 2026 00:17:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQK-0001oU-Mc; Sat, 01 Aug 2026 00:17:56 +0000 Received: by outflank-mailman (input) for mailman id 1379722; Sat, 01 Aug 2026 00:17:56 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQJ-0001mv-Oj for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:55 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQJ-00AjYh-5k for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:55 +0200 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3ac2-5cb7-0a2a0a5109dd-0a2a4508975c-34 for ; Sat, 01 Aug 2026 02:17:55 +0200 Received: from [98.137.65.31] (helo=sonic315-55.consmr.mail.gq1.yahoo.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b31-f659-0a2a45080019-6289411f9b38-3 for ; Sat, 01 Aug 2026 02:17:54 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic315.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:53 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:48 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543473; bh=ffO8qrCy0LABWluXubgddMD+88wzPHM657OWh8V4ys8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=jBEsPlsKDZ9k3OFUK2pNIuuFEyLSfjnjdOdeflcM4v+Iuc+0ClVkgXoYY/svRgtXdwNMMOj5MxOZzCh8OmgbY05QVK7S0EQVGjXbA/z0TYifQ6HcBjHU7kgvrYZlcXXUgcasTrSMBef8IPLNQJzA1c3dZrOwwfT1GUOxrxpIcdH68v/rVwh3X5dg2DoRJ0B5ELph6O7Xw/uWzQnlZhJCUP57DHZOhKlwU2ZBnNVw54WnfS/rG6B0KSefzZ1+LQpi19a8OptFY2Ua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azUJ.m37uk75DNY Gox2hTs2DiaD2RoDYYF1KmNUuKfu39Wy6oD_.rFp6lqXzx.n0QA.x6pVw7.CzirBwsjzYx2x4fxK TzPnMTcgZ2MqCJsGY.uqXi1RiuGuaqR53dglmzCnPKUM9KLkGBSHGWN9tKzcYAP3BaqDXffHMTIl RLxHrI9OJ3f1OYSYXPf2qIHEZIwPAFkikqhQRJNu04VvZV4PHdnFT2KA6gmRe4YApZbqP1w2TQAJ oOotujPdAIY4S.Mu6v6ojACnWD1o4iSlt.ATJkQMZm9pED4Vqm.SoZs4c_sWNhDckPfHJi8ZdR_K 7KowPOpIlyz.vCu49qlDW6PWXl2iZkgsQQVprcFk03OgBldqz9EG6sc3btedLB2opDobiBH4aDx_ gbWOOCXYEr9MmkbU9KZ60_5tuVxx7y79oR3Kua6giOCegMdtbd9YYLOuRFkg.UStCnnlyuSZgcZy vvIakHp9bk7rndw7SC9Y44sI.2HibJATn1Je6GSJfE5BEUSVmNtWsyqV83rqBcBPm9Dzj2oEkpdh _7E_mFC4M0xtu7U01UdOSHT0Dj5aqXBzK8N3KeQUD7ORBN3HptKdarioYdt5grFMFdfHdcfsm.o_ uFz9HFDHN0X8bbi8t4wUYXn0GzUbbROQZgCUYerUBa6dzOQWPh3UA9dTyc8ksssz_h20Fpa_ZIzd lEwaKmNTiKXf.GliX5Y4OCHMCKabx_u3I482.U2XSexQKndZxRw-- X-Sonic-MF: X-Sonic-ID: 8c31a32f-648a-4935-9991-1504277b6dc1 From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 5/6] xen/igd: implement support for extended VBT Date: Fri, 31 Jul 2026 20:17:29 -0400 Message-ID: <20260801001737.16509-6-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 14629 X-purgate-ID: tlsNG-c1860d/1785543475-D457487B-AEE13D86/0/0 X-purgate-type: clean X-purgate-size: 14963 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543501676158500 Content-Type: text/plain; charset="utf-8" Newer devices with versions of the OpRegion >=3D 2 require an extended bios table (VBT) in some cases and also in some cases require modifications to the OpRegion for proper operation in the guest. This is in contrast to legacy devices in which the VBT is always embedded within the OpRegion. This makes the current approach of providing only the unmodified host OpRegion to the guest with no guest access to the VBT insufficient for proper support of devices with OpRegion version 2 or higher and an extended VBT. Support for extended VBT also depends on compatible support in hvmloader. If such support is lacking in hvmloader, fall back to the current protocol that does not provide support for extended VBT. To implement support for extended VBT: Instead of configuring the guest with access to the unmodified host OpRegion via hypervisor mapping of the OpRegion from the host to the guest, temporarily map the host OpRegion and VBT into the guest, allowing the guest (hvmloader) to get copies of the host OpRegion and VBT which hvmloader can modify as needed to support cases that require modifications to the OpRegion. In xen_pt_unregister_vga_regions(), do not try to unmap the OpRegion in cases when the OpRegion is not mapped during normal operation of the guest, and replace the constant '3' with the macro XEN_PCI_INTEL_OPREGION_PAGES which is defined to be 3. To implement this: Use 'done =3D true' to end further processing when the OpRegion does not need to be unmapped in xen_pt_unregister_vga_regions(), and use 'guest_supports_opregion2 =3D false' to end further processing when the OpRegion does need to be unmapped in xen_pt_unregister_vga_regions(). The OpRegion 2+ support that can be provided by this patch and a compatible patch to hvmloader is required to fix code 43 errors in Windows guests that have an Intel IGD with extended VBT passed through to the guest. Link: https://lore.kernel.org/kvm/20211012124855.52463-1-colin.xu@gmail.com/ Signed-off-by: Chuck Zmudzinski --- Changes in v4: - v4 is the first version of the series that has this patch The companion patch to hvmloader that is needed to make this patch take effect is available here: https://lore.kernel.org/qemu-devel/20260801000354.16446-1-brchuckz@aol.com/ hw/xen/xen_pt_graphics.c | 231 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 223 insertions(+), 8 deletions(-) diff --git a/hw/xen/xen_pt_graphics.c b/hw/xen/xen_pt_graphics.c index a124233..3d2a94c 100644 --- a/hw/xen/xen_pt_graphics.c +++ b/hw/xen/xen_pt_graphics.c @@ -12,7 +12,26 @@ static unsigned long igd_guest_opregion; static unsigned long igd_host_opregion; =20 +/* + * These are true until they are set to false when the guest first + * accesses the OpRegion address register for a read or write, + * respectively. + */ +static bool first_guest_opregion_read =3D true; +static bool first_guest_opregion_write =3D true; + +static uint32_t guest_opregion_extra_writes; +static bool guest_supports_opregion2 =3D false; +static bool done =3D false; +static unsigned long rvda; /* absolute host VBT address */ +static unsigned long vbt_guest_pgbase; +static uint32_t vbt_nr_pages; + #define XEN_PCI_INTEL_OPREGION_MASK 0xfff +#define XEN_PCI_INTEL_OPREGION_PAGES 0x3 +#define XEN_PCI_INTEL_OPREGION_ENABLE_ACCESSED 0x1 +#define XEN_PCI_INTEL_OPREGION_DISABLE_ACCESS 0x0 +#define XEN_PCI_INTEL_OPREGION2_SUPPORT_MASK 0x1 =20 typedef struct VGARegion { int type; /* Memory or port I/O */ @@ -117,11 +136,11 @@ int xen_pt_unregister_vga_regions(XenHostPCIDevice *d= ev) } } =20 - if (igd_guest_opregion) { + if (!guest_supports_opregion2 && igd_guest_opregion) { ret =3D xc_domain_memory_mapping(xen_xc, xen_domid, (unsigned long)(igd_guest_opregion >> XC_PAGE_SHIFT), (unsigned long)(igd_host_opregion >> XC_PAGE_SHIFT), - 3, + XEN_PCI_INTEL_OPREGION_PAGES, DPCI_REMOVE_MAPPING); if (ret) { return ret; @@ -239,7 +258,30 @@ void xen_pt_setup_vga(XenPCIPassthroughState *s, XenHo= stPCIDevice *dev, =20 uint32_t igd_read_opregion(XenPCIPassthroughState *s) { + if (!igd_host_opregion) + /* We just work with LE. */ + xen_host_pci_get_block(&s->real_device, XEN_PCI_INTEL_OPREGION, + (uint8_t *)&igd_host_opregion, 4); + + /* + * By returning igd_host_opregion here instead of 0, we can + * indicate to hvmloader that we support OpRegion 2. + * + * The conditions are there to prevent returning igd_host_opregion + * to guests that have a version of hvmloader that lacks support + * for OpRegion 2. We do this to maintain backward compatibility for + * guests with earlier versions of hvmloader that always expect us + * to return 0 instead of igd_host_opregion when igd_guest_opregion + * is not yet set to a non-zero value. + */ + if (first_guest_opregion_read && !igd_guest_opregion && + first_guest_opregion_write) { + first_guest_opregion_read =3D false; + return igd_host_opregion; + } + uint32_t val =3D 0; + first_guest_opregion_read =3D false; =20 if (!igd_guest_opregion) { return val; @@ -251,21 +293,194 @@ uint32_t igd_read_opregion(XenPCIPassthroughState *s) return val; } =20 -#define XEN_PCI_INTEL_OPREGION_PAGES 0x3 -#define XEN_PCI_INTEL_OPREGION_ENABLE_ACCESSED 0x1 void igd_write_opregion(XenPCIPassthroughState *s, uint32_t val) { int ret; =20 - if (igd_guest_opregion) { + /* hvmloader with OpRegion 2 support uses lsb of val to indicate suppo= rt */ + if ((val & XEN_PCI_INTEL_OPREGION2_SUPPORT_MASK) && + first_guest_opregion_write) { + guest_supports_opregion2 =3D true; + } else if (first_guest_opregion_write) { + XEN_PT_LOG(&s->dev, "hvmloader lacks extended VBT support, " + "continuing with legacy support only\n"); + } + + if ((!guest_supports_opregion2 && igd_guest_opregion) || done) { XEN_PT_LOG(&s->dev, "opregion register already been set, ignoring = %x\n", val); return; } =20 - /* We just work with LE. */ - xen_host_pci_get_block(&s->real_device, XEN_PCI_INTEL_OPREGION, - (uint8_t *)&igd_host_opregion, 4); + if (guest_supports_opregion2 && !first_guest_opregion_write) { + /* + * OpRegion 2 is supported and we are processing + * additional writes that the legacy protocol ignores. + * + * We should always return from this if block to prevent + * executing code below which is only for the first write + * when we map the host OpRegion into the guest. + */ + guest_opregion_extra_writes++; + switch (guest_opregion_extra_writes) { + case 1: + /* + * Hvmloader expects us to store the value as the least + * significant DWORD of rvda. + */ + rvda =3D (unsigned long)val; + break; + case 2: + /* + * Hvmloader expects us to store the value as the most + * significant DWORD of rvda and unmap the OpRegion if + * rvda is not equal to zero. + * + * If the unmapping fails, hvmloader will fall back to the + * behavior of older versions which simply map the OpRegion + * from the host to the guest without trying to configure + * the guest with OpRegion 2 with extended VBT support. + */ + rvda |=3D (unsigned long)(val) << 32; + if (rvda) { + ret =3D xc_domain_memory_mapping(xen_xc, xen_domid, + (unsigned long) + (igd_guest_opregion >> XC_P= AGE_SHIFT), + (unsigned long) + (igd_host_opregion >> XC_PA= GE_SHIFT), + XEN_PCI_INTEL_OPREGION_PAGE= S, + DPCI_REMOVE_MAPPING); + if (ret) { + XEN_PT_ERR(&s->dev, "[%d]:Can't unmap IGD host opregio= n:0x%lx" + " from guest opregion:0x%lx.\n", ret, + (unsigned long)(igd_host_opregion >> XC_PAG= E_SHIFT), + (unsigned long)(igd_guest_opregion >> XC_PA= GE_SHIFT)); + rvda =3D 0; + guest_supports_opregion2 =3D false; + } + ret =3D xc_domain_iomem_permission(xen_xc, xen_domid, + (unsigned long) + (igd_host_opregion >> XC_= PAGE_SHIFT), + XEN_PCI_INTEL_OPREGION_PA= GES, + XEN_PCI_INTEL_OPREGION_DI= SABLE_ACCESS); + if (ret) { + XEN_PT_WARN(&s->dev, "[%d]:Can't disable access to IGD= host" + " OpRegion: 0x%x.\n", ret, + (unsigned long)(igd_host_opregion >> XC_PA= GE_SHIFT)); + } + } else { + guest_supports_opregion2 =3D false; + } + break; + case 3: + /* + * Hvmloader expects us to store the value as the address + * to map the VBT to in the guest and to map the VBT at the + * provided address in the guest. Hvmloader encodes the number + * of pages to map in the least significant 12 bits of the + * provided address. + * + * If VBT verification fails, hvmloader can't determine if the + * VBT is mapped but corrupted or unmapped, so it crashes the + * guest as an unrecoverable error. + */ + + /* address (gfn) to map VBT to in the guest */ + vbt_guest_pgbase =3D val >> XC_PAGE_SHIFT; + vbt_nr_pages =3D val & XEN_PCI_INTEL_OPREGION_MASK; + ret =3D xc_domain_iomem_permission(xen_xc, xen_domid, + (unsigned long)(rvda >> XC_PA= GE_SHIFT), + vbt_nr_pages, + XEN_PCI_INTEL_OPREGION_ENABLE= _ACCESSED); + if (ret) { + XEN_PT_ERR(&s->dev, "[%d]:Can't enable access to IGD host = VBT:" + " 0x%lx.\n", ret, + (unsigned long)(rvda >> XC_PAGE_SHIFT)), + rvda =3D 0; + vbt_guest_pgbase =3D 0; + vbt_nr_pages =3D 0; + done =3D true; + break; + } + ret =3D xc_domain_memory_mapping(xen_xc, xen_domid, + (unsigned long)vbt_guest_pgbase, + (unsigned long)(rvda >> XC_PAGE= _SHIFT), + vbt_nr_pages, DPCI_ADD_MAPPING); + if (ret) { + XEN_PT_ERR(&s->dev, "[%d]:Can't map IGD host VBT:0x%lx to" + " guest VBT:0x%lx.\n", ret, + (unsigned long)(rvda >> XC_PAGE_SHIFT), + (unsigned long)vbt_guest_pgbase); + rvda =3D 0; + vbt_guest_pgbase =3D 0; + vbt_nr_pages =3D 0; + done =3D true; + break; + } + XEN_PT_LOG(&s->dev, "Map VBT: 0x%lx -> 0x%lx\n", + (unsigned long)(rvda >> XC_PAGE_SHIFT), + (unsigned long)vbt_guest_pgbase); + XEN_PT_LOG(&s->dev, "VBT host address: 0x%lx\n", rvda); + break; + case 4: + /* + * Hvmloader expects us to store the given value as the + * final value for the register that stores the OpRegion + * address in the guest. We also unmap the VBT since the + * guest now has its own copy of both it and the OpRegion. + * + * If the unmapping fails the VBT will be mapped where + * hvmloader needs to place the OpRegion plus VBT in the + * guest E820 map. In this case, hvmloader will crash with + * BUG() rather than try to use the mapped VBT with the + * guest's copy of the OpRegion. + */ + igd_guest_opregion =3D val; + ret =3D xc_domain_memory_mapping(xen_xc, xen_domid, + (unsigned long)vbt_guest_pgbase, + (unsigned long)(rvda >> XC_PAGE= _SHIFT), + vbt_nr_pages, DPCI_REMOVE_MAPPI= NG); + if (ret) { + XEN_PT_ERR(&s->dev, "[%d]:Can't unmap IGD host VBT:0x%lx f= rom" + " guest VBT:0x%lx.\n", ret, + (unsigned long)(rvda >> XC_PAGE_SHIFT), + (unsigned long)vbt_guest_pgbase); + rvda =3D 0; + done =3D true; + break; + } + + ret =3D xc_domain_iomem_permission(xen_xc, xen_domid, + (unsigned long)(rvda >> XC_PA= GE_SHIFT), + vbt_nr_pages, + XEN_PCI_INTEL_OPREGION_DISABL= E_ACCESS); + if (ret) { + XEN_PT_WARN(&s->dev, "[%d]:Can't disable access to IGD hos= t" + " VBT: 0x%x.\n", ret, + (unsigned long)(rvda >> XC_PAGE_SHIFT)); + } + + done =3D true; + break; + default: + break; + } + return; + } + + /* + * This code handles the first write to the register from the guest. + * It maps the host OpRegion into the guest. + * + * Set first_guest_opregion_write to false to enable more writes + * if OpRegion 2 is supported. + */ + first_guest_opregion_write =3D false; + + if (!igd_host_opregion) + /* We just work with LE. */ + xen_host_pci_get_block(&s->real_device, XEN_PCI_INTEL_OPREGION, + (uint8_t *)&igd_host_opregion, 4); igd_guest_opregion =3D (unsigned long)(val & ~XEN_PCI_INTEL_OPREGION_M= ASK) | (igd_host_opregion & XEN_PCI_INTEL_OPREGION_= MASK); =20 --=20 2.52.0 From nobody Wed Aug 26 10:49:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=aol.com ARC-Seal: i=1; a=rsa-sha256; t=1785543499; cv=none; d=zohomail.com; s=zohoarc; b=bzg1efDnmM+NgwE+tUekzoJl/VEbczGKmAi6O9QDAUPghpwkh5H3U9rELbVoCsuW0WWArCT9jlc6u72TzUYWhBTrNcDfDiIJspg/8i1IOeIVSYv2Ov9CpxHG57UU0LQ2NRwdsqCnH03GAmRjJ8wyjL2VKpW1MwOrAJBdQ5tO9X8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785543499; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=em0LfYUuUVS4dEN9yvrJ5cV2XhQB99q5Rt9+dzqOtV8=; b=VNkPkQVP68P2MRVUDJ0nhWKTcTsZ2DnpGrvzggRNkViGXNIddllgcPhOkmFt5VOJgHUcoE1/d9+NPe5rRoY3HwAOkDoMlVWq1y2UaJc8r7AeOwEML3potBkCI5cjQUI8789S+B9Yu2mas0Y0poKOAN6k73P/jKagwS99WZaU604= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1785543499854872.2640896688208; Fri, 31 Jul 2026 17:18:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1379723.1624170 (Exim 4.92) (envelope-from ) id 1wpxQL-0001rl-3t; Sat, 01 Aug 2026 00:17:57 +0000 Received: by outflank-mailman (output) from mailman id 1379723.1624170; Sat, 01 Aug 2026 00:17:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQK-0001rK-Ts; Sat, 01 Aug 2026 00:17:56 +0000 Received: by outflank-mailman (input) for mailman id 1379723; Sat, 01 Aug 2026 00:17:56 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wpxQJ-0001n2-St for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 00:17:56 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wpxQJ-00AjYh-9m for xen-devel@lists.xenproject.org; Sat, 01 Aug 2026 02:17:55 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a6d3b2e-5cb7-0a2a0a5109dd-0a2a4504e2b2-2 for ; Sat, 01 Aug 2026 02:17:54 +0200 Received: from [98.137.65.83] (helo=sonic313-20.consmr.mail.gq1.yahoo.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a6d3b31-b57f-0a2a45040019-628941538f8a-3 for ; Sat, 01 Aug 2026 02:17:54 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.gq1.yahoo.com with HTTP; Sat, 1 Aug 2026 00:17:52 +0000 Received: by hermes--production-bf1-54b5569bdc-h5zdx (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 655a093bcead2c5289eeab02aa189b76; Sat, 01 Aug 2026 00:17:49 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=a2048 header.d=aol.com header.i="@aol.com" header.h="From:To:Cc:Subject:Date:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1785543472; bh=em0LfYUuUVS4dEN9yvrJ5cV2XhQB99q5Rt9+dzqOtV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=doRUbXE9lp7Rw1ayMqIEmMaOq61ZZ18P651yd9qLvqvHwwgEheT9s29kPcvdAeSzqcBy6E8q64wx5G5tndqx9taq34l+lIRQwVh6qnZDj/lM4u9Ld0DtB4WOY/ECilS30+DLMbC7kWpPRX5oWH+pkwTiG6QxiZU4kJz/0S4nCa44WZ0GwmuXqUGIsboRXuSc02t1bkqmzaTrhVa6l5rS5560B6VgTwIlYLZy7F+jPmBT3AAZ9Xo+loKmx/aYQG4/yzHHiFt8scqNqhVbCTB9ag3jA98bEEZHFwTqpem7kSeb15QrFszZ3jhRCyT10JkxnR6DkHxC5pNSdORxBPOkwg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785543472; bh=yestQipyg8w6O7Lx6tHhvERxFQ0+EPj6fbFiGqFivaC=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=DTmMbpPHouEZffyYD8i9ETwRQGkBBS3lYG+EYg4WLNsBbUmCKx7dDieFyKWDTVTv2ZQr7+BovBgUXBxANgLu6pCmhha7XO38MurgyOGerYQbngzK9BVo8dhW37UX4pRfnKeYcWww8c5YNZGzk3hctyE3ffiDS5DLKUYkt+VbuY22X3yAJ6bn6DAOo1vVE1Q5Bax+QzIuGHNCalgMdNHMyiwe4L1OkOEZ6NY5JeXS/5MDXQnCOhen6UwzcwQKoI2/abeGb3iU2EEGH0+iAgq2pf+ixr13WwMdPP8jJ53daEMJalERFLwhm3ftGOGlLWb5Ccgud9ccq/ObmL6UmyJ4Dg== X-YMail-OSG: ZBJJFDUVM1lYaflSIDnAPpefQzBjC4MCmcdUwDWYRCTlsqVtBUN8I3KXRUt7uwI _o4JXcUdynTxGYpD0TiJttBaPsU_GzIRhTB1wLEe2QaVIxdAu9l9STMG2Z1IJ3TSDlROqk7kwN16 JtKWp68X16juyC.0rrf1wsK8xzlRAgE_hCR_TQUTVY8pv_Efo4B6HRuv6kHabfUBbH8k3204IAHL Cj3oK2qEcz8FiooQeLJWzHtVS8l.anoCfh5ln6uKgp01GArbjTRSJzoQJJTUpNPVSB_wwpC3le_g eQ1GKR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QPrzvLw8pHtNqtupbjCRNd9aTw7l9oENEAa2cvKa93T8YCAt9AgGiF17 31Qu8vRvkrE2wOsenoJWGaCfcgVGyGDM._HoxaE47A8QJurAImSBcpVzy_XaLBBjOF3z5TQwvBW0 a6vLYSvD3jVk9M5D.GsThs3R3_Cxe2Wa4dqPUd4_3NxiArQi8apD7PZWd1MtxflBbd8vTLokKbYT LfM0EBzVcMEVh8hAMd88I0qF3VOGFmerdA6aAJlDX2zHtQK7jCknrgKxbnYkVoZf_mxyBUsmF9gf bVU7kyspB3vjjAggfIw6Uwrdx2zuWnWcwz7ro3PHV7lxO4kbF.UQ8lp3jyZ9kCUJrPN2DigiZxMO CM5XKGIehm2d6nPi8anaRc1lqvWNoHkL64PXXLJU8WKriO3VITE13CmsywIT6aoBiz_jQS1cZGAs eETHs997pF_RXMPNkHh73JYq749g7v_EZsskKlZhSbXYYBwzNyUyDQCNwenpSZcEdkXMnLKMKA8h IVn_lFBSvaGXEeSJXinIrBetw7PGjXfCvKn_fBC4ZWyOmnn5N.2fuH4PlttdNkzA89Ua6DQvfSOq WRD1q35q3kM7bjPqG3DxAt8_hGdflXBG8Mi7YeTjij14kzr7czxyCgjMc9mOkguEJ2Y4QVwJlDWG 12uXZAR_0EMafDOYNTy.X.iWDC.mJD0jYcISkAHk12zPIXmBNF92n.91OsI_XnBW9CQoLcBiqSRO Hr92UI4itq08LYLbjah0vdv6v3zYndoXg1jMClUmCQM6Qef9RqnmXPLmXLiiHmNgkx5agREnPAPR pFmM4XOO4Ms0jS9U0uoR4qSJK3geka0zvQXsTocst6puucZLXoyWYBezv63Q.Ovu6Cgu8No2hTsj dqrp5z65dUz6QAisb5jkubRhabtev1kG2Bxun.bAAfP3vR75XZw-- X-Sonic-MF: X-Sonic-ID: 66360c73-547b-4fd8-8909-7c15d88570af From: Chuck Zmudzinski To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org, xen-devel@lists.xenproject.org, Stefano Stabellini , Anthony PERARD , "Edgar E . Iglesias" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Teddy Astie , Tomita Moeko Subject: [PATCH v4 6/6] xen/igd: use custom option ROM if provided Date: Fri, 31 Jul 2026 20:17:30 -0400 Message-ID: <20260801001737.16509-7-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260801001737.16509-1-brchuckz@aol.com> References: <20260801001737.16509-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 8792 X-purgate-ID: tlsNG-ebf023/1785543474-C24CBB50-C52C0853/0/0 X-purgate-type: clean X-purgate-size: 9003 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785543501660158500 Content-Type: text/plain; charset="utf-8" Since in some cases the option ROM is not readable from sysfs on the host, provide the option to use a custom option ROM file instead that, for example, could be extracted from BIOS or UEFI firmware and modified as needed for use with a particular Intel IGD device. The file must be named "igd.rom" and be located in a directory configured at build time as a Qemu firmware directory and its size should be a power of two, and it must be compatible with the particular Intel IGD device being passed through. If provided, the "igd.rom" file will be used as the option ROM instead of the option ROM file epxosed in the host sysfs. If no "igd.rom" file is provided, this patch has no effect. Signed-off-by: Chuck Zmudzinski --- Changes in v4: - v4 is the first version of the series that has this patch Sorry for the length of these notes but there are many things to say about this patch that are not obvious to persons without some experience of actually trying to use the option ROM of an Intel IGD when it is passed through to a Xen HVM guest. This patch is primarily for providing a way to add Intel IGD support for the OvmfXen platform to get graphics output during early boot from modern Intel IGD devices that are only compatible with UEFI for graphics output during early boot. Note this patch is not necessary for successful operation of the Intel IGD in the guest once the guest OS drivers have loaded. It is only needed as part of the patchset necessary to provide graphics output from the Intel IGD in the guest during early boot when using newer devices that are only compatible with UEFI for graphics output during early boot. Most older devices that are compatible with legacy VGA BIOS will work with Seabios without this patch, but they will need Patch 3 of this patchset to work with Seabios. Some notes on adding Intel IGD support for the OvmfXen platform: It is necessary to provide an EFI graphics output protocol (GOP) driver to the guest to get output from the Intel IGD before the guest OS loads the graphics drivers when the guest uses UEFI. This GOP driver is essentially the replacement of the VBIOS driver that applied to older devices that use legacy bios, as described here: https://www.intel.com/content/www/us/en/support/articles/000005749/graphics= .html Unfortunately, with modern Intel IGD devices, the EFI GOP driver is not provided to the guest in the usual way of providing firmware for a PCI device in the option ROM of the real PCI device. So I included this patch in this patchset to provide a way to expose the EFI GOP driver to the guest. I was able to extract the GOP driver for my device using the UEFI bios update file from the motherboard manufacturer and the UEFITool available here: https://github.com/longsoft/uefitool That EFI driver can be wrapped into an option ROM using the EfiRom bin wrapper that is part of the edk2 project: https://github.com/tianocore/edk2/blob/master/BaseTools/BinWrappers/PosixLi= ke/EfiRom I tried setting the 'romfile' member of the PCIDevice struct that is used by KVM/VFIO Qemu devices and emulated Qemu PCI devices, but that did not work with Xen PCI passthrough devices. Neither Seabios nor the OvmfXen platform could detect the option ROM in the guest with that method of exposing an option ROM to the guest. So I implemented this approach of substituting the 'rom' file exposed by sysfs with an administrator-provided file instead of using 'romfile'. In the commit message I mentioned the size of the rom file "should" be a power of two. I mentioned this because the code in pci.c that handles the 'romfile' setting for PCI devices enforces this requirement strictly on the romfile that Qemu emulated or VFIO devices use. However, I do not know for sure whether or not the rom=20 file is strictly required to have a size of a power of two, so that is why I say it should be a power of two. In my testing, I zero pad the "igd.rom" file so it has a size of a power of two. I will accept the suggestions of experts on this question about the appropriate size of the option ROM file (I am not such an expert!). As mentioned in the message accompanying Patch 4 of this patchset, the official edk2 project does not provide support for the Intel IGD, but some OVMF patches for Intel IGD support are available online for KVM/VFIO guests, such as at the links below (they apply to the OvmfPkgX64 platform): https://github.com/cmd2001/build-edk2-gvtd https://eci.intel.com/docs/3.3/components/kvm-hypervisor.html#build-ovmf-fd= -for-kvm https://github.com/LongQT-sea/intel-igpu-passthru With such patches it is reported that the passed through Intel IGD device lights up the display during early boot from OVMF and the guest bootloader in KVM/VFIO guests provided that the administrator provides the correct ROM file via the 'romfile' setting for the passed thorugh Intel iGD device and applies appropriate patches to the OvmfPkgX64 platform. It should also be possible to add Intel IGD support for the OvmfXen platform also but I have not seen any such patches online for OvmfXen and if anyone knows of such patches online I would be interested to be informed about them. I am also working on my own patches to add Intel IGD support to the OvmfXen platform, in private for now. If anyone is interested, I can make the work I have done so far toward this goal avalable online. hw/xen/xen_pt_load_rom.c | 47 +++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/hw/xen/xen_pt_load_rom.c b/hw/xen/xen_pt_load_rom.c index eaf0ae1..6c2aa8f 100644 --- a/hw/xen/xen_pt_load_rom.c +++ b/hw/xen/xen_pt_load_rom.c @@ -2,6 +2,7 @@ * This is splited from hw/i386/kvm/pci-assign.c */ #include "qemu/osdep.h" +#include "qemu/datadir.h" #include "qapi/error.h" #include "qemu/error-report.h" #include "hw/pci/pci.h" @@ -13,9 +14,9 @@ * need to be modified. * * For such cases, use this function to get a pointer to the option ROM - * from sysfs. Caller has the responsibility to edit the option ROM as - * needed, call pci_register_bar to register the modified option ROM, - * and set has_rom to true for the PCI device. + * from a user provided romfile or sysfs. Caller has the responsibility + * to edit the option ROM as needed, call pci_register_bar to register + * the modified option ROM, and set has_rom to true for the PCI device. * * This function must be called before xen_pt_register_regions is called * because if xen_pt_register_regions is called first, it will register @@ -32,17 +33,27 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, struct stat st; void *ptr =3D NULL; Object *owner =3D OBJECT(dev); + g_autofree const char *fname =3D g_strdup("igd.rom"); + g_autofree const char *path =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, fn= ame); + bool sysfs =3D false; =20 /* If loading ROM from file, pci handles it */ if (dev->romfile || !dev->rom_bar) { return NULL; } =20 - snprintf(rom_file, sizeof(rom_file), - "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom", - domain, bus, slot, function); + if (path) { + snprintf(rom_file, sizeof(rom_file), "%s", path); + XEN_PT_LOG(dev, "Using Intel IGD romfile %s " + "(administratior provided)\n", path); + } else { + snprintf(rom_file, sizeof(rom_file), + "/sys/bus/pci/devices/%04x:%02x:%02x.%01x/rom", + domain, bus, slot, function); + sysfs =3D true; + XEN_PT_LOG(dev, "Using Intel IGD romfile from host sysfs\n"); + } =20 - /* Write "1" to the ROM file to enable it */ fp =3D fopen(rom_file, "r+"); if (fp =3D=3D NULL) { if (errno !=3D ENOENT) { @@ -55,10 +66,14 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, goto close_rom; } =20 - val =3D 1; - if (fwrite(&val, 1, 1, fp) !=3D 1) { - goto close_rom; + /* Write "1" to the ROM file to enable it if using ROM from sysfs */ + if (sysfs) { + val =3D 1; + if (fwrite(&val, 1, 1, fp) !=3D 1) { + goto close_rom; + } } + fseek(fp, 0, SEEK_SET); =20 if (dev->romsize !=3D UINT_MAX) { @@ -83,11 +98,13 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, =20 *size =3D st.st_size; close_rom: - /* Write "0" to disable ROM */ - fseek(fp, 0, SEEK_SET); - val =3D 0; - if (!fwrite(&val, 1, 1, fp)) { - XEN_PT_WARN(dev, "%s\n", "Failed to disable pci-sysfs rom file"); + /* Write "0" to disable ROM if using ROM from sysfs */ + if (sysfs) { + fseek(fp, 0, SEEK_SET); + val =3D 0; + if (!fwrite(&val, 1, 1, fp)) { + XEN_PT_WARN(dev, "%s\n", "Failed to disable pci-sysfs rom file= "); + } } fclose(fp); =20 --=20 2.52.0