Re: [PATCH 19/22] vfio/igd.c: use QOM casts where appropriate

2025-07-18 Thread Tomita Moeko
+ IGD_GMCH, 0); > pci_set_long(vdev->emulated_config_bits + IGD_GMCH, ~0); > } > > @@ -630,12 +634,12 @@ static bool vfio_pci_igd_config_quirk(VFIOPCIDevice > *vdev, Error **errp) > > /* BDSM is read-write, emulated. BIOS needs to be able to write it */ >

[PATCH v3] vfio/pci: Introduce x-pci-class-code option

2025-07-08 Thread Tomita Moeko
). The UEFI GOP driver depends on the device reporting a VGA controller class code (0x03). Signed-off-by: Tomita Moeko --- v3: * Save the vdev class code when it is unspecified. * Call pci_register_vga() in vfio_pci_config_setup() to ensure VGA regions are only get exposed when vdev is VGA

Re: [PATCH v2] vfio/pci: Introduce x-pci-class-code option

2025-07-06 Thread Tomita Moeko
On 6/27/25 02:26, Alex Williamson wrote: > On Tue, 17 Jun 2025 08:56:41 +0800 > Tomita Moeko wrote: > >> On 2025/5/29 18:41, Tomita Moeko wrote: >>> On 2025/5/29 2:30, Alex Williamson wrote: >>>> On Wed, 28 May 2025 23:55:48 +0800 >>>> Tomita

Re: [PATCH v2] vfio/pci: Introduce x-pci-class-code option

2025-06-16 Thread Tomita Moeko
On 2025/5/29 18:41, Tomita Moeko wrote: > On 2025/5/29 2:30, Alex Williamson wrote: >> On Wed, 28 May 2025 23:55:48 +0800 >> Tomita Moeko wrote: >> >>> Introduce x-pci-class-code option to allow users to override PCI class >>> code of a device, similar to th

Re: [PATCH v2] vfio/pci: Introduce x-pci-class-code option

2025-05-29 Thread Tomita Moeko
On 2025/5/29 2:30, Alex Williamson wrote: > On Wed, 28 May 2025 23:55:48 +0800 > Tomita Moeko wrote: > >> Introduce x-pci-class-code option to allow users to override PCI class >> code of a device, similar to the existing x-pci-vendor-id option. Only >> the lower 24 b

[PATCH v2] vfio/pci: Introduce x-pci-class-code option

2025-05-28 Thread Tomita Moeko
driver depends on the device reporting a VGA controller class code (0x03). Signed-off-by: Tomita Moeko --- v2: * Add vdev class code check in vfio_populate_vga(). * Fix type in trace-events. Link: https://lore.kernel.org/all/20250524153102.19747-1-tomitamo...@gmail.com/ hw/vfio/pci.c

Re: [PATCH] vfio/pci: Introduce x-pci-class-code option

2025-05-24 Thread Tomita Moeko
On 5/24/25 23:31, Tomita Moeko wrote: > Introduce x-pci-class-code option to allow users to override PCI class > code of a device, similar to the existing x-pci-vendor-id option. Only > the lower 24 bits of this option are used, though a uint32 is used here > for determining whether

[PATCH] vfio/pci: Introduce x-pci-class-code option

2025-05-24 Thread Tomita Moeko
for IGD devices that expose themselves either as VGA controller (primary display) or Display controller (non-primary display). The UEFI GOP driver depends on the device reporting a VGA controller class code (0x03). Signed-off-by: Tomita Moeko --- hw/vfio/pci.c| 17

[PATCH v2] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()

2025-05-22 Thread Tomita Moeko
u/-/issues/2968 Reported-by: Edmund Raile Link: https://lore.kernel.org/qemu-devel/30044d14-17ec-46e3-b9c3-63d27a5bd...@gmail.com Tested-by: Edmund Raile Signed-off-by: Tomita Moeko --- v2: * Add Tested-by from Edmund Raile. Thanks for the contribution. * Rebased on vfio-next * Fix typos. hw/

Re: [PATCH] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()

2025-05-22 Thread Tomita Moeko
On 5/22/25 15:31, edmund.raile wrote: > Hi Moeko, > >> I did some further debugging, and found it was caused by a mistake in >> error handling. In vfio_pci_igd_opregion_detect(), `errp` is set when >> OpRegion is not found. However, in pci_qdev_realize(), the caller of >> vfio_realize(), it checks

[PATCH] vfio/igd: Fix incorrect error propagation in vfio_pci_igd_opregion_detect()

2025-05-21 Thread Tomita Moeko
u/-/issues/2968 Reported-by: Edmund Raile Link: https://lore.kernel.org/qemu-devel/30044d14-17ec-46e3-b9c3-63d27a5bd...@gmail.com Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 22 ++ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/i

Re: [PATCH v2] vfio/igd: Respect x-igd-opregion=off in IGD quirk handling

2025-05-21 Thread Tomita Moeko
On 5/21/25 04:46, edmund.raile wrote: > Hi Moeko, >> On 5/19/25 16:03, edmund.raile wrote: >>> Restore SR-IOV Intel iGPU VF passthrough capability: >>> Check x-igd-opregion=off parameter in vfio_pci_igd_config_quirk and >>> vfio_pci_kvmgt_config_quirk to ensure x-igd-opregion=off is >>> respected

Re: [PATCH] vfio/igd: Support non-boot gpus

2025-05-19 Thread Tomita Moeko
On 5/20/25 01:15, Alex Williamson wrote: > [Please Cc maintainers - added here] > > On Mon, 19 May 2025 18:08:39 +0300 > Qwinci wrote: > >> Change the IGD detection logic to also accept gpus with >> PCI_CLASS_DISPLAY_OTHER class which is used if the igpu is not >> set as the primary boot gpu. >>

Re: [PATCH v2] vfio/igd: Respect x-igd-opregion=off in IGD quirk handling

2025-05-19 Thread Tomita Moeko
On 5/19/25 16:03, edmund.raile wrote: > Restore SR-IOV Intel iGPU VF passthrough capability: > Check x-igd-opregion=off parameter in vfio_pci_igd_config_quirk and > vfio_pci_kvmgt_config_quirk to ensure x-igd-opregion=off is > respected despite subsequent attempt of automatic > IGD opregion detecti

Re: [PATCH] vfio/igd: OpRegion not found fix error typo

2025-05-19 Thread Tomita Moeko
quot;Device does not supports IGD OpRegion feature"); > + "Device does not support IGD OpRegion feature"); > return false; > } > Reviewed-by: Tomita Moeko Thank you for your contribution!

[PATCH v3 8/9] vfio/igd: Only emulate GGC register when x-igd-gms is set

2025-05-05 Thread Tomita Moeko
x-igd-gms is used for overriding DSM region size in GGC register in both config space and MMIO BAR0, by default host value is used. There is no need to emulate it in default case. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 49 ++--- 1 file

[PATCH v3 2/9] vfio/igd: Always emulate ASLS (OpRegion) register

2025-05-05 Thread Tomita Moeko
is unnecessary as access is handled by kvmgt backend [1]. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/gvt/cfg_space.c?h=v6.14#n295 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions

[PATCH v3 9/9] vfio/igd: Remove generation limitation for IGD passthrough

2025-05-05 Thread Tomita Moeko
/linux.git/tree/drivers/gpu/drm/i915/gem/i915_gem_stolen.c?h=v6.14#n142 Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 6 + hw/vfio/igd.c | 58 - 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/docs/igd-assign.txt b/docs

[PATCH v3 7/9] vfio/igd: Allow overriding GMS with 0xf0 to 0xfe on Gen9+

2025-05-05 Thread Tomita Moeko
On Gen9 and later IGD devices, GMS 0xf0 to 0xfe represents 4MB to 60MB pre-allocated memory size in 4MB increments. Allow users overriding GMS with these values. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 59 +++ 1 file changed, 41 insertions

[PATCH v3 6/9] vfio/igd: Enable OpRegion by default

2025-05-05 Thread Tomita Moeko
libvirt: Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 4 ++-- hw/vfio/pci.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index 95beb76812..fc444503ff 100644 --- a/docs/igd-assign.txt +++ b/docs

[PATCH v3 1/9] vfio/igd: Restrict legacy mode to Gen6-9 devices

2025-05-05 Thread Tomita Moeko
-devel/20250325172239.27926-1-tomitamo...@gmail.com/T/ Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 1 + hw/vfio/igd.c | 6 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index 3aed7956d5..95beb76812 100644 --- a/docs/igd

[PATCH v3 4/9] vfio/igd: Check vendor and device ID on GVT-g mdev

2025-05-05 Thread Tomita Moeko
devices. Since mdev cannot be created on these devices, this has no functional impact. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/intel_gvt.c?h=v6.14#n52 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 12 1 file changed, 12

[PATCH v3 3/9] vfio/igd: Detect IGD device by OpRegion

2025-05-05 Thread Tomita Moeko
. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index b1fce76f72..347253d08c 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -185,9 +185,10 @@ static bool

[PATCH v3 0/9] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically

2025-05-05 Thread Tomita Moeko
1-tomitamo...@gmail.com Tomita Moeko (9): vfio/igd: Restrict legacy mode to Gen6-9 devices vfio/igd: Always emulate ASLS (OpRegion) register vfio/igd: Detect IGD device by OpRegion vfio/igd: Check vendor and device ID on GVT-g mdev vfio/igd: Check OpRegion support on GVT-g mdev vfio/igd: Enabl

[PATCH v3 5/9] vfio/igd: Check OpRegion support on GVT-g mdev

2025-05-05 Thread Tomita Moeko
hotplugging. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index f5dd475028..9dec32818c 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -685,9 +685,13 @@ static bool

Re: [PATCH 1/9] vfio/igd: Restrict legacy mode to Gen6-9 devices

2025-05-05 Thread Tomita Moeko
On 5/5/25 16:42, Corvin Köhne wrote: > On Tue, 2025-04-29 at 00:09 +0800, Tomita Moeko wrote: >> CAUTION: External Email!! >> Intel only provides legacy VBIOS for IGD up to Gen9, and there is no >> CSM support on later devices. Additionally, Seabios can only handle >>

Re: [PATCH 0/9] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically

2025-05-05 Thread Tomita Moeko
I forgot adding v2 in subject, sorry for my mistake. Moeko On 4/29/25 00:09, Tomita Moeko wrote: > As proposed in a previous discussion [1], detect IGD devices based on > whether it has VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION exposed by kernel > and enables OpRegion access by defa

Re: [PATCH 8/9] vfio/igd: Only emulate GGC register when x-igd-gms is set

2025-04-29 Thread Tomita Moeko
On 2025/4/29 14:28, Corvin Köhne wrote: > On Tue, 2025-04-29 at 00:10 +0800, Tomita Moeko wrote: >> CAUTION: External Email!! >> x-igd-gms is used for overriding DSM region size in GGC register in >> both config space and MMIO BAR0, by default host value is used. >> The

[PATCH 9/9] vfio/igd: Remove generation limitation for IGD passthrough

2025-04-28 Thread Tomita Moeko
/linux.git/tree/drivers/gpu/drm/i915/gem/i915_gem_stolen.c?h=v6.14#n142 Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 6 + hw/vfio/igd.c | 58 - 2 files changed, 27 insertions(+), 37 deletions(-) diff --git a/docs/igd-assign.txt b/docs

[PATCH 3/9] vfio/igd: Detect IGD device by OpRegion

2025-04-28 Thread Tomita Moeko
. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index ae19456457..d6880cbff7 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -185,9 +185,10 @@ static bool

[PATCH 8/9] vfio/igd: Only emulate GGC register when x-igd-gms is set

2025-04-28 Thread Tomita Moeko
x-igd-gms is used for overriding DSM region size in GGC register in both config space and MMIO BAR0, by default host value is used. There is no need to emulate it in default case. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 49 ++--- 1 file

[PATCH 6/9] vfio/igd: Enable OpRegion by default

2025-04-28 Thread Tomita Moeko
libvirt: Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 4 ++-- hw/vfio/pci.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index 95beb76812..fc444503ff 100644 --- a/docs/igd-assign.txt +++ b/docs

[PATCH 7/9] vfio/igd: Allow overriding GMS with 0xf0 to 0xfe on Gen9+

2025-04-28 Thread Tomita Moeko
On Gen9 and later IGD devices, GMS 0xf0 to 0xfe represents 4MB to 60MB pre-allocated memory size in 4MB increments. Allow users overriding GMS with these values. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 59 +++ 1 file changed, 41 insertions

[PATCH 4/9] vfio/igd: Check vendor and device ID on GVT-g mdev

2025-04-28 Thread Tomita Moeko
devices. Since mdev cannot be created on these devices, this has no functional impact. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/intel_gvt.c?h=v6.14#n52 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 12 1 file changed, 12

[PATCH 2/9] vfio/igd: Always emulate ASLS (OpRegion) register

2025-04-28 Thread Tomita Moeko
is unnecessary as access is handled by kvmgt backend [1]. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/gvt/cfg_space.c?h=v6.14#n295 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions

[PATCH 0/9] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically

2025-04-28 Thread Tomita Moeko
t opregion in a single function. * Update documentation along with code changes. * Minor code style fixes. Link: https://lore.kernel.org/qemu-devel/20250421163112.21316-1-tomitamo...@gmail.coms Tomita Moeko (9): vfio/igd: Restrict legacy mode to Gen6-9 devices vfio/igd: Always emulate ASLS

[PATCH 5/9] vfio/igd: Check OpRegion support on GVT-g mdev

2025-04-28 Thread Tomita Moeko
hotplugging. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index c6ecbefb35..496d3df598 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -684,9 +684,13 @@ static bool

[PATCH 1/9] vfio/igd: Restrict legacy mode to Gen6-9 devices

2025-04-28 Thread Tomita Moeko
-devel/20250325172239.27926-1-tomitamo...@gmail.com/T/ Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 1 + hw/vfio/igd.c | 6 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index 3aed7956d5..95beb76812 100644 --- a/docs/igd

Re: [PATCH 03/11] vfio/igd: Detect IGD device by OpRegion

2025-04-28 Thread Tomita Moeko
On 4/23/25 14:54, Corvin Köhne wrote: > On Tue, 2025-04-22 at 00:31 +0800, Tomita Moeko wrote: >> CAUTION: External Email!! >> There is currently no straightforward way to distinguish if a Intel >> graphics device is IGD or discrete GPU. However, only IGD devices expose

Re: [PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled

2025-04-28 Thread Tomita Moeko
On 4/25/25 06:57, Alex Williamson wrote: > On Tue, 22 Apr 2025 00:31:07 +0800 > Tomita Moeko wrote: > >> OpRegion is exposed to guest as a read-only fw_cfg item, so hotplugging >> with it wouldn't cause issues. Since OpRegion needs to be set up by >> guest firmw

[PATCH 09/11] vfio/igd: Only emulate GGC register when x-igd-gms is set

2025-04-21 Thread Tomita Moeko
x-igd-gms is used for overriding DSM region size in GGC register in both config space and MMIO BAR0, by default host value is used. There is no need to emulate it in default case. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 49 ++--- 1 file

[PATCH 11/11] vfio/igd: Update IGD passthrough documentation

2025-04-21 Thread Tomita Moeko
Update the documentation to reflect these changes. Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index 3aed7956d5..eac31ea3dd 100644 --- a/docs/igd-assign.txt +++

[PATCH 05/11] vfio/igd: Check vendor and device ID on GVT-g mdev

2025-04-21 Thread Tomita Moeko
devices. Since mdev cannot be created on these devices, this has no functional impact. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/intel_gvt.c?h=v6.14#n52 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 13 + 1 file changed, 13

[PATCH 10/11] vfio/igd: Remove generation limitation for IGD passthrough

2025-04-21 Thread Tomita Moeko
/linux.git/tree/drivers/gpu/drm/i915/gem/i915_gem_stolen.c?h=v6.14#n142 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 58 +++ 1 file changed, 21 insertions(+), 37 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index bc4c79837d..5b888616f0

[PATCH 07/11] vfio/igd: Allow hotplugging with OpRegion enabled

2025-04-21 Thread Tomita Moeko
y not required. Still, hotplugging IGD devices is highly discouraged. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bb1d132935c2f87cd261eb559759fe49d5e5dc43 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 4 1 file changed, 4 deletions(-) diff --git a/hw

[PATCH 08/11] vfio/igd: Allow overriding GMS with 0xf0 to 0xfe on Gen9+

2025-04-21 Thread Tomita Moeko
On Gen9 and later IGD devices, GMS 0xf0 to 0xfe represents 4MB to 60MB pre-allocated memory size in 4MB increments. Allow users overriding GMS with these values. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 59 +++ 1 file changed, 41 insertions

[PATCH 04/11] vfio/igd: Remove vfio_pci_igd_setup_opregion

2025-04-21 Thread Tomita Moeko
claimed support for GVT-g hotplugging. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 50 +- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 7a7c7735c1..cc397f8829 100644 --- a/hw/vfio/igd.c

[PATCH 00/11] vfio/igd: Detect IGD by OpRegion and enable OpRegion automatically

2025-04-21 Thread Tomita Moeko
] https://edc.intel.com/content/www/us/en/design/publications/14th-generation-core-processors-cfg-and-mem-registers/d2-f0-processor-graphics-registers/ Tomita Moeko (11): vfio/igd: Restrict legacy mode to Gen6-9 devices vfio/igd: Always emulate ASLS (OpRegion) register vfio/igd: Detect IGD

[PATCH 06/11] vfio/igd: Enable OpRegion by default

2025-04-21 Thread Tomita Moeko
libvirt: Signed-off-by: Tomita Moeko --- hw/vfio/pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 05a7a62204..38ff231625 100644 --- a/hw/vfio/pci.c +++ b/hw/vfio/pci.c @@ -3361,7 +3361,7 @@ static const Property

[PATCH 03/11] vfio/igd: Detect IGD device by OpRegion

2025-04-21 Thread Tomita Moeko
There is currently no straightforward way to distinguish if a Intel graphics device is IGD or discrete GPU. However, only IGD devices expose OpRegion. Use the presence of VFIO_REGION_SUBTYPE_INTEL_IGD_OPREGION to identify IGD devices. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 26

[PATCH 02/11] vfio/igd: Always emulate ASLS (OpRegion) register

2025-04-21 Thread Tomita Moeko
is unnecessary as access is handled by kvmgt backend [1]. [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/i915/gvt/cfg_space.c?h=v6.14#n295 Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions

[PATCH 01/11] vfio/igd: Restrict legacy mode to Gen6-9 devices

2025-04-21 Thread Tomita Moeko
-devel/20250325172239.27926-1-tomitamo...@gmail.com/T/ Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 6678e0e5cd..01826acf10 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -516,11 +516,13

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-16 Thread Tomita Moeko
On 4/17/25 00:10, Alex Williamson wrote: > On Wed, 16 Apr 2025 23:45:08 +0800 > Tomita Moeko wrote: > >> On 4/16/25 03:04, Alex Williamson wrote: >>> On Wed, 16 Apr 2025 01:36:15 +0800 >>> Tomita Moeko wrote: >>>> >>>> The genera

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-16 Thread Tomita Moeko
On 4/16/25 03:04, Alex Williamson wrote: > On Wed, 16 Apr 2025 01:36:15 +0800 > Tomita Moeko wrote: >> >> The generation register also exists on discrete GPUs. In the new xe >> driver [1], the Battlemage discrete GPU shares the same logic reading >> GMD_ID_DISPLAY re

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-15 Thread Tomita Moeko
On 4/15/25 06:05, Alex Williamson wrote: > On Mon, 14 Apr 2025 01:23:56 +0800 > Tomita Moeko wrote: > >> On 4/10/25 15:34, Cédric Le Goater wrote: >>> + Corvin >>> >>> On 4/9/25 19:18, Alex Williamson wrote: >>>> On Wed, 26 Mar 2025 01:22:

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-13 Thread Tomita Moeko
On 4/10/25 15:34, Cédric Le Goater wrote: > + Corvin > > On 4/9/25 19:18, Alex Williamson wrote: >> On Wed, 26 Mar 2025 01:22:39 +0800 >> Tomita Moeko wrote: >> >>> So far, all Intel VGA adapters, including discrete GPUs like A770 and >>> B580, w

Re: [PATCH] vfio/igd: Check host PCI address when probing

2025-04-13 Thread Tomita Moeko
On 4/10/25 01:18, Alex Williamson wrote: > On Wed, 26 Mar 2025 01:22:39 +0800 > Tomita Moeko wrote: > >> So far, all Intel VGA adapters, including discrete GPUs like A770 and >> B580, were treated as IGD devices. While this had no functional impact, >> a error about &q

Re: [PATCH 02/14] vfio: refactor out vfio_pci_config_setup()

2025-04-09 Thread Tomita Moeko
Hi, John On 4/9/25 21:48, John Levon wrote: > Refactor the PCI config setup code out of vfio_realize() for > readability. > > Reviewed-by: Cédric Le Goater > Signed-off-by: John Levon > --- > hw/vfio/pci.c | 176 +++--- > 1 file changed, 94 insertion

Re: [PATCH 11/14] vfio: add vfio_pci_config_space_read/write()

2025-04-09 Thread Tomita Moeko
On 4/9/25 23:54, John Levon wrote: > On Wed, Apr 09, 2025 at 11:51:09PM +0800, Tomita Moeko wrote: > >> On 4/9/25 21:48, John Levon wrote: >>> Add these helpers that access config space and return an -errno style >>> return. >>> >>> Signed-off-

Re: [PATCH 11/14] vfio: add vfio_pci_config_space_read/write()

2025-04-09 Thread Tomita Moeko
On 4/9/25 21:48, John Levon wrote: > Add these helpers that access config space and return an -errno style > return. > > Signed-off-by: John Levon > --- > hw/vfio/pci.c | 134 ++ > 1 file changed, 91 insertions(+), 43 deletions(-) > > diff --git a

[PATCH] vfio/igd: Check host PCI address when probing

2025-03-25 Thread Tomita Moeko
ot;, let's check the host PCI address when probing. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 265fffc2aa..ff250017b0 100644 --- a/hw/vfio/igd.c +++ b/hw/v

[PATCH v2] vfio/igd: Update IGD passthrough documentation

2025-03-13 Thread Tomita Moeko
, are also added. Signed-off-by: Tomita Moeko --- v2: * Fixed typos Link: https://lore.kernel.org/all/20250312155002.286841-1-tomitamo...@gmail.com/ docs/igd-assign.txt | 265 1 file changed, 196 insertions(+), 69 deletions(-) diff --git a/docs/igd

[PATCH] vfio/igd: Update IGD passthrough docoumentation

2025-03-12 Thread Tomita Moeko
, are also added. Signed-off-by: Tomita Moeko --- docs/igd-assign.txt | 262 1 file changed, 193 insertions(+), 69 deletions(-) diff --git a/docs/igd-assign.txt b/docs/igd-assign.txt index e17bb50789..c7c4565906 100644 --- a/docs/igd-assign.txt +++ b

Re: [PATCH v3 07/10] vfio/igd: Decouple common quirks from legacy mode

2025-03-11 Thread Tomita Moeko
On 2025/3/10 15:13, Cédric Le Goater wrote: > Tomita, > > On 3/7/25 19:37, Tomita Moeko wrote: >> On 2025/3/7 6:49, Alex Williamson wrote: >>> On Fri,  7 Mar 2025 02:01:27 +0800 >>> Tomita Moeko wrote: >>> >>>> So far, IGD-specific quirks a

[PATCH v3 03/10] vfio/igd: Consolidate OpRegion initialization into a single function

2025-03-11 Thread Tomita Moeko
removed after we decouple it from legacy mode. Additionally, move vfio_pci_igd_opregion_init to igd.c to prevent it from being compiled in non-x86 builds. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 101 +++ hw/vfio/pci-quirks.c | 50

Re: [PATCH v2 12/21] hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin()

2025-03-11 Thread Tomita Moeko
On 3/10/25 21:43, Philippe Mathieu-Daudé wrote: > On 10/3/25 08:37, Cédric Le Goater wrote: >> On 3/9/25 00:09, Philippe Mathieu-Daudé wrote: >>> Convert the compile time check on the CONFIG_VFIO_IGD definition >>> by a runtime one by calling vfio_igd_builtin(), which check >>> whether VFIO_IGD is

Re: [PATCH v3 07/10] vfio/igd: Decouple common quirks from legacy mode

2025-03-07 Thread Tomita Moeko
On 2025/3/7 6:49, Alex Williamson wrote: > On Fri, 7 Mar 2025 02:01:27 +0800 > Tomita Moeko wrote: > >> So far, IGD-specific quirks all require enabling legacy mode, which is >> toggled by assigning IGD to 00:02.0. However, some quirks, like the BDSM >> and GGC

[PATCH v3 09/10] vfio/igd: Introduce x-igd-lpc option for LPC bridge ID quirk

2025-03-07 Thread Tomita Moeko
The LPC bridge/Host bridge IDs quirk is also not dependent on legacy mode. Recent Windows driver no longer depends on these IDs, as well as Linux i915 driver, while UEFI GOP seems still needs them. Make it an option to allow users enabling and disabling it as needed. Signed-off-by: Tomita Moeko

[PATCH v3 01/10] vfio/igd: Remove GTT write quirk in IO BAR 4

2025-03-07 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 v3 02/10] vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size

2025-03-06 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 IgdAssignmentDxe 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

[PATCH v3 06/10] vfio/igd: Refactor vfio_probe_igd_bar4_quirk into pci config quirk

2025-03-06 Thread Tomita Moeko
, it returns and proceeds on error. Later it will fail on error after decoupling the quirks from legacy mode. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 21 - hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.h| 2 +- 3 files changed, 18 insertions(+), 11

[PATCH v3 05/10] vfio/pci: Add placeholder for device-specific config space quirks

2025-03-06 Thread Tomita Moeko
IGD devices require device-specific quirk to be applied to their PCI config space. Currently, it is put in the BAR4 quirk that does nothing to BAR4 itself. Add a placeholder for PCI config space quirks to hold that quirk later. Signed-off-by: Tomita Moeko --- hw/vfio/pci-quirks.c | 5 + hw

[PATCH v3 10/10] vfio/igd: Fix broken KVMGT OpRegion support

2025-03-06 Thread Tomita Moeko
not (passthrough), and then applies corresponding quirks. As before, users must manually specify x-igd-opregion=on to enable it on KVMGT devices. In the future, we may check the VID/DID and enable OpRegion automatically. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 27

[PATCH v3 07/10] vfio/igd: Decouple common quirks from legacy mode

2025-03-06 Thread Tomita Moeko
dditionally, the hotplug check in legacy mode is removed as hotplugging IGD device is never supported, and it will be checked when enabling the OpRegion quirk. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 127 +- hw/vfio/pci.c | 2 + hw/vfio/

[PATCH v3 08/10] vfio/igd: Handle x-igd-opregion option in config quirk

2025-03-06 Thread Tomita Moeko
Both enable OpRegion option (x-igd-opregion) and legacy mode require setting up OpRegion copy for IGD devices. As the config quirk no longer depends on legacy mode, we can now handle x-igd-opregion option there instead of in vfio_realize. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14

[PATCH v3 04/10] vfio/igd: Move LPC bridge initialization to a separate function

2025-03-06 Thread Tomita Moeko
A new option will soon be introduced to decouple the LPC bridge/Host bridge ID quirk from legacy mode. To prepare for this, move the LPC bridge initialization into a separate function. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 122 +- 1 file

[PATCH v3 00/10] vfio/igd: Decoupling quirks with legacy mode

2025-03-06 Thread Tomita Moeko
KVMGT/GVT-g fail. Link: https://lore.kernel.org/all/20250303175220.74917-1-tomitamo...@gmail.com/ v2: * Keep legacy mode for compatbility * Renamed from "vfio/igd: Remove legacy mode" Link: https://lore.kernel.org/all/20250224182927.31519-1-tomitamo...@gmail.com/ Tomita Moeko (10):

Re: [PATCH v2 2/9] vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size

2025-03-04 Thread Tomita Moeko
On 3/4/25 15:17, Corvin Köhne wrote: > On Tue, 2025-03-04 at 01:52 +0800, Tomita Moeko wrote: >> Though GTT Stolen Memory (GSM) is right below Data Stolen Memory (DSM) >> in host address space, direct access to GSM is prohibited, and it is >> not mapped to guest address space

[PATCH v2 3/9] vfio/igd: Consolidate OpRegion initialization into a single function

2025-03-03 Thread Tomita Moeko
removed after we decouple it from legacy mode. Additionally, move vfio_pci_igd_opregion_init to igd.c to prevent it from being compiled in non-x86 builds. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 101 +++ hw/vfio/pci-quirks.c | 50

[PATCH v2 6/9] vfio/igd: Refactor vfio_probe_igd_bar4_quirk into pci config quirk

2025-03-03 Thread Tomita Moeko
, it returns and proceeds on error. Later it will fail on error after decoupling the quirks from legacy mode. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 21 - hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.h| 2 +- 3 files changed, 18 insertions(+), 11

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

2025-03-03 Thread Tomita Moeko
IGD devices require device-specific quirk to be applied to their PCI config space. Currently, it is put in the BAR4 quirk that does nothing to BAR4 itself. Add a placeholder for PCI config space quirks to hold that quirk later. Signed-off-by: Tomita Moeko --- hw/vfio/pci-quirks.c | 5 + hw

[PATCH v2 8/9] vfio/igd: Handle x-igd-opregion option in config quirk

2025-03-03 Thread Tomita Moeko
Both enable OpRegion option (x-igd-opregion) and legacy mode require setting up OpRegion copy for IGD devices. As the config quirk no longer depends on legacy mode, we can now handle x-igd-opregion option there instead of in vfio_realize. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 14

[PATCH v2 4/9] vfio/igd: Move LPC bridge initialization to a separate function

2025-03-03 Thread Tomita Moeko
A new option will soon be introduced to decouple the LPC bridge/Host bridge ID quirk from legacy mode. To prepare for this, move the LPC bridge initialization into a separate function. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 122 +- 1 file

[PATCH v2 7/9] vfio/igd: Decouple common quirks from legacy mode

2025-03-03 Thread Tomita Moeko
occurs when setting up legacy mode, instead of simply continues like before. If legacy mode is unwanted, it can be explicitly disabled by x-igd-legacy-mode=off. Additionally, the hotplug check in legacy mode is removed as it will be checked when enabling the OpRegion quirk. Signed-off-by: Tomita

[PATCH v2 9/9] vfio/igd: Introduce x-igd-lpc option for LPC bridge ID quirk

2025-03-03 Thread Tomita Moeko
The LPC bridge/Host bridge IDs quirk is also not dependent on legacy mode. Recent Windows driver no longer depends on these IDs, as well as Linux i915 driver, while UEFI GOP seems still needs them. Make it an option to allow users enabling and disabling it as needed. Signed-off-by: Tomita Moeko

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

2025-03-03 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 v2 0/9] vfio/igd: Decoupling quirks with legacy mode

2025-03-03 Thread Tomita Moeko
"vfio/igd: Remove legacy mode" Link: https://lore.kernel.org/all/20250224182927.31519-1-tomitamo...@gmail.com/ Tomita Moeko (9): vfio/igd: Remove GTT write quirk in IO BAR 4 vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size vfio/igd: Consolidate OpRegion initializat

[PATCH v2 2/9] vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size

2025-03-03 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] MAINTAINERS: Add myself as vfio-igd maintainer

2025-02-27 Thread Tomita Moeko
As suggested by Cédric, I'm glad to be a maintainer of vfio-igd. Signed-off-by: Tomita Moeko --- MAINTAINERS | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 1911949526..c6ed2f46f0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -21

Re: [PATCH 00/10] vfio/igd: Remove legacy mode

2025-02-27 Thread Tomita Moeko
Hello Cédric, On 2/27/25 16:28, Cédric Le Goater wrote: > Hello Tomita, > > +Corvin > > On 2/24/25 19:29, Tomita Moeko wrote: >> This patchset removes some legacy checks and converts the legacy mode >> implicitly enabled by BDF 00:02.0 into x-igd-* options, including

[PATCH 06/10] vfio/igd: Consolidate OpRegion initialization into a single function

2025-02-24 Thread Tomita Moeko
removed later after the removal of legacy mode. Additionally, move vfio_pci_igd_opregion_init to igd.c to prevent it from being compiled in non-x86 builds. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 111 +-- hw/vfio/pci-quirks.c | 50

[PATCH 10/10] vfio/igd: Replace legacy mode with options

2025-02-24 Thread Tomita Moeko
being 00:02.0, but guest drivers like EFI GOP driver still hardcodes the BDF. It is highly recommended to assign IGD to 00:02.0. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 38 +- hw/vfio/pci.c | 11 ++- hw/vfio/pci.h | 3 +++ 3 files changed, 14

[PATCH 09/10] vfio/igd: Refactor vfio_probe_igd_bar4_quirk into pci config quirk

2025-02-24 Thread Tomita Moeko
, it returns and proceeds on error. Later it will fail on error after the removal of legacy mode. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c| 16 +--- hw/vfio/pci-quirks.c | 6 +- hw/vfio/pci.h| 2 +- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git

[PATCH 04/10] vfio/igd: Remove implicit VGA access enabled by legacy mode

2025-02-24 Thread Tomita Moeko
enable VGA access for IGD, use the common x-vga option explicily. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index 4ae1122a2d..32ae263c23 100644 --- a/hw/vfio/igd.c +++ b/hw

[PATCH 08/10] vfio/pci: Add placeholder for device-specific config space quirks

2025-02-24 Thread Tomita Moeko
IGD devices require device-specific quirk to be applied to their PCI config space. Currently, it is put in the BAR4 quirk that does nothing to BAR4 itself. Add a placeholder for PCI config space quirks to hold that quirk later. Signed-off-by: Tomita Moeko --- hw/vfio/pci-quirks.c | 5 + hw

[PATCH 03/10] vfio/igd: Remove rombar check for legacy mode

2025-02-24 Thread Tomita Moeko
Legacy VBIOS support was removed in Gen 11 and later IGD devices. While we usually uses romfile for IGD-related DXE drivers, it's not always necessary. Remove the ROM BAR requirement for legacy mode to support newer devices without a specified romfile. Signed-off-by: Tomita Moeko --- hw

[PATCH 02/10] vfio/igd: Do not include GTT stolen size in etc/igd-bdsm-size

2025-02-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 01/10] vfio/igd: Remove GTT write quirk in IO BAR 4

2025-02-24 Thread Tomita Moeko
ff-by: Tomita Moeko --- hw/vfio/igd.c | 191 +- 1 file changed, 1 insertion(+), 190 deletions(-) diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c index b1a237edd6..ca3a32f4f2 100644 --- a/hw/vfio/igd.c +++ b/hw/vfio/igd.c @@ -106,12 +106,6 @@ static int ig

[PATCH 07/10] vfio/igd: Move LPC bridge initialization to a separate function

2025-02-24 Thread Tomita Moeko
A new option will soon be introduced to control whether to apply the LPC bridge/Host bridge ID quirk for the removal of implicit legacy mode. To prepare for this, move the LPC bridge initialization into a separate function. Signed-off-by: Tomita Moeko --- hw/vfio/igd.c | 125

[PATCH 05/10] vfio/pci: Make vfio_populate_vga static

2025-02-24 Thread Tomita Moeko
vfio_populate_vga is no longer called in igd.c. Make it static. Signed-off-by: Tomita Moeko --- hw/vfio/pci.c | 2 +- hw/vfio/pci.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c index 89d900e9cf..1c45e3987e 100644 --- a/hw/vfio/pci.c +++ b

  1   2   >