[PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD

Pierrick Bouvier posted 8 patches 2 weeks ago
Maintainers: Thomas Huth <thuth@redhat.com>, Alex Williamson <alex@shazbot.org>, "Cédric Le Goater" <clg@redhat.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Paolo Bonzini <pbonzini@redhat.com>, Nicholas Piggin <npiggin@gmail.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Richard Henderson <richard.henderson@linaro.org>, Ilya Leoshkevich <iii@linux.ibm.com>, David Hildenbrand <david@kernel.org>
There is a newer version of this series
[PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Pierrick Bouvier 2 weeks ago
Add stubs for needed functions.

Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
 hw/vfio/pci-quirks.c |  5 -----
 hw/vfio/meson.build  |  3 ++-
 3 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 hw/vfio/igd-stubs.c

diff --git a/hw/vfio/igd-stubs.c b/hw/vfio/igd-stubs.c
new file mode 100644
index 00000000000..f7687d90912
--- /dev/null
+++ b/hw/vfio/igd-stubs.c
@@ -0,0 +1,20 @@
+/*
+ * IGD device quirks stubs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qmp/qerror.h"
+#include "pci.h"
+#include "pci-quirks.h"
+
+void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
+{
+    return;
+}
+
+bool vfio_probe_igd_config_quirk(VFIOPCIDevice *vdev, Error **errp)
+{
+    return true;
+}
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 7b907b9360d..ab864048943 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -11,7 +11,6 @@
  */
 
 #include "qemu/osdep.h"
-#include CONFIG_DEVICES
 #include "exec/memop.h"
 #include "qemu/units.h"
 #include "qemu/log.h"
@@ -1128,11 +1127,9 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
  */
 bool vfio_config_quirk_setup(VFIOPCIDevice *vdev, Error **errp)
 {
-#ifdef CONFIG_VFIO_IGD
     if (!vfio_probe_igd_config_quirk(vdev, errp)) {
         return false;
     }
-#endif
     return true;
 }
 
@@ -1179,9 +1176,7 @@ void vfio_bar_quirk_setup(VFIOPCIDevice *vdev, int nr)
     vfio_probe_nvidia_bar5_quirk(vdev, nr);
     vfio_probe_nvidia_bar0_quirk(vdev, nr);
     vfio_probe_rtl8168_bar2_quirk(vdev, nr);
-#ifdef CONFIG_VFIO_IGD
     vfio_probe_igd_bar0_quirk(vdev, nr);
-#endif
 }
 
 void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr)
diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
index f32d8573600..562ba79d1c0 100644
--- a/hw/vfio/meson.build
+++ b/hw/vfio/meson.build
@@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
 ))
 vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
 vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
-vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
+vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
+                                     if_false: files('igd-stubs.c'))
 
 specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
 
-- 
2.47.3
Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Cédric Le Goater 1 week, 6 days ago
On 3/12/26 23:44, Pierrick Bouvier wrote:
> Add stubs for needed functions.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>   hw/vfio/pci-quirks.c |  5 -----
>   hw/vfio/meson.build  |  3 ++-
>   3 files changed, 22 insertions(+), 6 deletions(-)
>   create mode 100644 hw/vfio/igd-stubs.c
Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Philippe Mathieu-Daudé 1 week, 6 days ago
On 12/3/26 23:44, Pierrick Bouvier wrote:
> Add stubs for needed functions.
> 
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>   hw/vfio/pci-quirks.c |  5 -----
>   hw/vfio/meson.build  |  3 ++-
>   3 files changed, 22 insertions(+), 6 deletions(-)
>   create mode 100644 hw/vfio/igd-stubs.c


> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
> index f32d8573600..562ba79d1c0 100644
> --- a/hw/vfio/meson.build
> +++ b/hw/vfio/meson.build
> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>   ))
>   vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>   vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
> +                                     if_false: files('igd-stubs.c'))

Directly add to global stubs source set, otherwise:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Pierrick Bouvier 1 week, 4 days ago
On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Add stubs for needed functions.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>    hw/vfio/pci-quirks.c |  5 -----
>>    hw/vfio/meson.build  |  3 ++-
>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>    create mode 100644 hw/vfio/igd-stubs.c
> 
> 
>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>> index f32d8573600..562ba79d1c0 100644
>> --- a/hw/vfio/meson.build
>> +++ b/hw/vfio/meson.build
>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>    ))
>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>> +                                     if_false: files('igd-stubs.c'))
> 
> Directly add to global stubs source set, otherwise:
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

To share some information, using the global stub mechanism instead of 
subsystem ones makes one difference: some dependencies are not included. 
In the case of this stub file, pixman.h and epoxy/gl.h are transitively 
included, which is solved by adding those dependencies to qemuutil library.

Nothing too complex, but just worth mentioning in case you ran into an 
issue similar for other stubs.

Regards,
Pierrick

Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Philippe Mathieu-Daudé 1 week, 4 days ago
On 15/3/26 03:57, Pierrick Bouvier wrote:
> On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
>> On 12/3/26 23:44, Pierrick Bouvier wrote:
>>> Add stubs for needed functions.
>>>
>>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>>> ---
>>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>>    hw/vfio/pci-quirks.c |  5 -----
>>>    hw/vfio/meson.build  |  3 ++-
>>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>>    create mode 100644 hw/vfio/igd-stubs.c
>>
>>
>>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>>> index f32d8573600..562ba79d1c0 100644
>>> --- a/hw/vfio/meson.build
>>> +++ b/hw/vfio/meson.build
>>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>>    ))
>>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>>> +                                     if_false: files('igd-stubs.c'))
>>
>> Directly add to global stubs source set, otherwise:
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> 
> To share some information, using the global stub mechanism instead of 
> subsystem ones makes one difference: some dependencies are not included. 
> In the case of this stub file, pixman.h and epoxy/gl.h are transitively 
> included, which is solved by adding those dependencies to qemuutil library.

Yep, this explains and fixes the failure I had with this patch:

https://lore.kernel.org/qemu-devel/20260225035739.42848-8-philmd@linaro.org/

Thanks!

> 
> Nothing too complex, but just worth mentioning in case you ran into an 
> issue similar for other stubs.
> 
> Regards,
> Pierrick


Re: [PATCH 3/8] hw/vfio/pci-quirks.c: remove CONFIG_VFIO_IGD
Posted by Pierrick Bouvier 1 week, 6 days ago
On 3/12/26 8:20 PM, Philippe Mathieu-Daudé wrote:
> On 12/3/26 23:44, Pierrick Bouvier wrote:
>> Add stubs for needed functions.
>>
>> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
>> ---
>>    hw/vfio/igd-stubs.c  | 20 ++++++++++++++++++++
>>    hw/vfio/pci-quirks.c |  5 -----
>>    hw/vfio/meson.build  |  3 ++-
>>    3 files changed, 22 insertions(+), 6 deletions(-)
>>    create mode 100644 hw/vfio/igd-stubs.c
> 
> 
>> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
>> index f32d8573600..562ba79d1c0 100644
>> --- a/hw/vfio/meson.build
>> +++ b/hw/vfio/meson.build
>> @@ -16,7 +16,8 @@ vfio_ss.add(when: 'CONFIG_VFIO_PCI', if_true: files(
>>    ))
>>    vfio_ss.add(when: 'CONFIG_VFIO_CCW', if_true: files('ccw.c'))
>>    vfio_ss.add(when: 'CONFIG_VFIO_AP', if_true: files('ap.c'))
>> -vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'))
>> +vfio_ss.add(when: 'CONFIG_VFIO_IGD', if_true: files('igd.c'),
>> +                                     if_false: files('igd-stubs.c'))
> 
> Directly add to global stubs source set, otherwise:
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Will do it too, thanks.