From nobody Thu Aug 13 09:24:10 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=1785978335; cv=none; d=zohomail.com; s=zohoarc; b=XpfTaNbUijpLoi8zQg1aGpOBk1UmrLw8tVjfc1BlTM8zQJRvuuFeIb8ZGQeKe5evN6Pd4R/lxI8HGimTp2Pq98jzzp8PbMs4OqJEvXWXZu0SI6PriD5e5zb+IeNWmMRAUe7krOwaqLeyBFL+awffxscgYIuhK16YxogJ2n5l7Yg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978335; 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=u2ICDeT8EkzZPEkZ0GkRz/PZQjnhXux/kxcij9AaLW8=; b=BgQvfHzKUMiuSuPfpx/B1EyLaCkeRkvyktQP97V8BC2zPiLIYGV7W6Ky4MyvPRX2NZ11Zob0mmwHVzFYtoQdpTH7BbS4FlqgfrzvQ41YZNPfmYvq0EoAu64jNxagdCo7aBa560XadqsBce+kAnPNx7Oc+eHuL26Taj/LlMU8egE= 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 1785978335590529.9821378850147; Wed, 5 Aug 2026 18:05:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384036.1627111 (Exim 4.92) (envelope-from ) id 1wrmXv-0004AU-4F; Thu, 06 Aug 2026 01:05:19 +0000 Received: by outflank-mailman (output) from mailman id 1384036.1627111; Thu, 06 Aug 2026 01:05:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmXv-0004AN-1R; Thu, 06 Aug 2026 01:05:19 +0000 Received: by outflank-mailman (input) for mailman id 1384036; Thu, 06 Aug 2026 01:05:17 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmXt-0004AH-Im for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:17 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmXs-002Rtw-Vt for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:16 +0200 Received: from [10.42.69.1] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73ddba-5cb7-0a2a0a5109dd-0a2a4501e924-32 for ; Thu, 06 Aug 2026 03:05:16 +0200 Received: from [66.163.185.33] (helo=sonic313-10.consmr.mail.ne1.yahoo.com) by tlsNG-d62444.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddcb-5984-0a2a45010019-42a3b9219c87-3 for ; Thu, 06 Aug 2026 03:05:16 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:14 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:10 +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=1785978314; bh=u2ICDeT8EkzZPEkZ0GkRz/PZQjnhXux/kxcij9AaLW8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=q/G2BOr7WloM0VHKXN2nwJ0rDbxjY+y04yBIggP1Mgn2Y7OR2CGFfBoeairu/dufh8WlbcUEY6Z2/sciIZ6dqFa/+SASV3ri2Ab+tEeIa+k8k+A3xeqGV8f12y8jlJAUoqWewX/z0ntm4hlnXNQtSovCU2URfCoKcOEezI0PoKQ6DwJI1P2KCxMIBj3Vnswja30kIwJlOF0P+1PULgbRPuA6KonN4yE4fnQ0O7DiI2f7BIHq29AnbTQK55MZXEGhtZMChFu7RHKC9zmTkYnRqPzYy+S6CRuWFsGNbHGMXaeFy4vl55P1YKouRuvu4TJ5Q72Ba4yBWEtYvNLwA57SSg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978314; bh=cHWT7ryeN9yIxVQ9xAUubGD/UkRKAGncO1k5XMUDO6e=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=O0rd0dKkVq4tpJT9hTf3se/kJZ17q2puZXxbjqBvuuSDBXUV+0IEKNPAHuRL5Y/E/mxOU4KPKwaFKCjZ2JeCGmQrD9OqOG5tdWDqI+CsR3wxIP4NuBq2DSOdeeJE/xCaFaiD+mnFriCGLbca39xSpYbP8F0pfhV772DaSSg9/EQtbQyJ5UdHX5OQtr3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uyaxgQyRzuGeqarMoJT4SZY0hpH.k7b9uj3wEp89l4pothTBq mE0eKkaD2KqgH75ZlUyolwwPIVWOWb.UbWxtkzUVw6zueIQdv3NYXtEqBYYI2VqIWfyUMYaefW0R fMcGHtJxOyMTtc4LZ9N31U5Ro9ullIbn1WmeTAJufFC_D2lTJBOiGP4ybsnDlqx38QYjAF2Qx8i0 rkGJfGePAyZ3N7AGcjNUimxb2zhYj3ZsB5dfE.ItUDcLgSaCD7Csjck_J79W5itlfx0hZcGfa2Te VOOs9IVQcX0oDaJQ9axGTiCvllVH07pLyZ.56K5rz X-Sonic-MF: X-Sonic-ID: 3e58ec08-0dc8-4d98-83be-2a7e74387771 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 v5 1/6] xen/igd: get PCH info from host sysfs Date: Wed, 5 Aug 2026 21:04:51 -0400 Message-ID: <20260806010506.492490-2-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 5779 X-purgate-ID: tlsNG-d62444/1785978316-1DC79757-10579EBE/0/0 X-purgate-type: clean X-purgate-size: 5935 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978337714158500 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 Changes in v5: - Shorten warn_report message to resolve checkpatch line length warning 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("IGD: failed to get host PCH revision, setting it to 0= x1"); + } + + 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 Thu Aug 13 09:24:10 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=1785978349; cv=none; d=zohomail.com; s=zohoarc; b=Fsr5ZZg4bNC4HE27lfeMLIUdBR41Q90HQL/LmkttngbX/CyKPLs+CIlcTLw95/hbMTHRlZO4CQAvsjI1abctyC8IFBjV3jNUVsB/Nx7CiFaDVhET+zwbT4/EipEPsLGzBQqHjGlfhEFbZljVJHpwyzPY1CBjNQthkgbMEpShALM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978349; 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=h5QyMZ5Ty9ooeK2ctmMp9atdh7YP6qYwvti8uYhWKKM=; b=KaQ2bxQCeFoTuNSnP6G51oIDCKyTGU57VCS8il+SblgOyojFjd7wAUia0iZuRr5BhoeQWD7MKhU8EZ4XZD8MW6lCMo+jII3ljhLsU4DuSBaC4zcJvsJeUlSa/shjlQSo3z8SBA0jrrH+5p77T4wC6R0c6na9ELR6pz+R8dMvtGY= 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 1785978349305882.3107847064203; Wed, 5 Aug 2026 18:05:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384039.1627138 (Exim 4.92) (envelope-from ) id 1wrmY2-0004ph-0A; Thu, 06 Aug 2026 01:05:26 +0000 Received: by outflank-mailman (output) from mailman id 1384039.1627138; Thu, 06 Aug 2026 01:05:25 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY1-0004pT-T5; Thu, 06 Aug 2026 01:05:25 +0000 Received: by outflank-mailman (input) for mailman id 1384039; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY1-0004Zp-5k for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmY0-00Dmq5-IG for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:24 +0200 Received: from [10.42.69.11] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73dd9e-e002-0a2a0a5209dd-0a2a450bc99e-30 for ; Thu, 06 Aug 2026 03:05:20 +0200 Received: from [74.6.131.125] (helo=sonic311-15.consmr.mail.bf2.yahoo.com) by tlsNG-42698a.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddcf-b7e8-0a2a450b0019-4a06837d9972-3 for ; Thu, 06 Aug 2026 03:05:20 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:19 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:12 +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=1785978319; bh=h5QyMZ5Ty9ooeK2ctmMp9atdh7YP6qYwvti8uYhWKKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=WXNAtiY9RChQYvCGuuLGy7KGeXy4O9j6SP/y0MMsyyqqenPnDbYnoFLGfDrF5fVHHb1gmmsRPzK1Lz9Af4qI1Loal/uC6jTdtVsCA+EHctj2FC8sTzWwRl8SgPNv/NJMOWF4DKuiguWQY3hlwwZu+3tA4feJB5saI1xkQxHCdu4ySoClKu8vr8YvVrEWw2B23fEdFpL+ggpAoglcPwvLuOBjVlHpaRO4S84b6Fk+ITC/npzOSdIVqKCERgRM+HeH3yVSqw/T5SBa+8q6QjRbZULn4eDUOqZ1wGv4Qq5HH3+75yv0Bz9kWyU102qR2pquN8JiME/3ZU0ZicdruySTmA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978319; bh=HtHedw0HjklR4Bxd03Z/oktcnxIu5kpeFcKt5A5jUx9=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=sci23NeLeQW7/83wPOO2xYxrJrnIzvA1nCne+qp01PehatgfHclk9IQBzehCg/x9lN7XF1Xhwg89pyZLdxTctgs9u1D3DIYJrBb0lCA3MYiQHi97zp6MdBfZYh1Ia7wh14EmS0KZi061RkXmAqOAC46QwFtIdGwdUJZNjqX5ODGJAVEvgmDUOujEQ8tw6ubB2K3KltLYZeyY0rUJYW2E1xuAYuyl8ts4/pWr5swcrhgHHDh/9I2+ZbR588UKIu/DHoIFFMrxzd9wWhcyYrBBWniH/oLZZZodThbnFKnYVgCvNWqm4LP4vLSP/SrE7FzckSaghPTcbWUGAlffpHWPCQ== X-YMail-OSG: NjVK234VM1lD9.mUG.YoQ1naz2l046QG0gja2Xq3fbevJ7ptMpnQ.3EcZS3oYyn NhwfjfzgkSM7ZkTtioAD9keWSwSCStzoJAxvYag7LL.5zN51nW4NJyYOKgh6A_Po5i4KsrN86u6P pZqUoSBIr_SsMXRRc49x5tjkTKiaVc1T7uB940mTZrmGcEPSWibZrf482SnBnOtuPv8p.NdTEUQi ZtLT9c6IcJWwgCAAIwr4pUYIKnq28ozHaqd4l3MdriQrRRLGu79Vfu7bt6nlCRoykDfNgq95p80c XQoiuVbNB8KnrPrlAUgnZe9Xr0nrKWTyHRNhEteUjsvxn4bK2XvEJT.Mw3gb7dsPk8GxpjfydzyJ lPlacR4Oly.TtnsZmUUUym.4XrqCJdhk.7nySdVeqywdoAu3vAETdcJhjbhtHBrbyAU61hk7g6ZW mCKfXSeagiSrGBtX8M_t_8JHiRxVbO7yhx0d3iSPglkqm3XUzEY6TIPO5FqBI9FM6iADU90EQmkr CxBDDEFFBST4kOa5oPj7FR3hdiOOxxHjW0rOO0EFJGRq2kGXKfz7uit7ASoM5UKf_tIxKjGVaVjf u4lsJKgF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M_Asxv8OwLyZPGe.PmmTJvzL4FRYpYqRKWUFNXGzF7Ydzxv7 yiihKuTJ7ifon0_PEskGgGwyAAgFllt2E29nviS5xdba.Hk7Xogx6hu0OSHiSbON13mZ_nMqaO.X 1KMjMA0vewPIFeVVRxc6bPs23aoJNPldQwwrxFXy5HF6p9EcuyYFfuUxAydYz4KflpQQiSEHxx4E X9O54dy1Ln7sf0X6ctLLJfHWS61dREG._tczC_CXwGmckDZgyOWPJPuHVhRoJlO23C31_nDjRf2A 6cmXuoMxeGXd5P_r2EupZqCj_VNlh03j0MK6EpNAxOXqD.eW7_aD8YFpYXIHojh4NGeLNMsv.vvq 4MTPisFmRRxCR9EDOGW60Zq0hWwH3Jpsa8ZBe_4CaG4.XH7A0eELt9DMjNUDCr21I_RPrDSJlg0w pfaeuzGNC4Boe69QUvMpU9jyvIxL.gENusIDMyvYGXeyhK4Ajr8j47btyu2lRIUGLzwJCTaiEKsj ITGG5.7L5LyWfXrpxHM0poUOaP.OPwpFDvHXjFp4XJypdJo9R_fZ0kJjJ.qeLNICSNzE5aM3IqTx OAw_.0S752jcQsBRsRfsXMqV1G8BHpg.7rQE95A-- X-Sonic-MF: X-Sonic-ID: 2529bb1c-5623-4262-a178-66bc47244aad 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 v5 2/6] xen/igd: don't register rom bar twice Date: Wed, 5 Aug 2026 21:04:52 -0400 Message-ID: <20260806010506.492490-3-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 1311 X-purgate-ID: tlsNG-42698a/1785978320-1A2C49EA-CF5DBA8D/0/0 X-purgate-type: clean X-purgate-size: 1353 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978351492158500 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 Changes in v5: - No changes to this patch 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 Thu Aug 13 09:24:10 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=1785978341; cv=none; d=zohomail.com; s=zohoarc; b=LIOfk16PfB41kG/lqVaDAq5gnqf/ZI2VGJk/lRsB3Fl1QVBz/+N0uZHNycKhNBNOIZChMPBKQqarowR8kCRGLIhhWDy2ERf8bbJ0pcJsIsyxbfOrSIYUqCR0CQryBDXbbphWcNwic99wc+UwW5z9+lGatbumhKTp9n7+bLmpNfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978341; 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=obmks52YmrFX3M/nOgH2+nRuVRmljJ9a96OvnoWzDN0=; b=Qs9QHwj8d7/wwu7WaEzNSRNZwdL1i+Lg/1cW48ehXZJIbTYijYWh3PaeNAfiObvLVouXXVFSx9v9OWEGovqDteUVquswalgauQ5xBV2YlN/W8g6y01DXvw5cg40T35s3K6DbEWFhj6rC1j9vpxXMQhPOSx8G2KqwuqfFeQElvZY= 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 1785978341839258.44557528153507; Wed, 5 Aug 2026 18:05:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384038.1627125 (Exim 4.92) (envelope-from ) id 1wrmY0-0004RH-Le; Thu, 06 Aug 2026 01:05:24 +0000 Received: by outflank-mailman (output) from mailman id 1384038.1627125; Thu, 06 Aug 2026 01:05:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY0-0004QQ-G3; Thu, 06 Aug 2026 01:05:24 +0000 Received: by outflank-mailman (input) for mailman id 1384038; Thu, 06 Aug 2026 01:05:23 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmXz-0004NK-15 for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:23 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmXy-00Dmiq-E7 for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:22 +0200 Received: from [10.42.69.8] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73ddca-e002-0a2a0a5209dd-0a2a4508a0e8-6 for ; Thu, 06 Aug 2026 03:05:18 +0200 Received: from [66.163.186.146] (helo=sonic302-20.consmr.mail.ne1.yahoo.com) by tlsNG-c1860d.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddcd-f659-0a2a45080019-42a3ba928d83-3 for ; Thu, 06 Aug 2026 03:05:18 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:16 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:14 +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=1785978316; bh=obmks52YmrFX3M/nOgH2+nRuVRmljJ9a96OvnoWzDN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=kh8tfiI5X2mLkXTltEf1/TcNAbw9dHgs2OXe6/Cx4f4Q2W6aW63BXJmSVUGkINreNcBD6FfkTh+LU/PZ/9ev/PPDIhFXlLEd5DF9qRH0ZT133j+EbvArqqLxdVG+CIYuBgZk87zNSAMfhBXeGs7TSvU4iQ0b4yTmxYhJCWMf35Xml1JursLU3YArBNZcnq06L792aANSeBpwycj45QA+42ABhE6pKl2XJwrrvkIHk/+NChuo4QrpzNRevFVwGoi2dY/qKiLP/Fg0A01edPoGhgAltg5IklPjIt6jt0yDOfQIw6DvU+RedQcECB3yfm/w+fbWJHmTkposNbKtQ7sIbw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978316; bh=ck6kJNsZA5u6QunEVrirntyEJVzU70IKy2/Lw3IfRxB=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=seq5ZWIU5B6NV56rwGUzNRaiukH2pxkuBSHwIm5hFen4SIbMRS3ENPc4ZC5HG2zFkyDfYw+7H8SgJRr8ppyKspt5c+Xix+nMCLvw28oKcc+qUOMrrHWN09oRUtkmmAJnd/XsJ3R1cMJfqpVOSod/yacHuvYk/tzdQjxo6eU3r8djSoeeqOafayIiIcOgA8ANaGsxDIXI7j/YROY1dwuE/R040usL+uXjv6LQw5SXXEj1WHC0RVMJsA+ywcVHL5/YauFFy0VhTSVoYoM0OWCoRj4+bTfpDPzi1OzLla8XfeEAJuA6vARajc7CRv8mjST5gyrGsM6n7OYcR9pwZ77J5A== X-YMail-OSG: xe.__RgVM1l_hd0jAUIpXgp5HdcGo.Fg7qzC5hEqyLrEB6dmqcjtO7EnO83gYOE GdoUZIRcPl4682QnmcoLQDxFV1YiOxV7z10s9oiJciW3.BpnQ.xl6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MSlHNYsqg9FDG2Odjjyg8YUroeIQb8- X-Sonic-MF: X-Sonic-ID: 446e3e3e-5ba5-48e7-8e09-de07860e2ac3 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 v5 3/6] xen/igd: fixup device id before registering rom Date: Wed, 5 Aug 2026 21:04:53 -0400 Message-ID: <20260806010506.492490-4-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 3209 X-purgate-ID: tlsNG-c1860d/1785978318-CCF4F87B-4E20A411/0/0 X-purgate-type: clean X-purgate-size: 3294 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978343517158500 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 Changes in v5: - No changes to this patch 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 Thu Aug 13 09:24:10 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=1785978351; cv=none; d=zohomail.com; s=zohoarc; b=NXVm8WoURIHI3De6Fh5eYi0IsvtBtay9TXMblHYDcDwJa9AH818TP8MqUU826Vcgu/t28LbaakXz0IBFYkJKKrx0bzFSiWOTat7CzgRSmevDsnNytctLEb+ClZZDszANy4OY+7K53bCiBWU1MOG4N6uSRv7Vsl3cbKoZ70Ven2E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978351; 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=G3VmkipyMhZjj38uG/j4xipQ/TGQEWVZ1kywsdVeHas=; b=RuvPi4pp4BmuBEmgNfYFwQ5fRVSEbmlF/eVCg8F20FrXyZ/jXG5jAZvk421tWJOEhUVBqmiJURcNKd0/IY0eBh1EA58Psc7xvnkwn732qc8m66aevjiLD4dv3sM9/sWsChNU9ZwVlDB9iGyFC5MyAYd2eB0Cx+vtoxCAUG7UQGI= 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 1785978351897722.1489362275859; Wed, 5 Aug 2026 18:05:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384041.1627152 (Exim 4.92) (envelope-from ) id 1wrmY3-00057n-Ms; Thu, 06 Aug 2026 01:05:27 +0000 Received: by outflank-mailman (output) from mailman id 1384041.1627152; Thu, 06 Aug 2026 01:05:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY3-00057d-FH; Thu, 06 Aug 2026 01:05:27 +0000 Received: by outflank-mailman (input) for mailman id 1384041; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY1-0004gH-FC for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmY0-00Dmq5-SR for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:24 +0200 Received: from [10.42.69.4] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73ddb4-e002-0a2a0a5209dd-0a2a4504b9fe-22 for ; Thu, 06 Aug 2026 03:05:24 +0200 Received: from [66.163.188.206] (helo=sonic311-25.consmr.mail.ne1.yahoo.com) by tlsNG-ebf023.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddd3-b57f-0a2a45040019-42a3bcce86d4-3 for ; Thu, 06 Aug 2026 03:05:24 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:22 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:16 +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=1785978322; bh=G3VmkipyMhZjj38uG/j4xipQ/TGQEWVZ1kywsdVeHas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=sYh2bdc5USWGn/sFhSPBJe1EnhxZwUUrqvj6+oB/+JhLjRbMnVh3ubZYOYS5WoeKzb47Ne6IdsUr+VjRfAq1jQOMuqLmQDN5nDLtrS3DO/eKwtYyXyibDTdDvisZ0WRb8Xyyv7mON2D3Li4ATYkY5IfbFjubGkG5Q8wRdJ43aS7qp5mSvnjFRY+KskoQomSsIri5FNhgQghUnIYROeMM2Mp+/ugQzt/TlGlBgsHiTQW0emGg6+aqLt3B6JbGnfgVGTkmju/re4cvJSWOpM0gHj0RWDutE1O6iyiKsebTnLghagbWhAl7QvVLmwTJvQ9v7VbPNlDQAw5kkJhscqLP2w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978323; bh=DZ9DSj/zpZJ3CsUxLDF6vIBJyRg0So43YHTPMQfuJzl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=TAKI7iHY46DjDMy++WItmCEFlDeyjlPs21SUXO0aljNq/2YyX2/COoN7d0+2e2YIPHsw2g5FFMEDH8l75xCjHJgb9Z/zCGVy68wfROiuG3/OXveUYSM2rTBn6QuJbBvfbfUGrqG/CPsY/BTXWtGw9fLZo8E6jkplPHW0FQ/7IGtkun1/1F0v8dNNjgyaSbctYhseiz6/Ym9cvSgDT07oW+3x8V6fYm1QZgw3PE819oS91wLUcqMna8rCyrTiFd9ffPRd/rxP2ZVNE89g0NsWE+Dz1EPjkuSABRrLzTR2j1h+x9qoKRa6m+igpzNJ+TdBY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h73OKpUJcSsYd8FiVMd yACclYtGNxBqeZWcHaMs80lwpWaE2QPMLnwEw4GhR.Rj_aKyatY2CLiyL.kpGePTCcT4yO8YGG0m 34C17PuwEmDDyXCxekBzXUchFB_QTyam7SK68sYCbjOmeoqJ2ZDwJg7aJmHV5 X-Sonic-MF: X-Sonic-ID: af215a46-7fce-4258-a2a7-e4fc20b5d1e5 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 v5 4/6] xen/igd: enable guest creation when ROM read fails Date: Wed, 5 Aug 2026 21:04:54 -0400 Message-ID: <20260806010506.492490-5-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 4887 X-purgate-ID: tlsNG-ebf023/1785978324-C04DBB50-D6FC651B/0/0 X-purgate-type: clean X-purgate-size: 4998 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978353533158500 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 Changes in v5: - Shorten info_report message to resolve checkpatch line length warning 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: Can't read Option ROM %s from host", rom_= file); goto close_rom; } =20 --=20 2.52.0 From nobody Thu Aug 13 09:24:10 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=1785978347; cv=none; d=zohomail.com; s=zohoarc; b=PHjhj4CZ3QngPgvsYFYhFjM2OG73Sc/8pcdVSMozIwU8Ou/YWCm4qixf1Kk0eNOPBtqV+2DeR74rT1qLkS0isdtopymP872moMfyFiVD2Gfb1x+5fWc2oCT9XRZIHZNp0/h13khoOJzMfLONHsQDS/TxwRe8L+/LL5iFrmBbq9E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978347; 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=evB25RMTSzQAfthgYsyzolI932AZpxXExd3y4km457k=; b=C792Hr4MNQAJqmrb6ygyeRNFit6PECJlEgCzYehsZruuFqd3vvd9bj1QwTd8ijEcNOAdU1DK0sXCN86z7CTSxcv1Cy6fSqNZ9N1T7Yu/5MOaDd0iCo5l0gfzPBsYfp3lTRNqr5rQoEnypHf5XSVIQHahmVegsGInCtSelDJ5vLE= 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 1785978347709223.29392501945915; Wed, 5 Aug 2026 18:05:47 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384040.1627147 (Exim 4.92) (envelope-from ) id 1wrmY3-00054M-8Y; Thu, 06 Aug 2026 01:05:27 +0000 Received: by outflank-mailman (output) from mailman id 1384040.1627147; Thu, 06 Aug 2026 01:05:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY3-00054B-4f; Thu, 06 Aug 2026 01:05:27 +0000 Received: by outflank-mailman (input) for mailman id 1384040; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY1-0004dF-AL for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:25 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmY0-00GWgj-NP for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:24 +0200 Received: from [10.42.69.5] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73dda4-2eae-0a2a0a5409dd-0a2a45059c28-42 for ; Thu, 06 Aug 2026 03:05:24 +0200 Received: from [66.163.191.148] (helo=sonic304-22.consmr.mail.ne1.yahoo.com) by tlsNG-c201ff.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddd2-4cb1-0a2a45050019-42a3bf94939e-3 for ; Thu, 06 Aug 2026 03:05:24 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:22 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:18 +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=1785978322; bh=evB25RMTSzQAfthgYsyzolI932AZpxXExd3y4km457k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=CGhAqESmK9usG95tKKWtvULiwhR46Cmj4l7Nr/fBR4x5IKPPJs6g38HCr2NM21HXJsUgAUJ8N6UWJ3eFdw9HzEchjDUGaIm4f8xt/2kvzrj+WFqJ3HywKjZ6P7wks6eMkEdDgcoK9EPjdQjRI9WPM++7WvzQj3ZXggg+bw86fE7eZWGkEF8U92+7krdc5x6ixZxk5oqhnFy50Jwt5TR0zxzQsp+4yHIm7Yrdxt2aUp1PoD12KMCqEcbz1yAnBsv4rxa4F7Bj2kERZSgLoXx5d20hd5PcASUj+J4eNybUcf2nGkLIK9cQfnVZnHuk5VFVUZ6Dn/VVwAMJETa2EKurgw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978322; bh=UoVOmCdCQ4BIcpmuzCu7GbBrf0XMwYbjqiL6WaXGwGX=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=q/VFzd9fSN+dkVHeetwvtfjDntAAUUfkPKWOACKE+YSrmkYhahKW7eT7a6nfZtDIcM/CR99Y3AqmyniaMKSJUYi+4RXDum1eq/BV284MZiaNzbBVgUOdjnRInHRNHQ521t8vD050DiqUmp/N1tjhxQu31YXPvkDcnpWVgguNt5eiyqDm0cILdPd12A0efbjx00kFha4ymiyWfpv+YPBZ6DwcsUGrZF3xNdgcatRfXKoEJXiDniM8gs1HRChibjD/QfQPxx8ptuOXpkFTacf2mk8jsrEY/07p/MYe3cahlwdYvcqxWUJPb89FrGPJxH1c1IgkOfKXKpKkAWEdrC92xw== X-YMail-OSG: wKTvT74VM1l3.wJJxXa53Q_pbyAuRjVyoIJPGNVxZfNtF4hUodYF0AqMELrgeBi _sIDSjSMELVdo2CAcOMn9.eiXjo4r8w_VX4pguyV9XkDtXs4YdpH4NYJEnIijAuuSbyFSHwKRThY wyM5r_edXDMtcvauaZNwzgpxzyaqXd5bf1KWjcJH5sNkRcfp4RauVUG4xj0oItng9vkKZLrJjcFq IlxEay5ao8tNb4tEEM3BNN21FL17ax_wcsqu6PQjVPQSt7Fsvu.v27vmUrKRQx15pR68rB5qz66Z iVnXJ_BgeBEdfHG_yIJALoUt8zFRwn8ehHsyX1VzcvuT8Tli5IKmqfS6AsFcEGv4rrTi0oIagr54 K_alXnfMNPBJEE3WjV3l_UAP31OKKgYg5KXelX4UlQ8jj3Pt_2fXZRr8IunNV.x477cMNx0Tf3q7 HwgTSMXl6Cx2fsZkgaNw3yNtLO834M_vSgE7sZBICincNPBUeKx5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3gHCwWErlQOaQ vH7zzFaaOHpsEkkiTPkkeFVOnP8sBwQ3alydE85Jq0d2RbXD5fRFLVWEj5LHAxBuhC1G0y30dmfa EFfPkAwXmfpcIzQNbelQDUvuZUbZqqI.TrQwmFYbRVX5I59FLHCOYqToK8Mlp70kKy0JSvHgbiMd WRvuOgCYNXul_KU3eO4ha6NHilwDP_kBbtBQHdYtI59FU2xEmCKf_oVDsH0_dKYkMgXKqxED2qTx hkh4XL9CaL5cuoR5tpoX6mzW9VwGHaq_mIXaU3Kaua5.XIEXUaU5Dhk.DUKwiBb45c6gYevdW4Lh SDh0Le2Z.AihHQCYIvlRK4B7N9ocQq1_Py6JjJNfYJwy7yaW6jh9tUPuVd7x6gc9adogTBxiUx0j qWVQJIk3h5.eh51CdStywHJQJkmd8oZ_PU3Hrg9gQAsfcLO_VWuyP2vHeG1qewFpV234E0KCnHd_ U2noFmL1g6ae.iV.kr4PtwQZSmWLDNakcws4CX3J0Vm9nDoX9z6RuHN6N.x.koGoITFtg3OXgBKF c8gsiZ7W53V0NQ3rHmGqjxwOs4w.F68jvUlGTJYrFAydsYLjTC.KvtMeDAzuakDINmvR0rm2TPXo FE74kE5q7P8OHqAoxHX2X9OLj_p9ucP2JTDNvT4mWRABeXyN6RnvWO_w5i.RgSz7CA87HmoVMvkI 0oVzK6KX9x9Nbkxo9r5PZhXsZkDi3eiyI5O.49vrt X-Sonic-MF: X-Sonic-ID: d6264233-3872-45c9-8ba3-4c440a588136 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 v5 5/6] xen/igd: implement support for extended VBT Date: Wed, 5 Aug 2026 21:04:55 -0400 Message-ID: <20260806010506.492490-6-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 14819 X-purgate-ID: tlsNG-c201ff/1785978324-720AA2A1-A7E3AB38/0/0 X-purgate-type: clean X-purgate-size: 15160 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978349586158500 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 Changes in v5: - fix style by adding braces to two if blocks and not initializing two static boolean variables to false - update the link to the companion patch for Xen hvmloader The companion patch to hvmloader that is needed to make this patch take effect is available here: https://lore.kernel.org/qemu-devel/20260802050824.10554-1-brchuckz@aol.com/ hw/xen/xen_pt_graphics.c | 233 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 225 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; +static bool done; +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,31 @@ 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 +294,195 @@ 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 Thu Aug 13 09:24:10 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=1785978351; cv=none; d=zohomail.com; s=zohoarc; b=MvOm6/WMOxG1YE5nF4VLKuTBfcy8dZRf3Lxg90Y+1kKtqvxZ68WtszRlp3ZWtwia8Ori67yJzpM9KQQYeD/GFtNj8Der7DH6QSODwsMH4uE+r7aLEFudQT9Su67LhdDaLuwDNXZByW4mJCGcrPfv0PBCN6NBwNs2TmEXFF2GVtQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1785978351; 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=WVED5z9X3DhNfWYWPsssganxjMal/mDmQeJ0RW0UVpo=; b=eOeEY/jnz8IVrzykHv2YNkMPm5zd8ERtRn7H7d6c0mHxxJsnB35QyuMsWKY2gGOS8qfblmBAdvGydSFKFkBK1zXCsRyUtDXtA+k3jc6Z9xXTOQ249njqytEksnJa1lKi6AjBPDwLs9W7rykJr6fsDALnslufSF/l8G2QXUk0UZQ= 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 1785978351243824.7231564152114; Wed, 5 Aug 2026 18:05:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1384043.1627165 (Exim 4.92) (envelope-from ) id 1wrmY6-0005aQ-3G; Thu, 06 Aug 2026 01:05:30 +0000 Received: by outflank-mailman (output) from mailman id 1384043.1627165; Thu, 06 Aug 2026 01:05:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY6-0005aH-0C; Thu, 06 Aug 2026 01:05:30 +0000 Received: by outflank-mailman (input) for mailman id 1384043; Thu, 06 Aug 2026 01:05:28 +0000 Received: from mx.expurgate.net ([194.145.224.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1wrmY4-0005Nq-MO for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 01:05:28 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1wrmY4-00GWgj-3E for xen-devel@lists.xenproject.org; Thu, 06 Aug 2026 03:05:28 +0200 Received: from [10.42.69.5] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6a73dda4-2eae-0a2a0a5409dd-0a2a45059c28-46 for ; Thu, 06 Aug 2026 03:05:28 +0200 Received: from [66.163.186.146] (helo=sonic302-20.consmr.mail.ne1.yahoo.com) by tlsNG-c201ff.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6a73ddd6-4cb1-0a2a45050019-42a3ba928c39-3 for ; Thu, 06 Aug 2026 03:05:27 +0200 Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ne1.yahoo.com with HTTP; Thu, 6 Aug 2026 01:05:26 +0000 Received: by hermes--production-bf1-54b5569bdc-xjdx5 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 734f0c8329adecc00a98ec91cc943adb; Thu, 06 Aug 2026 01:05:20 +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=1785978326; bh=WVED5z9X3DhNfWYWPsssganxjMal/mDmQeJ0RW0UVpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=ZocemVWyPNNRVCWp7tcTVgsj+okAl85RtnTc32+vJJ5sadpkFdJjGYhONhinL4v0zs+y+IwypGr20hAbhYz82xNsU+5MJVf7NWpB5o2LFRUZfsHpCu93egs1ixYs3kNRLbF6W/XJpFIgY5RMP4y+r0XOiixz1/MzjFYhn8+ovaC8s6o/6KDB8NIgdig7PcGQ7FRHRzp06DRAljcH2flA8PplF1h9GAGo0Hn5AtcDov9pSdGA82sL0FvnWrXVL1/13gYiNN04kw3IL9UmqxeHQIiAoOVwU/yRrGiyfxnGxxDxyaw4P7K7SVDzEJXVLtM8g7aPR0p627Fzr11HxMQZCg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1785978326; bh=7iBAhNNuxjWjoR7/fE95Vs5pQIIIvyJSx7pSZDa7+RG=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=RNdXb/80spp6ENsUBxZI+42NUmGBdhNVnseX9RZtUI1LW2pzFeivMyNFP6yqM9RPGJ1/z6T/MCYOys8zdj5q9OyVwlpE0llOzSxclN62i+7AsrDqWaGxsLepTvuro9CuKjR0Tk4AXTut5OdGuwsoa7Ee8zqMICWW05o3BtGHirls/P+hzqk9yAOC19chNdfvrYuvMhnPUyKpr401hCLoSvaiLeJJjpKEIuj9+WC0wsJHe2bsscZtiy/eXR7NljIp2rbY1kLkSowLF7EsbeDS9JXSg2Q7MVY4Wsf0ka8tOzGEwm7TbUWtU6+9hh49QcvOR+DFaHdrFxxqINC2INxnxQ== X-YMail-OSG: Bt9JW_UVM1lR7EDyBjBA4WITfblYAyVeX6sJfDcmO2E6TQejB0h7rMfn06k5CMk ePEHp0_1iFs3i4ESLe02aQZo6cc_EbOXlyVBMIOMSSWcZM2zSvHENUIru3gS5CRGqBBSd3.iZc2w whauvyh.OKTC26zl5Gcp13d1FeER4Ftf7qGC4PpsYV7MXAPiOYQS2jcGesa_xLvzfkvYggDcJ2rg bcLAJQhNHUa5g0B.YnoK29i_Qzko2SxW62S2_dk53np1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I2SXkVEzLx8oCLEzB65MCsrlBMsPgoHP nD2JR5xNQTgKIfniy20WZBz7IZmJr10A_R0kNYhbGqyOvnPYZuReA3tC3hohLmjr2VsI4.hlW5No hoU.iaE8.0Ni4rC88p29TUS5rnlC469QdQAtsb0uKqA2yMRIA4.ajIirQZRLQ6TU2OQm11x5UyJY f6huFuXm6eSBRlvVTfsagdnxWoo6ICAUVzGIQzp45MI2U41eNyGJ8RUnFU5qiU42tL9NI5i3xdTz 0L6be12TygPAfgiIDblB4zvby0K6SP_DBkP_RmkmotWWAEi2Ts3XrpYk8u1pekRTS33Bm.ko06wd soDlY9sAQYIEieX.7JU0cATWifWoLfcJS5O7EionM0m85RzoodGGZdlAKx7_8biI.GZJCL_qFmHj plIxPmwToxiPaOxC1tZ1wDUlJRwpUxEQ3kkrJkWCLjwhFEJ0CLdD7lvKXhHdQ_fMF1P2ZTSfrdvL qyPsuj0x.CDQMpggTsnfgKNdnGaMjqPWMGLJCuFnWvcK84UFfdJOJT89pALzbqDdU3bM6h_znBgU JXN0M6drr7GLt.aHUL7sCuD1snJEkznEzqEwFOUTmzYGzigQ9sizb6J3vuvCcyeQwETN9oMCw3J8 3sZb.j4j0Lhe63EN.L8FqFTdJtbMYm7EFH1Rq4kev0eC_vDQzQptA_72ml7g_gLXkF4FVVC0aYdR 73ulu5L7rRI.cn.q32eadpWxNvEi2VcMu7Q1d7mkEzn1q6b1rTob_1u52jDUxNmi8uoF.O5gG82h eQGgOQSK06ah8lTI6xYjO_2wE0uFrLinYUth33L8ND6Ey.Jx_lEtT7dEaBfPnXmpsEZBuoQU0FMW gpnwNHzWh1jiQaldlp5KQ6oRpSxjwYRqnlIzF.TZXQhXmOsIkECPQWnght4nZB2H1HMhJeeGrpcy 60bgAaiL64O0UuyZHGa8cfiYNBIOkhahnYCGd X-Sonic-MF: X-Sonic-ID: 1c24a953-a693-4bad-a4c9-6097629114f1 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 v5 6/6] xen/igd: use custom option ROM if provided Date: Wed, 5 Aug 2026 21:04:56 -0400 Message-ID: <20260806010506.492490-7-brchuckz@aol.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260806010506.492490-1-brchuckz@aol.com> References: <20260806010506.492490-1-brchuckz@aol.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Length: 8875 X-purgate-ID: tlsNG-c201ff/1785978328-F4AA72A1-E2944F08/0/0 X-purgate-type: clean X-purgate-size: 9089 X-ZohoMail-DKIM: pass (identity @aol.com) X-ZM-MESSAGEID: 1785978353583158500 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 Changes in v5: - Fix wrong whitespace in three places in a conditional block 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