Re: [PATCH v2] vfio: Add property documentation

2025-02-14 Thread Corvin Köhne
On Thu, 2025-02-13 at 14:45 -0700, Alex Williamson wrote: > On Thu, 13 Feb 2025 14:50:50 +0100 > Cédric Le Goater wrote: > > +    /* > > + * IGD > > + */ > > + > > +    object_class_property_set_description(klass, /* 2.7 */ > > +  "x-igd-opregion", >

Re: [PATCH 3/4] vfio/igd: use PCI ID defines to detect IGD gen

2025-02-07 Thread Corvin Köhne
On Fri, 2025-02-07 at 08:47 +0100, Corvin Köhne wrote: > On Thu, 2025-02-06 at 14:26 -0700, Alex Williamson wrote: > > On Thu,  6 Feb 2025 13:13:39 +0100 > > Corvin Köhne wrote: > > > > > From: Corvin Köhne > > > > > > We've recently imp

Re: [PATCH 3/4] vfio/igd: use PCI ID defines to detect IGD gen

2025-02-06 Thread Corvin Köhne
On Thu, 2025-02-06 at 14:26 -0700, Alex Williamson wrote: > On Thu,  6 Feb 2025 13:13:39 +0100 > Corvin Köhne wrote: > > > From: Corvin Köhne > > > > We've recently imported the PCI ID list of knwon Intel GPU devices from > > Linux. It allows us to p

[PATCH 1/4] include/standard-headers: add PCI IDs for Intel GPUs

2025-02-06 Thread Corvin Köhne
From: Corvin Köhne Intels integrated graphics devices do require many quirks to pass them to a VM as passthrough device. Unfortunately, those quirks are device specific and we have to check the device IDs to apply quirks properly. In the past, we've maintained an own list of PCI IDs. Ho

[PATCH 3/4] vfio/igd: use PCI ID defines to detect IGD gen

2025-02-06 Thread Corvin Köhne
From: Corvin Köhne We've recently imported the PCI ID list of knwon Intel GPU devices from Linux. It allows us to properly match GPUs to their generation without maintaining an own list of PCI IDs. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c

[PATCH 2/4] scripts/update-linux-headers: include PCI ID header for Intel GPUs

2025-02-06 Thread Corvin Köhne
From: Corvin Köhne We've recently imported the PCI ID header for Intel GPUs into our tree. Add it to our helper script to make it easier for us to sync this file in the future. Signed-off-by: Corvin Köhne --- scripts/update-linux-headers.sh | 6 ++ 1 file changed, 6 insertions(+)

[PATCH 4/4] vfio/igd: sync GPU generation with i915 kernel driver

2025-02-06 Thread Corvin Köhne
From: Corvin Köhne We're currently missing some GPU IDs already supported by the i915 kernel driver. Additionally, we've treated IvyBridge as gen 6 in the past. According to i915 it's gen 7 [1]. It shouldn't cause any issues yet because we treat gen 6 and gen 7 the same w

[PATCH 0/4] vfio/igd: sync PCI IDs with i915

2025-02-06 Thread Corvin Köhne
From: Corvin Köhne Hi, we're currently maintaining an own list of PCI IDs to match the generation of Intels integrated graphic devices. Linux maintains a list too. It's list is more recent, contains the full PCI ID of all devices and ships some macros to easily match them. This pa

Re: [PATCH v2 9/9] vfio/igd: add x-igd-gms option back to set DSM region size for guest

2024-12-03 Thread Corvin Köhne
On Tue, 2024-12-03 at 21:35 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > DSM region is likely to store framebuffer in Windows, a small DSM > region may cause display issues (e.g. half of the screen is black). > By default, QEMU uses host's original value, which is determined by > DVMT

Re: [PATCH v2 8/9] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices

2024-12-03 Thread Corvin Köhne
bdsm64, vdev, > +  "vfio-igd-bdsm-quirk", 8); > +    memory_region_add_subregion_overlap(vdev->bars[0].region.mem, > +    IGD_BDSM_MMIO_OFFSET, > +    &quirk->mem[1], 1); > +    } >   > QLIST_INSERT_HEAD(&vdev->bars[nr].quirks, quirk, next); >  } Reviewed-by: Corvin Köhne signature.asc Description: This is a digitally signed message part

Re: [PATCH v2 6/9] vfio/igd: add macro for declaring mirrored registers

2024-12-03 Thread Corvin Köhne
On Tue, 2024-12-03 at 21:35 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > igd devices have multipe registers mirroring mmio address and pci > config space, more than a single BDSM register. To support this, > the read/write functions are made common and a macro is defined to > simplify

Re: [PATCH v2 5/9] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids

2024-12-03 Thread Corvin Köhne
ke */ > case 0x4500:    /* Elkhart Lake */ > +    case 0x4E00:    /* Jasper Lake */ > return 11; > case 0x9A00:    /* Tiger Lake */ > +    case 0x4C00:    /* Rocket Lake */ > +    case 0x4600:    /* Alder Lake */ > +    case 0xA700:    /* Raptor Lake */ >

Re: [PATCH v2 4/9] vfio/igd: add Gemini Lake and Comet Lake device ids

2024-12-03 Thread Corvin Köhne
  /* Gemini Lake */ > case 0x5900:    /* Kaby Lake */ > case 0x3e00:    /* Coffee Lake */ > +    case 0x9B00:    /* Comet Lake */ > return 9; >      case 0x4500:    /* Elkhart Lake */ > return 11; Reviewed-by: Corvin Köhne signature.asc Description: This is a digitally signed message part

Re: [PATCH v2 3/9] vfio/igd: canonicalize memory size calculations

2024-12-03 Thread Corvin Köhne
IRRNT- > tIucgsQHKYe8WitBfoANcxBM2L6i4Sg4fLLMkXL_LDVUSEswEqsunuGsAr4DjgOogXtNMivhsyeaj9 > xYl9AgydV4QqrKMV29P7y3uAuqQcYz1GacVJRg1 ); >      } >   > -    trace_vfio_pci_igd_bdsm_enabled(vdev- > >https://nospamproxywebp.beckhoff.com/enQsig/link?id=BAgDIUcZasZ36mwAAABM0 > 01Yig6LNmON7mS202pDuIRRNT- > tIucgsQHKYe8WitBfoANcxBM2L6i4Sg4fLLMkXL_LDVUSEswEqsunuGsAr4DjgOogXtNMivhsyeaj9 > xYl9AgydV4QqrKMV29P7y3uAuqQcYz1GacVJRg1 , ggms_mb + gms_mb); > +    trace_vfio_pci_igd_bdsm_enabled(vdev- > >https://nospamproxywebp.beckhoff.com/enQsig/link?id=BAgDIUcZasZ36mwAAABM0 > 01Yig6LNmON7mS202pDuIRRNT- > tIucgsQHKYe8WitBfoANcxBM2L6i4Sg4fLLMkXL_LDVUSEswEqsunuGsAr4DjgOogXtNMivhsyeaj9 > xYl9AgydV4QqrKMV29P7y3uAuqQcYz1GacVJRg1 , > +    (ggms_size + gms_size) / MiB); >  } Reviewed-by: Corvin Köhne signature.asc Description: This is a digitally signed message part

Re: [PATCH v2 2/9] vfio/igd: align generation with i915 kernel driver

2024-12-03 Thread Corvin Köhne
> 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; > } >   Reviewed-by: Corvin Köhne signature.asc Description: This is a digitally signed message part

Re: [PATCH 3/8] vfio/igd: remove unsupported device ids

2024-12-02 Thread Corvin Köhne
00) { > > -    /* Old, untested, unavailable, unknown */ > > -    case 0x: > > -    case 0x2500: > > -    case 0x2700: > > -    case 0x2900: > > -    case 0x2a00: > > -    case 0x2e00: > > -    case 0x3500: > > -    case 0xa000: > > -  

Re: [PATCH 8/8] vfio/igd: add x-igd-gms option back to set DSM region size for guest

2024-12-02 Thread Corvin Köhne
On Mon, 2024-12-02 at 00:09 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > DSM region is likely to store framebuffer in Windows, a small DSM > region may cause display issues (e.g. half of the screen is black). > By default, QEMU uses host's original value, which is determined by > DVMT

Re: [PATCH 1/8] vfio/igd: fix GTT stolen memory size calculation for gen 7

2024-12-02 Thread Corvin Köhne
On Mon, 2024-12-02 at 00:09 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > Both intel documentation [1][2] and i915 driver shows GGMS represents > GTT stolen memory size in multiple of 1MB, not 2MB starting from gen > 8. > > [1] > https://www.intel.com/content/dam/www/public/us/en/docum

Re: [PATCH 6/8] vfio/igd: emulate GGC register in mmio bar0

2024-12-02 Thread Corvin Köhne
On Mon, 2024-12-02 at 00:09 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > 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 > a

Re: [PATCH 7/8] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices

2024-12-02 Thread Corvin Köhne
On Mon, 2024-12-02 at 00:09 +0800, Tomita Moeko wrote: > CAUTION: External Email!! > A recent commit in i915 driver [1] claims the BDSM register at 0x1080c0 > of mmio bar0 has been there since gen 6. Mirror this register to the 32 > bit BDSM register at 0x5c in pci config space for gen6-10 devices

Re: [PATCH 2/8] vfio/igd: canonicalize memory size calculations

2024-12-02 Thread Corvin Köhne
On Sun, 2024-12-01 at 22:28 -0700, Alex Williamson wrote: > CAUTION: External Email!! > On Mon,  2 Dec 2024 00:09:32 +0800 > Tomita Moeko wrote: > > > Add helper functions igd_gtt_memory_size() and igd_stolen_size() for > > calculating GTT stolen memory and Data stolen memory size in bytes, > > a

Re: [PATCH 5/8] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids

2024-12-02 Thread Corvin Köhne
Lake */ > case 0x4500:    /* Elkhart Lake */ > +    case 0x4E00:    /* Jasper Lake */ > return 11; > case 0x9A00:    /* Tiger Lake */ > +    case 0x4C00:    /* Rocket Lake */ > +    case 0x4600:    /* Alder Lake */ > +    case 0xA700:    /* Raptor Lake

[PATCH] vfio/igd: add pci id for Coffee Lake

2024-11-08 Thread Corvin Köhne
From: Corvin Köhne I've tested and verified that Coffee Lake devices are working properly. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index a95d441f68..c5282827ec 100644 --- a/hw/vfio/igd.c +++ b/hw

[PATCH] hw/igd: fix calculation of graphics stolen memory

2024-11-08 Thread Corvin Köhne
From: Corvin Köhne When copying the calculation of the stolen memory size for Intels integrated graphics device of gen 9 and later from the Linux kernel [1], we missed subtracting 0xf0 from the graphics mode select value for values above 0xf0. This leads to QEMU reporting a very large size of

[PATCH v3 6/7] vfio/igd: don't set stolen memory size to zero

2024-08-28 Thread Corvin Köhne
the stolen memory size. It's true that this wastes some VM memory. In the worst case, the stolen memory can take up more than a GB. However, that's uncommon. Additionally, it's likely that a bunch of RAM is assigned to VMs making use of GPU passthrough. Signed-off-by: Corvin Köhne

[PATCH v3 1/7] vfio/igd: return an invalid generation for unknown devices

2024-08-28 Thread Corvin Köhne
g a random generation value and hoping that everthing works fine, we should verify that different devices are working and add them to our list of known devices. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/

[PATCH v3 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-28 Thread Corvin Köhne
i/passthrough.c#L650-L653 Signed-off-by: Corvin Köhne --- v2: * omit unnecessary leXX_to_cpu calls * make use of IGD_BDSM_MMIO_OFFSET define hw/vfio/igd.c| 98 hw/vfio/pci-quirks.c | 1 + hw/vfio/pci.h| 1 + 3 fil

[PATCH v3 3/7] vfio/igd: use new BDSM register location and size for gen 11 and later

2024-08-28 Thread Corvin Köhne
Intel changed the location and size of the BDSM register for gen 11 devices and later. We have to adjust our emulation for these devices to properly support them. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 31 --- 1 file changed, 24 insertions(+), 7 deletions

[PATCH v3 0/7] vfio/igd: add passthrough support for IGDs of gen 11 and later

2024-08-28 Thread Corvin Köhne
. I've tested the patch series on an ElkhartLake and TigerLake device. On the guest side, I've tested an EFI environment (GOP driver), a Linux guest and a Windows VM. The driver of all guests are able to use the GPU and produce an output on the connected display. Corvin Köhne (7): vfio/igd:

[PATCH v3 7/7] vfio/igd: correctly calculate stolen memory size for gen 9 and later

2024-08-28 Thread Corvin Köhne
450ba/arch/x86/kernel/early-quirks.c#L455-L460 Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 0751c43eae..a95d441f68 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -488,11 +4

[PATCH v3 2/7] vfio/igd: support legacy mode for all known generations

2024-08-28 Thread Corvin Köhne
tion. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 650a323dda..d5e57656a8 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -416,7 +416,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCI

[PATCH v3 5/7] vfio/igd: add ID's for ElkhartLake and TigerLake

2024-08-28 Thread Corvin Köhne
ElkhartLake and TigerLake devices were tested in legacy mode with Linux and Windows VMs. Both are working properly. It's likely that other Intel GPUs of gen 11 and 12 like IceLake device are working too. However, we're only adding known good devices for now. Signed-off-by: Corvin Köhn

Re: [PATCH 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-28 Thread Corvin Köhne
On Mon, 2024-08-26 at 10:35 -0600, Alex Williamson wrote: > CAUTION: External Email!! > On Thu, 22 Aug 2024 13:08:29 +0200 > Corvin Köhne wrote: > > > The BDSM register is mirrored into MMIO space at least for gen 11 > > and > > later devices. Unfortunately

Re: [PATCH 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-28 Thread Corvin Köhne
On Wed, 2024-08-28 at 12:40 +0200, Corvin Köhne wrote: > On Mon, 2024-08-26 at 10:35 -0600, Alex Williamson wrote: > > > > PS - please drop the confidential email warning signature when > > posting > > to public lists. > > > > Sry for the noise. I can'

[PATCH v2 5/7] vfio/igd: add ID's for ElkhartLake and TigerLake

2024-08-28 Thread Corvin Köhne
ElkhartLake and TigerLake devices were tested in legacy mode with Linux and Windows VMs. Both are working properly. It's likely that other Intel GPUs of gen 11 and 12 like IceLake device are working too. However, we're only adding known good devices for now. Signed-off-by: Corvin Köhn

[PATCH v2 7/7] vfio/igd: correctly calculate stolen memory size for gen 9 and later

2024-08-28 Thread Corvin Köhne
450ba/arch/x86/kernel/early-quirks.c#L455-L460 Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 0751c43eae..a95d441f68 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -488,11 +4

[PATCH v2 6/7] vfio/igd: don't set stolen memory size to zero

2024-08-28 Thread Corvin Köhne
rwrite the stolen memory size. It's true that this wastes some VM memory. In the worst case, the stolen memory can take up more than a GB. However, that's uncommon. Additionally, it's likely that a bunch of RAM is assigned to VMs making use of GPU passthrough. Signed-off-by: Corvin Köhne

[PATCH v2 3/7] vfio/igd: use new BDSM register location and size for gen 11 and later

2024-08-28 Thread Corvin Köhne
Intel changed the location and size of the BDSM register for gen 11 devices and later. We have to adjust our emulation for these devices to properly support them. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 31 --- 1 file changed, 24 insertions(+), 7 deletions

[PATCH v2 0/7] vfio/igd: add passthrough support for IGDs of gen 11 and later

2024-08-28 Thread Corvin Köhne
. I've tested the patch series on an ElkhartLake and TigerLake device. On the guest side, I've tested an EFI environment (GOP driver), a Linux guest and a Windows VM. The driver of all guests are able to use the GPU and produce an output on the connected display. Corvin Köhne (7): vfio/igd:

[PATCH v2 2/7] vfio/igd: support legacy mode for all known generations

2024-08-28 Thread Corvin Köhne
tion. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 650a323dda..d5e57656a8 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -416,7 +416,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCI

[PATCH v2 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-28 Thread Corvin Köhne
i/passthrough.c#L650-L653 Signed-off-by: Corvin Köhne --- v2: * omit unnecessary leXX_to_cpu calls * make use of IGD_BDSM_MMIO_OFFSET define hw/vfio/igd.c| 98 hw/vfio/pci-quirks.c | 1 + hw/vfio/pci.h| 1 + 3 fil

[PATCH v2 1/7] vfio/igd: return an invalid generation for unknown devices

2024-08-28 Thread Corvin Köhne
g a random generation value and hoping that everthing works fine, we should verify that different devices are working and add them to our list of known devices. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/

[PATCH 6/7] vfio/igd: don't set stolen memory size to zero

2024-08-22 Thread Corvin Köhne
rwrite the stolen memory size. It's true that this wastes some VM memory. In the worst case, the stolen memory can take up more than a GB. However, that's uncommon. Additionally, it's likely that a bunch of RAM is assigned to VMs making use of GPU passthrough. Signed-off-by: Corvin Köhne

[PATCH 5/7] vfio/igd: add ID's for ElkhartLake and TigerLake

2024-08-22 Thread Corvin Köhne
ElkhartLake and TigerLake devices were tested in legacy mode with Linux and Windows VMs. Both are working properly. It's likely that other Intel GPUs of gen 11 and 12 like IceLake device are working too. However, we're only adding known good devices for now. Signed-off-by: Corvin Köhn

[PATCH 7/7] vfio/igd: correctly calculate stolen memory size for gen 9 and later

2024-08-22 Thread Corvin Köhne
450ba/arch/x86/kernel/early-quirks.c#L455-L460 Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 122432e6a6..70c60fe7bc 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -487,11 +4

[PATCH 2/7] vfio/igd: support legacy mode for all known generations

2024-08-22 Thread Corvin Köhne
tion. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 650a323dda..d5e57656a8 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -416,7 +416,7 @@ void vfio_probe_igd_bar4_quirk(VFIOPCI

[PATCH 4/7] vfio/igd: add new bar0 quirk to emulate BDSM mirror

2024-08-22 Thread Corvin Köhne
i/passthrough.c#L650-L653 Signed-off-by: Corvin Köhne --- hw/vfio/igd.c| 97 hw/vfio/pci-quirks.c | 1 + hw/vfio/pci.h| 1 + 3 files changed, 99 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 0b6533bbf7..863b58565e 10064

[PATCH 3/7] vfio/igd: use new BDSM register location and size for gen 11 and later

2024-08-22 Thread Corvin Köhne
Intel changed the location and size of the BDSM register for gen 11 devices and later. We have to adjust our emulation for these devices to properly support them. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 31 --- 1 file changed, 24 insertions(+), 7 deletions

[PATCH 0/7] vfio/igd: add passthrough support for IGDs of gen 11 and later

2024-08-22 Thread Corvin Köhne
. I've tested the patch series on an ElkhartLake and TigerLake device. On the guest side, I've tested an EFI environment (GOP driver), a Linux guest and a Windows VM. The driver of all guests are able to use the GPU and produce an output on the connected display. Corvin Köhne (7): vfio/igd:

[PATCH 1/7] vfio/igd: return an invalid generation for unknown devices

2024-08-22 Thread Corvin Köhne
g a random generation value and hoping that everthing works fine, we should verify that different devices are working and add them to our list of known devices. Signed-off-by: Corvin Köhne --- hw/vfio/igd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/