From nobody Tue Nov 18 18:25:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611948683; cv=none; d=zohomail.com; s=zohoarc; b=lVhF+Pn4cYNO4j9/iPjFhhOVUY41Qmr+JXbfWkdFOZNIXevrot/3Qtgf1JmAeUXEtnoADDB9Pxzg8r0uWtT3lyVjL0jGYPhAwgJaOJlNstzyi0E9h4HLeGFJ8YTwR00Z6r7S1/pJPAhYzx2T6dC4sW2OEbZkBKiRKjL7w2P22Mk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611948683; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=AzYhMXskdJJjtZLtwvwFrwykEA7TzJv7brNc4V8DwwQ=; b=HVh8vpXzmXncqh2pPhDGqqgYWY29ba1ytwzrXYonjL5o8cQixIxs7PnkFm4QGCXV//NfPWQvAZ5a4vm3r4FS8AroW4c0KV7Ni+3psuxGhMer1US2Kqx6cC9Qc0WnWfwuKsIrRqa217ubnLaftT62IBw8o3vGu4ykt4LeBl+vpxI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16119486836441.4291506794845645; Fri, 29 Jan 2021 11:31:23 -0800 (PST) Received: from localhost ([::1]:44074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5ZUI-0000c6-DO for importer@patchew.org; Fri, 29 Jan 2021 14:31:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41184) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5ZRl-0007iB-6U for qemu-devel@nongnu.org; Fri, 29 Jan 2021 14:28:45 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]:40184) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5ZRj-00074r-9H for qemu-devel@nongnu.org; Fri, 29 Jan 2021 14:28:44 -0500 Received: by mail-wr1-x42b.google.com with SMTP id c12so9957042wrc.7 for ; Fri, 29 Jan 2021 11:28:42 -0800 (PST) Received: from avogadro.lan ([93.56.170.5]) by smtp.gmail.com with ESMTPSA id l18sm10964528wme.37.2021.01.29.11.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 11:28:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AzYhMXskdJJjtZLtwvwFrwykEA7TzJv7brNc4V8DwwQ=; b=T+0WR4g0R9JUihpKjrkHemFcAtSqlzspGH8v8sRYC1V1QMFLK0R9AS05hhXk8GzhCd Baq0Lf+GoxxOo1qOyPvpajtm03rqYe2CfngXsNz6Su/L0ojbUOVnLQwGOt7NT0n4og0K tg1EAdb7d2goY45/miycO1umu0danQfP8fJeFeFqTZjaInkCsyFhnxVu8XTPygrcHQ1S 5mbb6YXU5D/szm6O265+LB7bH7z6gdcNwnH3CKizfpouTfStPHFY+T+Mu1GG75JDIKlt QwRQsj7Obc5WEgHWAy7uLG446e5gEArdG5cor1uh2dUFJU4p0nwoXQpxo9PXU5VcDr5i g1JA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AzYhMXskdJJjtZLtwvwFrwykEA7TzJv7brNc4V8DwwQ=; b=opRc5SCRy0d+4IeYKvlfyzk7KFI3D3mKfNbYDY4jD3Z+QOzsmdU3Jg4X0oYWKmqd/K 17IVkQJB9qZWXelo5zAhzAsvDtWKpB5mRIduIaAz3JGMLHXItzCXdWthd2DqbGUJOAue CmNr5voXkgfMvKIgVMXDSn7lY2nbsTylDZH+nFawHYtfVMuFfPEBCDeguxs9x3Z8H91W d9JkjJNF+5guTao2gDmQw5Km2/g/gUM8bsFxh13lnn1J6Q/4Q6b2QI3pOF4E1zyqu6kl rI1I/r+a5mLVPz43HoPCurLSLcHyFnVrcZfVtvnTVJ6BwXpL+fvueQ8URLaaXEQGMfO6 mN7w== X-Gm-Message-State: AOAM530G4e11nYae1qu5IqERcyo1ynaRd5ce6IGujVEUgh+TiY23CfZs o6rMXMASPlrd5kNuyjx0AX/dxSEeeXnqKg== X-Google-Smtp-Source: ABdhPJwm583lXGNZqKPsn39SYMDSzZDjmpHFvoiUdiihS9FbR/oaYlCllbTbp47NjjOgphFe8zeGLw== X-Received: by 2002:a5d:5908:: with SMTP id v8mr6436747wrd.113.1611948521600; Fri, 29 Jan 2021 11:28:41 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 1/2] pci: reject too large ROMs Date: Fri, 29 Jan 2021 20:28:37 +0100 Message-Id: <20210129192838.582771-2-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210129192838.582771-1-pbonzini@redhat.com> References: <20210129192838.582771-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42b; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42b.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, dgilbert@redhat.com, peterx@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" get_image_size() returns an int64_t, which pci_add_option_rom() assigns to an "int" without any range checking. A 32-bit BAR could be up to 2 GiB in size, so reject anything above it. In order to accomodate a rounded-up size of 2 GiB, change pci_patch_ids's size argument to unsigned. Signed-off-by: Paolo Bonzini Reviewed-by: Laszlo Ersek Reviewed-by: Peter Xu Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/pci/pci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index a6b0c5602e..bbce10050b 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -25,6 +25,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" #include "qemu/datadir.h" +#include "qemu/units.h" #include "hw/irq.h" #include "hw/pci/pci.h" #include "hw/pci/pci_bridge.h" @@ -2258,7 +2258,7 @@ static uint8_t pci_find_capability_at_offset(PCIDevic= e *pdev, uint8_t offset) =20 /* Patch the PCI vendor and device ids in a PCI rom image if necessary. This is needed for an option rom which is used for more than one device= . */ -static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, int size) +static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, uint32_t size) { uint16_t vendor_id; uint16_t device_id; @@ -2316,7 +2316,7 @@ static void pci_patch_ids(PCIDevice *pdev, uint8_t *p= tr, int size) static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, Error **errp) { - int size; + int64_t size; char *path; void *ptr; char name[32]; @@ -2366,6 +2366,11 @@ static void pci_add_option_rom(PCIDevice *pdev, bool= is_default_rom, error_setg(errp, "romfile \"%s\" is empty", pdev->romfile); g_free(path); return; + } else if (size > 2 * GiB) { + error_setg(errp, "romfile \"%s\" too large (size cannot exceed 2 G= iB)", + pdev->romfile); + g_free(path); + return; } size =3D pow2ceil(size); =20 --=20 2.29.2 From nobody Tue Nov 18 18:25:06 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1611948701; cv=none; d=zohomail.com; s=zohoarc; b=et7Pen2imH9jIBGjRgdCsha3W6BxadXV4h51HcakbnxUfBiRIM7Yv059Ko881m8oBgD30JRc/0t50W7GmxNHsXUqo/SvAUggEYk3+c8/6OtW0bYOahpjq4CaUdqfCvJ34XsPzU0uAD8rWNRiTwCguIVm2K4JVX5BTDIKITrfG+Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1611948701; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=VsxrnpQIEyMpLuKjsP9+lNnAfNbvL69yjYGVToDbKAU=; b=UihkP5TQp3sUtALaYxBGPgBKTdq8bB/ULqh8e46/wAs4aXnfyTy4qHVHyz3WUUIs7AgJCtqzSz5CVHRuAtAhZqShgPhvkslr4j4cLFMrWRRQQD0XzVP2721SolsObTzsxiO6sq7LEnFUoO0rooxkina7Pa5XNlpoiz3KotGcBPk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1611948701293860.039468858953; Fri, 29 Jan 2021 11:31:41 -0800 (PST) Received: from localhost ([::1]:44216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5ZUa-0000fa-5v for importer@patchew.org; Fri, 29 Jan 2021 14:31:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5ZRm-0007jK-GQ for qemu-devel@nongnu.org; Fri, 29 Jan 2021 14:28:46 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]:40185) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5ZRk-00075e-0T for qemu-devel@nongnu.org; Fri, 29 Jan 2021 14:28:45 -0500 Received: by mail-wr1-x42c.google.com with SMTP id c12so9957087wrc.7 for ; Fri, 29 Jan 2021 11:28:43 -0800 (PST) Received: from avogadro.lan ([93.56.170.5]) by smtp.gmail.com with ESMTPSA id l18sm10964528wme.37.2021.01.29.11.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 11:28:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VsxrnpQIEyMpLuKjsP9+lNnAfNbvL69yjYGVToDbKAU=; b=RCQsBarBcQqvTYL3bio8rJpIO+jJJbLHCDbIfP4HfpTs8/FJNNmQvQmxtfAo/esc93 yGzs7N0QPtoPObbj3MtWwdsqjuI4KwZlWzbk92riq8gdmaMa29HyM6rOSj3f6ohe3Z4l jM/gdZipQYOaonkPyDLcivjQvBkJEdK8TNYfHPHkybrEN+WcymLyxw3TwCI+xsHbW85h cDwi6LvzHNFxTrBlNqCw/cNeu4MaglFswS6tadKQE+e0Aj2LKkxgy7KoF45t6Nw7xIYF Oi6QSjleQwlmiy16i5GoouoRbTulyeUdBDJMOoj/53RERQk1kNuWPTBsZ2LPvsLC72k+ GqBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=VsxrnpQIEyMpLuKjsP9+lNnAfNbvL69yjYGVToDbKAU=; b=HKtfwLAXcq+0kejP6W18YjKLG1C+GeCKe4i6jFqxB+rODTH4WAYNcSAA/1kXO8btgE /6kG6r7KHKMMnnwH0IHn5WSSlK0CL4cVUG7CTrlboCuyhis7jLtdY9mbunuDvDqNGtdy AoJk6hbIci+MmjMhQYDQ2XaPOJReCTUN21DvISQAjIyf6foEhCB48G7yMC8HJcWZEmHX z/mFp+qqpypOQwBWtAa7MmntfsCguQTyF4xrdFpg/TPCEdhC5PWFeLLTbhEW2zKmQPO1 Jv8Yr+oKsFud7WI7se4dR5yeeTs6nGsqb2fkQdEgAOBTVRtk+KtRMrQtwnTXH+aesYoi LWDw== X-Gm-Message-State: AOAM5325fA8sukRSeTwLj3wlfIOwpvNJkQrLZHBYCOnn9Rjk09t6HqYv T0Z0EOQv86fzqQmrs4itMqP2AXrTYXFDGg== X-Google-Smtp-Source: ABdhPJyuxs9mRPrlu5oabsH3uT7XjPBiDTl+lfQmxgsGOXD6NiGAn7cW0OAX48Gk5gd8hExRXxSBQQ== X-Received: by 2002:a05:6000:1141:: with SMTP id d1mr6178190wrx.47.1611948522778; Fri, 29 Jan 2021 11:28:42 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH v2 2/2] pci: add romsize property Date: Fri, 29 Jan 2021 20:28:38 +0100 Message-Id: <20210129192838.582771-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210129192838.582771-1-pbonzini@redhat.com> References: <20210129192838.582771-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=paolo.bonzini@gmail.com; helo=mail-wr1-x42c.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lersek@redhat.com, dgilbert@redhat.com, peterx@redhat.com, mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This property can be useful for distros to set up known-good ROM sizes for migration purposes. The VM will fail to start if the ROM is too large, and migration compatibility will not be broken if the ROM is too small. Note that even though romsize is a uint32_t, it has to be between 1 (because empty ROM files are not accepted, and romsize must be greater than the file) and 2^31 (because values above are not powers of two and are rejected). Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Peter Xu Signed-off-by: Paolo Bonzini Acked-by: Laszlo Ersek --- hw/pci/pci.c | 19 +++++++++++++++++-- hw/xen/xen_pt_load_rom.c | 14 ++++++++++++-- include/hw/pci/pci.h | 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/hw/pci/pci.c b/hw/pci/pci.c index bbce10050b..5b3fe3c294 100644 --- a/hw/pci/pci.c +++ b/hw/pci/pci.c @@ -68,6 +68,7 @@ static void pcibus_reset(BusState *qbus); static Property pci_props[] =3D { DEFINE_PROP_PCI_DEVFN("addr", PCIDevice, devfn, -1), DEFINE_PROP_STRING("romfile", PCIDevice, romfile), + DEFINE_PROP_UINT32("romsize", PCIDevice, romsize, -1), DEFINE_PROP_UINT32("rombar", PCIDevice, rom_bar, 1), DEFINE_PROP_BIT("multifunction", PCIDevice, cap_present, QEMU_PCI_CAP_MULTIFUNCTION_BITNR, false), @@ -2107,6 +2108,11 @@ static void pci_qdev_realize(DeviceState *qdev, Erro= r **errp) bool is_default_rom; uint16_t class_id; =20 + if (pci_dev->romsize !=3D -1 && !is_power_of_2(pci_dev->romsize)) { + error_setg(errp, "ROM size %d is not a power of two", pci_dev->rom= size); + return; + } + /* initialize cap_present for pci_is_express() and pci_config_size(), * Note that hybrid PCIs are not set automatically and need to manage * QEMU_PCI_CAP_EXPRESS manually */ @@ -2372,7 +2378,16 @@ static void pci_add_option_rom(PCIDevice *pdev, bool= is_default_rom, g_free(path); return; } - size =3D pow2ceil(size); + if (pdev->romsize !=3D -1) { + if (size > pdev->romsize) { + error_setg(errp, "romfile \"%s\" (%u bytes) is too large for R= OM size %u", + pdev->romfile, (uint32_t)size, pdev->romsize); + g_free(path); + return; + } + } else { + pdev->romsize =3D pow2ceil(size); + } =20 vmsd =3D qdev_get_vmsd(DEVICE(pdev)); =20 @@ -2382,7 +2397,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool = is_default_rom, snprintf(name, sizeof(name), "%s.rom", object_get_typename(OBJECT(= pdev))); } pdev->has_rom =3D true; - memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, size, &error_fa= tal); + memory_region_init_rom(&pdev->rom, OBJECT(pdev), name, pdev->romsize, = &error_fatal); ptr =3D memory_region_get_ram_ptr(&pdev->rom); if (load_image_size(path, ptr, size) < 0) { error_setg(errp, "failed to load romfile \"%s\"", pdev->romfile); diff --git a/hw/xen/xen_pt_load_rom.c b/hw/xen/xen_pt_load_rom.c index a50a80837e..153812f8cd 100644 --- a/hw/xen/xen_pt_load_rom.c +++ b/hw/xen/xen_pt_load_rom.c @@ -53,10 +53,20 @@ void *pci_assign_dev_load_option_rom(PCIDevice *dev, } fseek(fp, 0, SEEK_SET); =20 + if (dev->romsize !=3D -1) { + if (st.st_size > dev->romsize) { + error_report("ROM BAR \"%s\" (%ld bytes) is too large for ROM = size %d", + rom_file, (long) st.st_size, dev->romsize); + goto close_rom; + } + } else { + dev->romsize =3D st.st_size; + } + snprintf(name, sizeof(name), "%s.rom", object_get_typename(owner)); - memory_region_init_ram(&dev->rom, owner, name, st.st_size, &error_abor= t); + memory_region_init_ram(&dev->rom, owner, name, dev->romsize, &error_ab= ort); ptr =3D memory_region_get_ram_ptr(&dev->rom); - memset(ptr, 0xff, st.st_size); + 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); diff --git a/include/hw/pci/pci.h b/include/hw/pci/pci.h index 259f9c992d..b028245b62 100644 --- a/include/hw/pci/pci.h +++ b/include/hw/pci/pci.h @@ -343,6 +343,7 @@ struct PCIDevice { =20 /* Location of option rom */ char *romfile; + uint32_t romsize; bool has_rom; MemoryRegion rom; uint32_t rom_bar; --=20 2.29.2