All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Tomita Moeko <tomitamoeko@gmail.com>
Cc: qemu-devel@nongnu.org, "Alex Williamson" <alex@shazbot.org>,
	"Cédric Le Goater" <clg@redhat.com>,
	"K S Maan" <kirandeepmaan45@gmail.com>
Subject: Re: [PATCH v3 3/7] hw/pci: Introduce rom_need_patch_id flag in PCIDevice
Date: Fri, 26 Jun 2026 06:30:03 -0400	[thread overview]
Message-ID: <20260626062957-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20260617100646.28326-4-tomitamoeko@gmail.com>

On Wed, Jun 17, 2026 at 06:06:40PM +0800, Tomita Moeko wrote:
> Allow external code (e.g., VFIO IGD passthrough) to request PCI ID
> patching for a custom romfile, replacing the existing is_default_rom
> flag for this purpose.
> 
> Reported-by: K S Maan <kirandeepmaan45@gmail.com>
> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>

Acked-by: Michael S. Tsirkin <mst@redhat.com>

> ---
>  hw/pci/pci.c                | 14 ++++++--------
>  include/hw/pci/pci_device.h |  1 +
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/pci/pci.c b/hw/pci/pci.c
> index 8e7872523a..b4235834a0 100644
> --- a/hw/pci/pci.c
> +++ b/hw/pci/pci.c
> @@ -352,7 +352,7 @@ static const TypeInfo cxl_bus_info = {
>  
>  static void pci_update_mappings(PCIDevice *d);
>  static void pci_irq_handler(void *opaque, int irq_num, int level);
> -static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom, Error **);
> +static void pci_add_option_rom(PCIDevice *pdev, Error **);
>  static void pci_del_option_rom(PCIDevice *pdev);
>  
>  static uint16_t pci_default_sub_vendor_id = PCI_SUBVENDOR_ID_REDHAT_QUMRANET;
> @@ -2257,7 +2257,6 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
>      PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(pci_dev);
>      ObjectClass *klass = OBJECT_CLASS(pc);
>      Error *local_err = NULL;
> -    bool is_default_rom;
>      uint16_t class_id;
>  
>      /*
> @@ -2370,13 +2369,13 @@ static void pci_qdev_realize(DeviceState *qdev, Error **errp)
>      }
>  
>      /* rom loading */
> -    is_default_rom = false;
>      if (pci_dev->romfile == NULL && pc->romfile != NULL) {
> +        /* using a built-in default rom */
>          pci_dev->romfile = g_strdup(pc->romfile);
> -        is_default_rom = true;
> +        pci_dev->rom_need_patch_id = true;
>      }
>  
> -    pci_add_option_rom(pci_dev, is_default_rom, &local_err);
> +    pci_add_option_rom(pci_dev, &local_err);
>      if (local_err) {
>          error_propagate(errp, local_err);
>          pci_qdev_unrealize(DEVICE(pci_dev));
> @@ -2555,8 +2554,7 @@ static void pci_patch_ids(PCIDevice *pdev, uint8_t *ptr, uint32_t size)
>  }
>  
>  /* Add an option rom for the device */
> -static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
> -                               Error **errp)
> +static void pci_add_option_rom(PCIDevice *pdev, Error **errp)
>  {
>      int64_t size = 0;
>      g_autofree char *path = NULL;
> @@ -2654,7 +2652,7 @@ static void pci_add_option_rom(PCIDevice *pdev, bool is_default_rom,
>              return;
>          }
>  
> -        if (is_default_rom) {
> +        if (pdev->rom_need_patch_id) {
>              /* Only the default rom images will be patched (if needed). */
>              pci_patch_ids(pdev, ptr, size);
>          }
> diff --git a/include/hw/pci/pci_device.h b/include/hw/pci/pci_device.h
> index 5cac6e1688..8b9b6470e9 100644
> --- a/include/hw/pci/pci_device.h
> +++ b/include/hw/pci/pci_device.h
> @@ -157,6 +157,7 @@ struct PCIDevice {
>      char *romfile;
>      uint32_t romsize;
>      bool has_rom;
> +    bool rom_need_patch_id;
>      MemoryRegion rom;
>      int32_t rom_bar;
>  
> -- 
> 2.53.0



  reply	other threads:[~2026-06-26 10:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 10:06 [PATCH v3 0/7] vfio/igd: Fix garbled screen on IGD passthrough with legacy VBIOS Tomita Moeko
2026-06-17 10:06 ` [PATCH v3 1/7] hw/pci: Recalculate option ROM checksum before patching ID Tomita Moeko
2026-06-26 10:23   ` Michael S. Tsirkin
2026-06-17 10:06 ` [PATCH v3 2/7] hw/pci: Skip EFI option ROM in pci_patch_ids() Tomita Moeko
2026-06-26 10:29   ` Michael S. Tsirkin
2026-06-17 10:06 ` [PATCH v3 3/7] hw/pci: Introduce rom_need_patch_id flag in PCIDevice Tomita Moeko
2026-06-26 10:30   ` Michael S. Tsirkin [this message]
2026-06-17 10:06 ` [PATCH v3 4/7] hw/pci: Promote pci_patch_ids() to public pci_rom_patch_ids() Tomita Moeko
2026-06-26 10:30   ` Michael S. Tsirkin
2026-06-17 10:06 ` [PATCH v3 5/7] vfio/igd: Toggle rom_need_patch_id flag on IGD devices Tomita Moeko
2026-06-17 10:06 ` [PATCH v3 6/7] vfio/pci: Use pci_rom_patch_ids() for IGD ROM ID patching Tomita Moeko
2026-06-17 10:06 ` [PATCH v3 7/7] vfio/igd: Clear saved BDSM in legacy VBIOS ROM at load time Tomita Moeko
2026-06-18  6:42 ` [PATCH v3 0/7] vfio/igd: Fix garbled screen on IGD passthrough with legacy VBIOS Cédric Le Goater
2026-06-18  7:02 ` K S Maan
2026-06-18  8:34   ` Cédric Le Goater
2026-06-18 10:21     ` K S Maan
2026-06-18 10:36       ` Cédric Le Goater
2026-06-18 10:40     ` Cédric Le Goater
2026-06-23 21:32 ` Alex Williamson
2026-06-24  6:28 ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260626062957-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alex@shazbot.org \
    --cc=clg@redhat.com \
    --cc=kirandeepmaan45@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=tomitamoeko@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.