From: "Cédric Le Goater" <clg@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: "Yi Liu" <yi.l.liu@intel.com>,
"Pierrick Bouvier" <pierrick.bouvier@linaro.org>,
"Alex Williamson" <alex.williamson@redhat.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Tony Krowiak" <akrowiak@linux.ibm.com>,
"Nicholas Piggin" <npiggin@gmail.com>,
"Halil Pasic" <pasic@linux.ibm.com>,
"Thomas Huth" <thuth@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Matthew Rosato" <mjrosato@linux.ibm.com>,
"Tomita Moeko" <tomitamoeko@gmail.com>,
qemu-ppc@nongnu.org,
"Daniel Henrique Barboza" <danielhb413@gmail.com>,
"Eric Farman" <farman@linux.ibm.com>,
"Eduardo Habkost" <eduardo@habkost.net>,
"Peter Xu" <peterx@redhat.com>,
kvm@vger.kernel.org, "Zhenzhong Duan" <zhenzhong.duan@intel.com>,
qemu-s390x@nongnu.org, "Eric Auger" <eric.auger@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Harsh Prateek Bora" <harshpb@linux.ibm.com>,
"Ilya Leoshkevich" <iii@linux.ibm.com>,
"Jason Herne" <jjherne@linux.ibm.com>,
"Daniel P. Berrangé" <berrange@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>
Subject: Re: [PATCH v2 12/21] hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin()
Date: Mon, 10 Mar 2025 08:37:49 +0100 [thread overview]
Message-ID: <415339c1-8f83-4059-949e-63ef0c28b4b9@redhat.com> (raw)
In-Reply-To: <20250308230917.18907-13-philmd@linaro.org>
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 built in a qemu-system binary.
>
> Add stubs to avoid when VFIO_IGD is not built in:
I thought we were trying to avoid stubs in QEMU build. Did that change ?
Thanks,
C.
>
> /usr/bin/ld: libqemu-x86_64-softmmu.a.p/hw_vfio_pci-quirks.c.o: in function `vfio_bar_quirk_setup':
> /usr/bin/ld: ../hw/vfio/pci-quirks.c:1216: undefined reference to `vfio_probe_igd_bar0_quirk'
> /usr/bin/ld: ../hw/vfio/pci-quirks.c:1217: undefined reference to `vfio_probe_igd_bar4_quirk'
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> hw/vfio/pci-quirks.h | 6 ++++++
> hw/vfio/igd-stubs.c | 20 ++++++++++++++++++++
> hw/vfio/pci-quirks.c | 9 ++++-----
> hw/vfio/meson.build | 3 +++
> 4 files changed, 33 insertions(+), 5 deletions(-)
> create mode 100644 hw/vfio/igd-stubs.c
>
> diff --git a/hw/vfio/pci-quirks.h b/hw/vfio/pci-quirks.h
> index fdaa81f00aa..dcdb1962600 100644
> --- a/hw/vfio/pci-quirks.h
> +++ b/hw/vfio/pci-quirks.h
> @@ -13,6 +13,7 @@
> #define HW_VFIO_VFIO_PCI_QUIRKS_H
>
> #include "qemu/osdep.h"
> +#include "qom/object.h"
> #include "exec/memop.h"
>
> /*
> @@ -71,4 +72,9 @@ extern const MemoryRegionOps vfio_generic_mirror_quirk;
>
> #define TYPE_VFIO_PCI_IGD_LPC_BRIDGE "vfio-pci-igd-lpc-bridge"
>
> +static inline bool vfio_igd_builtin(void)
> +{
> + return type_is_registered(TYPE_VFIO_PCI_IGD_LPC_BRIDGE);
> +}
> +
> #endif /* HW_VFIO_VFIO_PCI_QUIRKS_H */
> diff --git a/hw/vfio/igd-stubs.c b/hw/vfio/igd-stubs.c
> new file mode 100644
> index 00000000000..5d4e88aeb1b
> --- /dev/null
> +++ b/hw/vfio/igd-stubs.c
> @@ -0,0 +1,20 @@
> +/*
> + * IGD device quirk stubs
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + *
> + * Copyright (C) Linaro, Ltd.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "pci.h"
> +
> +void vfio_probe_igd_bar0_quirk(VFIOPCIDevice *vdev, int nr)
> +{
> + g_assert_not_reached();
> +}
> +
> +void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *vdev, int nr)
> +{
> + g_assert_not_reached();
> +}
> diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
> index c53591fe2ba..22cb35af8cc 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"
> @@ -1213,10 +1212,10 @@ 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);
> - vfio_probe_igd_bar4_quirk(vdev, nr);
> -#endif
> + if (vfio_igd_builtin()) {
> + vfio_probe_igd_bar0_quirk(vdev, nr);
> + vfio_probe_igd_bar4_quirk(vdev, nr);
> + }
> }
>
> void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr)
> diff --git a/hw/vfio/meson.build b/hw/vfio/meson.build
> index a8939c83865..6ab711d0539 100644
> --- a/hw/vfio/meson.build
> +++ b/hw/vfio/meson.build
> @@ -17,6 +17,9 @@ specific_ss.add_all(when: 'CONFIG_VFIO', if_true: vfio_ss)
>
> system_ss.add(when: 'CONFIG_VFIO_XGMAC', if_true: files('calxeda-xgmac.c'))
> system_ss.add(when: 'CONFIG_VFIO_AMD_XGBE', if_true: files('amd-xgbe.c'))
> +system_ss.add(when: 'CONFIG_VFIO_IGD', if_false: files(
> + 'igd-stubs.c',
> +))
> system_ss.add(when: 'CONFIG_VFIO', if_true: files(
> 'helpers.c',
> 'container-base.c',
next prev parent reply other threads:[~2025-03-10 7:38 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-08 23:08 [PATCH v2 00/21] hw/vfio: Build various objects once Philippe Mathieu-Daudé
2025-03-08 23:08 ` [PATCH v2 01/21] hw/vfio/common: Include missing 'system/tcg.h' header Philippe Mathieu-Daudé
2025-03-10 8:08 ` Eric Auger
2025-03-08 23:08 ` [PATCH v2 02/21] hw/vfio/spapr: Do not include <linux/kvm.h> Philippe Mathieu-Daudé
2025-03-10 8:08 ` Eric Auger
2025-03-08 23:08 ` [PATCH v2 03/21] hw/vfio: Compile some common objects once Philippe Mathieu-Daudé
2025-03-10 8:19 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 04/21] hw/vfio: Compile more " Philippe Mathieu-Daudé
2025-03-10 8:20 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 05/21] hw/vfio: Compile iommufd.c once Philippe Mathieu-Daudé
2025-03-10 8:23 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 06/21] system: Declare qemu_[min/max]rampagesize() in 'system/hostmem.h' Philippe Mathieu-Daudé
2025-03-10 8:28 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 07/21] hw/vfio: Compile display.c once Philippe Mathieu-Daudé
2025-03-10 8:29 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 08/21] system/kvm: Expose kvm_irqchip_[add, remove]_change_notifier() Philippe Mathieu-Daudé
2025-03-09 18:54 ` [PATCH v2 08/21] system/kvm: Expose kvm_irqchip_[add,remove]_change_notifier() Richard Henderson
2025-03-10 8:35 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 09/21] hw/vfio/pci: Convert CONFIG_KVM check to runtime one Philippe Mathieu-Daudé
2025-03-10 9:54 ` Eric Auger
2025-03-10 12:54 ` BALATON Zoltan
2025-03-10 14:53 ` Eric Auger
2025-03-11 8:54 ` Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 10/21] qom: Introduce type_is_registered() Philippe Mathieu-Daudé
2025-03-09 19:14 ` Richard Henderson
2025-03-10 7:38 ` Cédric Le Goater
2025-03-10 9:54 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 11/21] hw/vfio/igd: Define TYPE_VFIO_PCI_IGD_LPC_BRIDGE Philippe Mathieu-Daudé
2025-03-10 7:38 ` Cédric Le Goater
2025-03-10 9:54 ` Eric Auger
2025-03-08 23:09 ` [PATCH v2 12/21] hw/vfio/igd: Check CONFIG_VFIO_IGD at runtime using vfio_igd_builtin() Philippe Mathieu-Daudé
2025-03-10 7:37 ` Cédric Le Goater [this message]
2025-03-10 13:43 ` Philippe Mathieu-Daudé
2025-03-10 13:51 ` Cédric Le Goater
2025-03-10 15:23 ` Philippe Mathieu-Daudé
2025-03-10 15:16 ` Tomita Moeko
2025-03-08 23:09 ` [PATCH v2 13/21] hw/vfio/igd: Compile once Philippe Mathieu-Daudé
2025-03-10 7:39 ` Cédric Le Goater
2025-03-10 7:52 ` Cédric Le Goater
2025-03-08 23:09 ` [PATCH v2 14/21] system/iommufd: Introduce iommufd_builtin() helper Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 15/21] hw/vfio/pci: Check CONFIG_IOMMUFD at runtime using iommufd_builtin() Philippe Mathieu-Daudé
2025-03-10 4:11 ` Duan, Zhenzhong
2025-03-10 13:37 ` Philippe Mathieu-Daudé
2025-03-11 1:54 ` Duan, Zhenzhong
2025-03-11 7:20 ` Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 16/21] hw/vfio/pci: Compile once Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 17/21] hw/vfio/ap: Check CONFIG_IOMMUFD at runtime using iommufd_builtin() Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 18/21] hw/vfio/ccw: " Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 19/21] hw/vfio/s390x: Compile AP and CCW once Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 20/21] hw/vfio/platform: Check CONFIG_IOMMUFD at runtime using iommufd_builtin Philippe Mathieu-Daudé
2025-03-08 23:09 ` [PATCH v2 21/21] hw/vfio/platform: Compile once Philippe Mathieu-Daudé
2025-03-10 8:03 ` [PATCH v2 00/21] hw/vfio: Build various objects once Cédric Le Goater
2025-03-10 13:38 ` Philippe Mathieu-Daudé
2025-03-11 8:08 ` Cédric Le Goater
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=415339c1-8f83-4059-949e-63ef0c28b4b9@redhat.com \
--to=clg@redhat.com \
--cc=akrowiak@linux.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=alex.williamson@redhat.com \
--cc=berrange@redhat.com \
--cc=borntraeger@linux.ibm.com \
--cc=danielhb413@gmail.com \
--cc=david@redhat.com \
--cc=eduardo@habkost.net \
--cc=eric.auger@redhat.com \
--cc=farman@linux.ibm.com \
--cc=harshpb@linux.ibm.com \
--cc=iii@linux.ibm.com \
--cc=imammedo@redhat.com \
--cc=jjherne@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=pasic@linux.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=pierrick.bouvier@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--cc=tomitamoeko@gmail.com \
--cc=yi.l.liu@intel.com \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).