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 2/9] vfio/igd: align generation with i915 kernel driver
Date: Wed, 4 Dec 2024 15:36:10 -0700 [thread overview]
Message-ID: <20241204153610.09764d56.alex.williamson@redhat.com> (raw)
In-Reply-To: <20241203133548.38252-3-tomitamoeko@gmail.com>
On Tue, 3 Dec 2024 21:35:41 +0800
Tomita Moeko <tomitamoeko@gmail.com> wrote:
> Define the igd device generations according to i915 kernel driver to
> avoid confusion, and adjust comment placement to clearly reflect the
> relationship between ids and devices.
>
> The condition of how GTT stolen memory size is calculated is changed
> accordingly as GGMS is in multiple of 2 starting from gen 8.
>
> Signed-off-by: Tomita Moeko <tomitamoeko@gmail.com>
> ---
> hw/vfio/igd.c | 44 ++++++++++++++++++++++----------------------
> 1 file changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c
> index 6ba3045bf3..2ede72d243 100644
> --- a/hw/vfio/igd.c
> +++ b/hw/vfio/igd.c
> @@ -59,33 +59,33 @@
> */
> static int igd_gen(VFIOPCIDevice *vdev)
> {
> - if ((vdev->device_id & 0xfff) == 0xa84) {
> - return 8; /* Broxton */
> + /*
> + * Device IDs for Broxton/Apollo Lake are 0x0a84, 0x1a84, 0x1a85, 0x5a84
> + * and 0x5a85
> + */
Your comment from review of v1 would be useful here that we can't use
the test below, at least for 0x0a84, because it conflicts with Haswell.
I'd forgotten that.
Since we're being more strict about what we support now, it may make
sense to list specific IDs rather than this sloppy match, as Corvin
suggested, but that could be a follow-on. Thanks,
Alex
> + if ((vdev->device_id & 0xffe) == 0xa84) {
> + return 9;
> }
>
> switch (vdev->device_id & 0xff00) {
> - /* SandyBridge, IvyBridge, ValleyView, Haswell */
> - case 0x0100:
> - case 0x0400:
> - case 0x0a00:
> - case 0x0c00:
> - case 0x0d00:
> - case 0x0f00:
> + case 0x0100: /* SandyBridge, IvyBridge */
> return 6;
> - /* BroadWell, CherryView, SkyLake, KabyLake */
> - case 0x1600:
> - case 0x1900:
> - case 0x2200:
> - case 0x5900:
> + case 0x0400: /* Haswell */
> + case 0x0a00: /* Haswell */
> + case 0x0c00: /* Haswell */
> + case 0x0d00: /* Haswell */
> + case 0x0f00: /* Valleyview/Bay Trail */
> + return 7;
> + case 0x1600: /* Broadwell */
> + case 0x2200: /* Cherryview */
> return 8;
> - /* CoffeeLake */
> - case 0x3e00:
> + case 0x1900: /* Skylake */
> + case 0x5900: /* Kaby Lake */
> + case 0x3e00: /* Coffee Lake */
> return 9;
> - /* ElkhartLake */
> - case 0x4500:
> + case 0x4500: /* Elkhart Lake */
> return 11;
> - /* TigerLake */
> - case 0x9A00:
> + case 0x9A00: /* Tiger Lake */
> return 12;
> }
>
> @@ -258,7 +258,7 @@ static int vfio_igd_gtt_max(VFIOPCIDevice *vdev)
>
> gmch = vfio_pci_read_config(&vdev->pdev, IGD_GMCH, sizeof(gmch));
> ggms = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
> - if (gen > 6) {
> + if (gen >= 8) {
> ggms = 1 << ggms;
> }
>
> @@ -668,7 +668,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
>
> /* Determine the size of stolen memory needed for GTT */
> ggms_mb = (gmch >> (gen < 8 ? 8 : 6)) & 0x3;
> - if (gen > 6) {
> + if (gen >= 8) {
> ggms_mb = 1 << ggms_mb;
> }
>
next prev parent 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 [this message]
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
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=20241204153610.09764d56.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).