qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Tomita Moeko <tomitamoeko@gmail.com>
Cc: qemu-devel@nongnu.org, "Cédric Le Goater" <clg@redhat.com>,
	"Corvin Köhne" <c.koehne@beckhoff.com>
Subject: Re: [PATCH v2 7/9] vfio/igd: emulate GGC register in mmio bar0
Date: Wed, 4 Dec 2024 15:35:34 -0700	[thread overview]
Message-ID: <20241204153534.34e76045.alex.williamson@redhat.com> (raw)
In-Reply-To: <20241203133548.38252-8-tomitamoeko@gmail.com>

On Tue,  3 Dec 2024 21:35:46 +0800
Tomita Moeko <tomitamoeko@gmail.com> wrote:

> The GGC register at 0x50 of pci config space is a mirror of the same
> register at 0x108040 of mmio bar0 [1]. i915 driver also reads that
> register from mmio bar0 instead of config space. As GGC is programmed
> and emulated by qemu, the mmio address should also be emulated, in the
> same way of BDSM register.
> 
> [1] 4.1.28, 12th Generation Intel Core Processors Datasheet Volume 2
>     https://www.intel.com/content/www/us/en/content-details/655259
> 
> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
> ---
>  hw/vfio/igd.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index 522845c509..bc18fc8cc0 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -483,8 +483,10 @@ static const MemoryRegionOps vfio_igd_quirk_mirror_##name = {           \
>      .endianness = DEVICE_LITTLE_ENDIAN,                                 \
>  };
>  
> +VFIO_IGD_QUIRK_MIRROR_REG(IGD_GMCH, ggc)
>  VFIO_IGD_QUIRK_MIRROR_REG(IGD_BDSM_GEN11, bdsm)
>  
> +#define IGD_GGC_MMIO_OFFSET     0x108040
>  #define IGD_BDSM_MMIO_OFFSET    0x1080C0
>  
>  void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
> @@ -513,9 +515,16 @@ void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
>          return;
>      }
>  
> -    quirk = vfio_quirk_alloc(1);
> +    quirk = vfio_quirk_alloc(2);
>      quirk->data = vdev;
>  
> +    memory_region_init_io(&quirk->mem[0], OBJECT(vdev),
> +                          &vfio_igd_quirk_mirror_ggc, vdev,
> +                          "vfio-igd-ggc-quirk", 2);
> +    memory_region_add_subregion_overlap(vdev->bars[0].region.mem,
> +                                        IGD_GGC_MMIO_OFFSET, &quirk->mem[0],
> +                                        1);
> +
>      memory_region_init_io(&quirk->mem[1], OBJECT(vdev),
>                            &vfio_igd_quirk_mirror_bdsm, vdev,
>                            "vfio-igd-bdsm-quirk", 8);

Seems like trying to keep these ordered by offset is what introduced
the bug in the previous patch.  Let's not care about that, use the next
index and setup in index order.  Thanks,

Alex



  reply	other threads:[~2024-12-04 22:36 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-03 13:35 [PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices Tomita Moeko
2024-12-03 13:35 ` [PATCH v2 1/9] vfio/igd: remove unsupported device ids Tomita Moeko
2024-12-03 13:35 ` [PATCH v2 2/9] vfio/igd: align generation with i915 kernel driver Tomita Moeko
2024-12-03 16:07   ` Corvin Köhne
2024-12-04 22:36   ` Alex Williamson
2024-12-05  9:26     ` Tomita Moeko
2024-12-03 13:35 ` [PATCH v2 3/9] vfio/igd: canonicalize memory size calculations Tomita Moeko
2024-12-03 16:12   ` Corvin Köhne
2024-12-04 22:35   ` Alex Williamson
2024-12-05 10:13     ` Tomita Moeko
2024-12-03 13:35 ` [PATCH v2 4/9] vfio/igd: add Gemini Lake and Comet Lake device ids Tomita Moeko
2024-12-03 16:15   ` Corvin Köhne
2024-12-03 13:35 ` [PATCH v2 5/9] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper " Tomita Moeko
2024-12-03 16:18   ` Corvin Köhne
2024-12-03 13:35 ` [PATCH v2 6/9] vfio/igd: add macro for declaring mirrored registers Tomita Moeko
2024-12-03 16:22   ` Corvin Köhne
2024-12-04 22:35   ` Alex Williamson
2024-12-03 13:35 ` [PATCH v2 7/9] vfio/igd: emulate GGC register in mmio bar0 Tomita Moeko
2024-12-04 22:35   ` Alex Williamson [this message]
2024-12-03 13:35 ` [PATCH v2 8/9] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices Tomita Moeko
2024-12-03 16:24   ` Corvin Köhne
2024-12-03 13:35 ` [PATCH v2 9/9] vfio/igd: add x-igd-gms option back to set DSM region size for guest Tomita Moeko
2024-12-03 16:30   ` Corvin Köhne
2024-12-04 22:35     ` Alex Williamson
2024-12-03 20:12 ` [PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices Alex Williamson
2024-12-04 15:08   ` Tomita Moeko
2024-12-29 16:43     ` Tomita Moeko

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=20241204153534.34e76045.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=c.koehne@beckhoff.com \
    --cc=clg@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).