Re: [PATCH v2 3/5] vfio/igd: refactor vfio_probe_igd_bar4_quirk() into pci config quirk

2025-02-02 Thread Tomita Moeko
On 1/31/25 17:14, Cédric Le Goater wrote: > Hello Tomita, > > On 1/24/25 20:12, Tomita Moeko wrote: >> The actual IO BAR4 write quirk in vfio_probe_igd_bar4_quirk() was >> removed in previous change, leaving the function not matching its name, >> so move i

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-02-01 Thread Tomita Moeko
On 1/31/25 18:15, Cédric Le Goater wrote: > On 1/30/25 21:41, Alex Williamson wrote: >> On Fri, 31 Jan 2025 02:33:03 +0800 >> Tomita Moeko wrote: >> >>> On 1/25/25 15:42, Tomita Moeko wrote: >>>> On 1/25/25 05:13, Alex Williamson wrote: >>>>&

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-31 Thread Tomita Moeko
On 1/31/25 04:41, Alex Williamson wrote: > On Fri, 31 Jan 2025 02:33:03 +0800 > Tomita Moeko wrote: > >> On 1/25/25 15:42, Tomita Moeko wrote: >>> On 1/25/25 05:13, Alex Williamson wrote: >>>> On Sat, 25 Jan 2025 03:12:45 +0800 >>>> Tomita Moeko

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-30 Thread Tomita Moeko
On 1/25/25 15:42, Tomita Moeko wrote: > On 1/25/25 05:13, Alex Williamson wrote: >> On Sat, 25 Jan 2025 03:12:45 +0800 >> Tomita Moeko wrote: >> >>> Both enable opregion option (x-igd-opregion) and legacy mode require >>> setting up OpRegion copy for I

Re: [PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-24 Thread Tomita Moeko
On 1/25/25 05:13, Alex Williamson wrote: > On Sat, 25 Jan 2025 03:12:45 +0800 > Tomita Moeko wrote: > >> Both enable opregion option (x-igd-opregion) and legacy mode require >> setting up OpRegion copy for IGD devices. Move x-igd-opregion handler &g

[PATCH v2 5/5] vfio/igd: handle x-igd-opregion in vfio_probe_igd_config_quirk()

2025-01-24 Thread Tomita Moeko
Both enable opregion option (x-igd-opregion) and legacy mode require setting up OpRegion copy for IGD devices. Move x-igd-opregion handler in vfio_realize() to vfio_probe_igd_config_quirk() to elimate duplicate code. Finally we moved all the IGD-related code into igd.c. Signed-off-by: Tomita

[PATCH v2 2/5] vfio/pci: add placeholder for device-specific config space quirks

2025-01-24 Thread Tomita Moeko
Some devices, such as IGD, require device-specific quirks to be applied to their pci config spaces. Currently, these quirks are either part of BAR quirk, or being a part of vfio_realize(). Add a placeholder for pci config quirks for moving the quirks to one place later. Signed-off-by: Tomita

[PATCH v2 0/5] vfio/igd: remove incorrect IO BAR4 quirk

2025-01-24 Thread Tomita Moeko
from vfio_realize() to vfio_probe_igd_config_ quirk(), as proposed in v1, making it reasonable to return bool. Link: https://lore.kernel.org/qemu-devel/20250122171731.40444-1-tomitamo...@gmail.com/ Tomita Moeko (5): vfio/igd: remove GTT write quirk in IO BAR 4 vfio/pci: add placeholder for devic

[PATCH v2 4/5] vfio/igd: do not include GTT stolen size in etc/igd-bdsm-size

2025-01-24 Thread Tomita Moeko
reserve a memory region for DSM and program the BDSM register with the base address of that region, that's actually what both SeaBIOS[1] and OVMF does now. [1] https://gitlab.com/qemu-project/seabios/-/blob/1.12-stable/src/fw/pciinit.c#L319-332 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH v2 3/5] vfio/igd: refactor vfio_probe_igd_bar4_quirk() into pci config quirk

2025-01-24 Thread Tomita Moeko
and proceeds. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 31 +-- hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.h| 2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ca3a32f4f2..376a26fbae

[PATCH v2 1/5] vfio/igd: remove GTT write quirk in IO BAR 4

2025-01-24 Thread Tomita Moeko
ammed to GTT entries by VBIOS running in guest are valid GPA, and this unnecessary adjustment brings inconsistency. [1] https://gitlab.com/qemu-project/seabios/-/blob/1.12-stable/src/fw/pciinit.c#L319-332 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH 3/4] vfio/igd: refactor vfio_probe_igd_bar4_quirk() into pci config quirk

2025-01-22 Thread Tomita Moeko
and proceeds. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 30 -- hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.h| 2 +- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 4f9a90f36f..33e5202052

[PATCH 1/4] vfio/igd: remove GTT write quirk in IO BAR 4

2025-01-22 Thread Tomita Moeko
ammed to GTT entries by VBIOS running in guest are valid GPA, and this unnecessary adjustment brings inconsistency. [1] https://gitlab.com/qemu-project/seabios/-/blob/1.12-stable/src/fw/pciinit.c#L319-332 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH 0/4] vfio/igd: remove incorrect IO BAR4 quirk

2025-01-22 Thread Tomita Moeko
| Rsvd | Sel | +---+ - Offset: Byte offset in specified region, 4-byte aligned. - Sel: Region selector 0: MMIO register region (first half of MMIO BAR0) 1: GTT region (second half of MMIO BAR0). Pre Gen11 only. Tomita Moeko (4): vfio/igd: remov

[PATCH 2/4] vfio/pci: add placeholder for device-specific config space quirks

2025-01-22 Thread Tomita Moeko
Some devices, such as IGD, require device-specific quirks to be applied to their pci config spaces. Currently, these quirks are either part of BAR quirk, or being a part of vfio_realize(). Add a placeholder for pci config quirks for moving the quirks to one place later. Signed-off-by: Tomita

[PATCH 4/4] vfio/igd: do not include GTT stolen size in etc/igd-bdsm-size

2025-01-22 Thread Tomita Moeko
reserve a memory region for DSM and program the BDSM register with the base address of that region, that's actually what both SeaBIOS[1] and OVMF does now. [1] https://gitlab.com/qemu-project/seabios/-/blob/1.12-stable/src/fw/pciinit.c#L319-332 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH v2 1/3] vfio/pci: declare generic quirks in a new header file

2025-01-04 Thread Tomita Moeko
Declare generic vfio_generic_{window_address,window_data,mirror}_quirk in newly created pci_quirks.h so that they can be used elsewhere, like igd.c. Signed-off-by: Tomita Moeko --- hw/vfio/pci-quirks.c | 55 +++--- hw/vfio/pci-quirks.h | 71

[PATCH v2 3/3] vfio/igd: use VFIOConfigMirrorQuirk for mirrored registers

2025-01-04 Thread Tomita Moeko
With the introduction of config_offset field, VFIOConfigMirrorQuirk can now be used for those mirrored register in igd bar0. This eliminates the need for the macro intoduced in 1a2623b5c9e7 ("vfio/igd: add macro for declaring mirrored registers"). Signed-off-by: Tomita Moeko --- hw/

[PATCH v2 2/3] vfio/pci: introduce config_offset field in VFIOConfigMirrorQuirk

2025-01-04 Thread Tomita Moeko
Device may only expose a specific portion of PCI config space through a region in a BAR, such behavior is seen in igd GGC and BDSM mirrors in BAR0. To handle these, config_offset is introduced to allow mirroring arbitrary region in PCI config space. Signed-off-by: Tomita Moeko --- hw/vfio/pci

[PATCH v2 0/3] vfio/igd: VFIOConfigMirrorQuirk for igd mirrored registers

2025-01-04 Thread Tomita Moeko
rebasing. * Removed unnecessary initializing config_offset explicitly. * Separated GGC and BDSM mirror into 2 quirks. Link: https://lore.kernel.org/all/20241231151953.59992-1-tomitamo...@gmail.com/ Tomita Moeko (3): vfio/pci: declare generic quirks in a new header file vfio/pci: introduce co

Re: [PATCH 1/3] vfio/pci: declare generic quirks in a new header file

2025-01-01 Thread Tomita Moeko
On 12/31/24 23:19, Tomita Moeko wrote: > Declare generic vfio_generic_{window_address,window_data,mirror}_quirk > in newly created pci_quirks.h so that they can be used elsewhere, like > igd.c. > > Signed-off-by: Tomita Moeko > --- > hw/v

[PATCH 2/3] vfio/pci: introduce config_offset field in VFIOConfigMirrorQuirk

2024-12-31 Thread Tomita Moeko
Device may only expose a specific portion of PCI config space through a region in a BAR, such behavior is seen in igd GGC and BDSM mirrors in BAR0. To handle these, config_offset is introduced to allow mirroring arbitrary region in PCI config space. Signed-off-by: Tomita Moeko --- hw/vfio/pci

[PATCH 3/3] vfio/igd: use VFIOConfigMirrorQuirk for mirrored registers

2024-12-31 Thread Tomita Moeko
With the introduction of config_offset field, VFIOConfigMirrorQuirk can now be used for those mirrored register in igd bar0. This eliminates the need for the macro intoduced in 1a2623b5c9e7 ("vfio/igd: add macro for declaring mirrored registers"). Signed-off-by: Tomita Moeko --- hw/

[PATCH 1/3] vfio/pci: declare generic quirks in a new header file

2024-12-31 Thread Tomita Moeko
Declare generic vfio_generic_{window_address,window_data,mirror}_quirk in newly created pci_quirks.h so that they can be used elsewhere, like igd.c. Signed-off-by: Tomita Moeko --- hw/vfio/pci-quirks.c | 59 hw/vfio/pci-quirks.h | 71

[PATCH 0/3] vfio/igd: VFIOConfigMirrorQuirk for igd mirrored registers

2024-12-31 Thread Tomita Moeko
uces a new header file, pci-quirks.h, to hold generic quirk declarations, and extends VFIOConfigMirrorQuirk to support offsets in PCI config space. This eliminates the need for the previously introduced macro. Happy new year :) Tomita Moeko (3): vfio/pci: declare generic quirks in a new header f

Re: [PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices

2024-12-29 Thread Tomita Moeko
On 12/4/24 23:08, Tomita Moeko wrote: > On 12/4/24 04:12, Alex Williamson wrote: >> On Tue, 3 Dec 2024 21:35:39 +0800 >> Tomita Moeko wrote: >> >>> This patchset extends the support of legacy mode igd passthrough to >>> all Intel Gen 11 and 12 devices (incl

[PATCH v4 09/10] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices

2024-12-06 Thread Tomita Moeko
...@linux.intel.com Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 12e0553e83..73c06bbf64 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c

[PATCH v4 05/10] vfio/igd: add Gemini Lake and Comet Lake device ids

2024-12-06 Thread Tomita Moeko
ned-off-by: Tomita Moeko --- hw/vfio/igd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index e231865d72..ed236f443a 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -81,8 +81,10 @@ static int igd_gen(VFIOPCIDevice *vdev) case 0x2200:/*

[PATCH v4 01/10] vfio/igd: fix GTT stolen memory size calculation for gen 8+

2024-12-06 Thread Tomita Moeko
o/pci: Intel graphics legacy mode assignment") Reported-By: Alex Williamson Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 4047f4f071..73ed1ec8e6 100644 --- a/hw/vfio/igd.c +++ b/hw/

[PATCH v4 07/10] vfio/igd: add macro for declaring mirrored registers

2024-12-06 Thread Tomita Moeko
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 the declaration of MemoryRegionOps. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 60

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

2024-12-06 Thread Tomita Moeko
ld behavior. When it is not specified, QEMU uses host's value. When DVMT Pre-Allocated option is available in host BIOS, user should set DSM region size there instead of using x-igd-gms option. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 26

[PATCH v4 06/10] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids

2024-12-06 Thread Tomita Moeko
:4680). Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ed236f443a..49b6547776 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -86,9 +86,14 @@ static int igd_gen(VFIOPCIDevice

[PATCH v4 08/10] vfio/igd: emulate GGC register in mmio bar0

2024-12-06 Thread Tomita Moeko
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 --- hw/vfio/igd.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio

[PATCH v4 04/10] vfio/igd: canonicalize memory size calculations

2024-12-06 Thread Tomita Moeko
Add helper functions igd_gtt_memory_size() and igd_stolen_size() for calculating GTT stolen memory and Data stolen memory size in bytes, and use macros to replace the hardware-related magic numbers for better readability. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 101

[PATCH v4 03/10] vfio/igd: align generation with i915 kernel driver

2024-12-06 Thread Tomita Moeko
from gen 8. Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 059ed56439..09bd4e5383 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio

[PATCH v4 02/10] vfio/igd: remove unsupported device ids

2024-12-06 Thread Tomita Moeko
Since e433f208973f ("vfio/igd: return an invalid generation for unknown devices"), the default return of igd_gen() was changed to unsupported. There is no need to filter out those unsupported devices. Reviewed-by: Alex Williamson Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moek

[PATCH v4 00/10] vfio/igd: Enable legacy mode on more devices

2024-12-06 Thread Tomita Moeko
Minor fixes. Link: https://lore.kernel.org/qemu-devel/20241201160938.44355-1-tomitamo...@gmail.com/ Tomita Moeko (10): vfio/igd: fix GTT stolen memory size calculation for gen 8+ vfio/igd: remove unsupported device ids vfio/igd: align generation with i915 kernel driver vfio/igd: canonicalize memory

[PATCH v3 08/10] vfio/igd: emulate GGC register in mmio bar0

2024-12-05 Thread Tomita Moeko
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 --- hw/vfio/igd.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio

[PATCH v3 02/10] vfio/igd: align generation with i915 kernel driver

2024-12-05 Thread Tomita Moeko
from gen 8. Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 45 +++-- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 6ba3045bf3..18d179bc83 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio

[PATCH v3 09/10] vfio/igd: emulate BDSM in mmio bar0 for gen 6-10 devices

2024-12-05 Thread Tomita Moeko
...@linux.intel.com Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 12e0553e83..73c06bbf64 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c

[PATCH v3 03/10] vfio/igd: fix GTT stolen memory size calculation for gen 8+

2024-12-05 Thread Tomita Moeko
Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 18d179bc83..09bd4e5383 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -259,7 +259,7 @@ static int vfio_igd_gtt_max(VFIOPCIDevice *vdev

[PATCH v3 06/10] vfio/igd: add Alder/Raptor/Rocket/Ice/Jasper Lake device ids

2024-12-05 Thread Tomita Moeko
:4680). Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ed236f443a..49b6547776 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -86,9 +86,14 @@ static int igd_gen(VFIOPCIDevice

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

2024-12-05 Thread Tomita Moeko
ld behavior. When it is not specified, QEMU uses host's value. When DVMT Pre-Allocated option is available in host BIOS, user should set DSM region size there instead of using x-igd-gms option. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 26

[PATCH v3 07/10] vfio/igd: add macro for declaring mirrored registers

2024-12-05 Thread Tomita Moeko
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 the declaration of MemoryRegionOps. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 60

[PATCH v3 05/10] vfio/igd: add Gemini Lake and Comet Lake device ids

2024-12-05 Thread Tomita Moeko
ned-off-by: Tomita Moeko --- hw/vfio/igd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index e231865d72..ed236f443a 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -81,8 +81,10 @@ static int igd_gen(VFIOPCIDevice *vdev) case 0x2200:/*

[PATCH v3 04/10] vfio/igd: canonicalize memory size calculations

2024-12-05 Thread Tomita Moeko
Add helper functions igd_gtt_memory_size() and igd_stolen_size() for calculating GTT stolen memory and Data stolen memory size in bytes, and use macros to replace the hardware-related magic numbers for better readability. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 101

[PATCH v3 00/10] vfio/igd: Enable legacy mode on more devices

2024-12-05 Thread Tomita Moeko
ini Lake and Comet Lake device ids. * Splited mirroring register declaration macro into a new patch. * Minor fixes. Link: https://lore.kernel.org/qemu-devel/20241201160938.44355-1-tomitamo...@gmail.com/ Tomita Moeko (10): vfio/igd: remove unsupported device ids vfio/igd: align generation with

[PATCH v3 01/10] vfio/igd: remove unsupported device ids

2024-12-05 Thread Tomita Moeko
Since e433f208973f ("vfio/igd: return an invalid generation for unknown devices"), the default return of igd_gen() was changed to unsupported. There is no need to filter out those unsupported devices. Reviewed-by: Alex Williamson Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moek

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

2024-12-05 Thread Tomita Moeko
On 12/5/24 06:35, Alex Williamson wrote: > On Tue, 3 Dec 2024 21:35:42 +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, >> and use macros to r

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

2024-12-05 Thread Tomita Moeko
On 12/5/24 06:36, Alex Williamson wrote: > On Tue, 3 Dec 2024 21:35:41 +0800 > Tomita Moeko wrote: > >> Define the igd device generations according to i915 kernel driver to >> avoid confusion, and adjust comment placement to clearly reflect the >> relationship between

Re: [PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices

2024-12-04 Thread Tomita Moeko
On 12/4/24 04:12, Alex Williamson wrote: > On Tue, 3 Dec 2024 21:35:39 +0800 > Tomita Moeko wrote: > >> This patchset extends the support of legacy mode igd passthrough to >> all Intel Gen 11 and 12 devices (including Ice Lake, Jasper Lake, >> Rocket Lake, Alder

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

2024-12-03 Thread Tomita Moeko
from gen 8. Signed-off-by: Tomita Moeko --- 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

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

2024-12-03 Thread Tomita Moeko
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 the declaration of MemoryRegionOps. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 60

[PATCH v2 0/9] vfio/igd: Enable legacy mode on more devices

2024-12-03 Thread Tomita Moeko
Minor fixes. Link: https://lore.kernel.org/qemu-devel/20241201160938.44355-1-tomitamo...@gmail.com/ Tomita Moeko (9): vfio/igd: remove unsupported device ids vfio/igd: align generation with i915 kernel driver vfio/igd: canonicalize memory size calculations vfio/igd: add Gemini Lake and Comet Lake d

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

2024-12-03 Thread Tomita Moeko
Both Gemini Lake and Comet Lake are gen 9 devices. Many user reports on internet shows legacy mode of igd passthrough works as qemu treats them as gen 8 devices by default before e433f208973f ("vfio/igd: return an invalid generation for unknown devices"). Signed-off-by: Tomita Moeko --

[PATCH v2 1/9] vfio/igd: remove unsupported device ids

2024-12-03 Thread Tomita Moeko
Since e433f208973f ("vfio/igd: return an invalid generation for unknown devices"), the default return of igd_gen() was changed to unsupported. There is no need to filter out those unsupported devices. Reviewed-by: Alex Williamson Reviewed-by: Corvin Köhne Signed-off-by: Tomita Moek

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

2024-12-03 Thread Tomita Moeko
Add helper functions igd_gtt_memory_size() and igd_stolen_size() for calculating GTT stolen memory and Data stolen memory size in bytes, and use macros to replace the hardware-related magic numbers for better readability. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 99

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

2024-12-03 Thread Tomita Moeko
:4680). Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 7f389de7ac..fea9be0b2d 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -85,9 +85,14 @@ static int igd_gen(VFIOPCIDevice *vdev) case 0x3e00

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

2024-12-03 Thread Tomita Moeko
...@linux.intel.com Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index bc18fc8cc0..e464cd6949 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -484,7 +484,8 @@ static

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

2024-12-03 Thread Tomita Moeko
item to users. In such cases, x-igd-gms option can be used to manually set the data stolen memory size for guest. When DVMT Pre-Allocated option is available in host BIOS, user should set DSM region size there instead of using x-igd-gms option. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH v2 7/9] vfio/igd: emulate GGC register in mmio bar0

2024-12-03 Thread Tomita Moeko
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 --- hw/vfio/igd.c | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/vfio

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

2024-12-03 Thread Tomita Moeko
On 12/2/24 17:44, Corvin Köhne wrote: > 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

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 17:10, Corvin Köhne wrote: > 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_s

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 14:12, Alex Williamson wrote: > On Sun, 1 Dec 2024 22:11:29 -0700 > Alex Williamson wrote: > >> On Mon, 2 Dec 2024 00:09:31 +0800 >> Tomita Moeko wrote: >> >>> Both intel documentation [1][2] and i915 driver shows GGMS represents >>> G

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 16:54, Corvin Köhne wrote: > 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 >

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 13:28, Alex Williamson wrote: > 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, >> and use macros to r

Re: [PATCH 4/8] vfio/igd: align generation with i915 kernel driver

2024-12-02 Thread Tomita Moeko
On 12/2/24 14:04, Alex Williamson wrote: > On Mon, 2 Dec 2024 00:09:34 +0800 > Tomita Moeko wrote: > >> Define the igd device generations according to i915 kernel driver to >> avoid confusion, and adjust comment placement to clearly reflect the >> relations

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 17:48, Corvin Köhne wrote: > 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). >

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

2024-12-02 Thread Tomita Moeko
On 12/2/24 17:39, Corvin Köhne wrote: > 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 >&

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

2024-12-01 Thread Tomita Moeko
:4680). Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 5 + 1 file changed, 5 insertions(+) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 71342863d6..a86faf2fa9 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -79,9 +79,14 @@ static int igd_gen(VFIOPCIDevice *vdev) case 0x5900

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

2024-12-01 Thread Tomita Moeko
Add helper functions igd_gtt_memory_size() and igd_stolen_size() for calculating GTT stolen memory and Data stolen memory size in bytes, and use macros to replace the hardware-related magic numbers for better readability. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 101

[PATCH 4/8] vfio/igd: align generation with i915 kernel driver

2024-12-01 Thread Tomita Moeko
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. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 36 1 file changed, 16 insertions

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

2024-12-01 Thread Tomita Moeko
register. A macro is defined to simplify the declaration of MemoryRegionOps for a register mirrored to pcie config space. [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 --- hw/vfio

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

2024-12-01 Thread Tomita Moeko
...@linux.intel.com Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26 ++ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 07700dce30..3fd822241d 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -482,7 +482,8 @@ static

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

2024-12-01 Thread Tomita Moeko
/dam/www/public/us/en/documents/datasheets/4th-gen-core-family-desktop-vol-2-datasheet.pdf Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 4047f4f071..e40e601026 100644 --- a/hw/vfio/igd.c +++ b

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

2024-12-01 Thread Tomita Moeko
item to users. In such cases, x-igd-gms option can be used to manually set the data stolen memory size for guest. When DVMT Pre-Allocated option is available in host BIOS, user should set DSM region size there instead of using x-igd-gms option. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c

[PATCH 0/8] vfio/igd: Enable legacy mode on more devices

2024-12-01 Thread Tomita Moeko
someone shares the background. Tomita Moeko (8): vfio/igd: fix GTT stolen memory size calculation for gen 7 vfio/igd: canonicalize memory size calculations vfio/igd: remove unsupported device ids vfio/igd: align generation with i915 kernel driver vfio/igd: add Alder/Raptor/Rocket/

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

2024-12-01 Thread Tomita Moeko
Since e433f208973f ("vfio/igd: return an invalid generation for unknown devices"), the default return of igd_gen() was changed to unsupported. There is no need to filter out those unsupported devices. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 10 -- 1 file changed, 10