hw/pci-host/i440fx.c | 9 ++++++++- hw/vfio/pci-quirks.c | 6 ++++++ hw/pci-host/Kconfig | 5 +++++ hw/pci-host/Makefile.objs | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-)
Introduce a kconfig selector to allow builds without Intel
Integrated Graphics Device GPU PCIe passthrough.
We keep the default as enabled.
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
RFC because to be able to use the Kconfig-generated
"config-devices.h" header we have to move this device
out of $common-obj and build i440fx.o on a per-target
basis, which is not optimal...
---
hw/pci-host/i440fx.c | 9 ++++++++-
hw/vfio/pci-quirks.c | 6 ++++++
hw/pci-host/Kconfig | 5 +++++
hw/pci-host/Makefile.objs | 2 +-
4 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index f27131102d..41e93581f4 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -34,6 +34,7 @@
#include "hw/pci-host/pam.h"
#include "qapi/visitor.h"
#include "qemu/error-report.h"
+#include "config-devices.h"
/*
* I440FX chipset data sheet.
@@ -386,6 +387,8 @@ static const TypeInfo i440fx_info = {
},
};
+#ifdef CONFIG_INTEL_IGD_PASSTHROUGH
+
/* IGD Passthrough Host Bridge. */
typedef struct {
uint8_t offset;
@@ -470,6 +473,8 @@ static const TypeInfo igd_passthrough_i440fx_info = {
.class_init = igd_passthrough_i440fx_class_init,
};
+#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */
+
static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge,
PCIBus *rootbus)
{
@@ -514,8 +519,10 @@ static const TypeInfo i440fx_pcihost_info = {
static void i440fx_register_types(void)
{
type_register_static(&i440fx_info);
- type_register_static(&igd_passthrough_i440fx_info);
type_register_static(&i440fx_pcihost_info);
+#ifdef CONFIG_INTEL_IGD_PASSTHROUGH
+ type_register_static(&igd_passthrough_i440fx_info);
+#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */
}
type_init(i440fx_register_types)
diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
index 136f3a9ad6..858148fa39 100644
--- a/hw/vfio/pci-quirks.c
+++ b/hw/vfio/pci-quirks.c
@@ -1166,6 +1166,8 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr)
trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name);
}
+#ifdef CONFIG_INTEL_IGD_PASSTHROUGH
+
/*
* Intel IGD support
*
@@ -1811,6 +1813,8 @@ out:
g_free(lpc);
}
+#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */
+
/*
* Common quirk probe entry points.
*/
@@ -1860,7 +1864,9 @@ 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_INTEL_IGD_PASSTHROUGH
vfio_probe_igd_bar4_quirk(vdev, nr);
+#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */
}
void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr)
diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig
index b0aa8351c4..0b7539765a 100644
--- a/hw/pci-host/Kconfig
+++ b/hw/pci-host/Kconfig
@@ -1,6 +1,10 @@
config PAM
bool
+config INTEL_IGD_PASSTHROUGH
+ default y
+ bool
+
config PREP_PCI
bool
select PCI
@@ -32,6 +36,7 @@ config PCI_I440FX
bool
select PCI
select PAM
+ imply INTEL_IGD_PASSTHROUGH
config PCI_EXPRESS_Q35
bool
diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs
index efd752b766..3c925192dd 100644
--- a/hw/pci-host/Makefile.objs
+++ b/hw/pci-host/Makefile.objs
@@ -13,7 +13,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o
common-obj-$(CONFIG_PCI_SABRE) += sabre.o
common-obj-$(CONFIG_FULONG) += bonito.o
-common-obj-$(CONFIG_PCI_I440FX) += i440fx.o
+obj-$(CONFIG_PCI_I440FX) += i440fx.o
common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o
common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o
common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o
--
2.21.0
On Fri, 22 Nov 2019 18:22:01 +0100 Philippe Mathieu-Daudé <philmd@redhat.com> wrote: > Introduce a kconfig selector to allow builds without Intel > Integrated Graphics Device GPU PCIe passthrough. > We keep the default as enabled. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > RFC because to be able to use the Kconfig-generated > "config-devices.h" header we have to move this device > out of $common-obj and build i440fx.o on a per-target > basis, which is not optimal... > --- > hw/pci-host/i440fx.c | 9 ++++++++- > hw/vfio/pci-quirks.c | 6 ++++++ > hw/pci-host/Kconfig | 5 +++++ > hw/pci-host/Makefile.objs | 2 +- > 4 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c > index f27131102d..41e93581f4 100644 > --- a/hw/pci-host/i440fx.c > +++ b/hw/pci-host/i440fx.c > @@ -34,6 +34,7 @@ > #include "hw/pci-host/pam.h" > #include "qapi/visitor.h" > #include "qemu/error-report.h" > +#include "config-devices.h" > > /* > * I440FX chipset data sheet. > @@ -386,6 +387,8 @@ static const TypeInfo i440fx_info = { > }, > }; > > +#ifdef CONFIG_INTEL_IGD_PASSTHROUGH > + > /* IGD Passthrough Host Bridge. */ > typedef struct { > uint8_t offset; > @@ -470,6 +473,8 @@ static const TypeInfo igd_passthrough_i440fx_info = { > .class_init = igd_passthrough_i440fx_class_init, > }; > > +#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */ > + > static const char *i440fx_pcihost_root_bus_path(PCIHostState *host_bridge, > PCIBus *rootbus) > { > @@ -514,8 +519,10 @@ static const TypeInfo i440fx_pcihost_info = { > static void i440fx_register_types(void) > { > type_register_static(&i440fx_info); > - type_register_static(&igd_passthrough_i440fx_info); > type_register_static(&i440fx_pcihost_info); > +#ifdef CONFIG_INTEL_IGD_PASSTHROUGH > + type_register_static(&igd_passthrough_i440fx_info); > +#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */ > } > Note that this IGD thing has nothing to do with the one below in vfio code. AIUI, the one above is specific to Xen and very unfortunately named and placed to seem more generic than it is. vfio IGD *assignment* (not passthrough) has no dependency on this, so please don't link them together. Thanks, Alex > type_init(i440fx_register_types) > diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c > index 136f3a9ad6..858148fa39 100644 > --- a/hw/vfio/pci-quirks.c > +++ b/hw/vfio/pci-quirks.c > @@ -1166,6 +1166,8 @@ static void vfio_probe_rtl8168_bar2_quirk(VFIOPCIDevice *vdev, int nr) > trace_vfio_quirk_rtl8168_probe(vdev->vbasedev.name); > } > > +#ifdef CONFIG_INTEL_IGD_PASSTHROUGH > + > /* > * Intel IGD support > * > @@ -1811,6 +1813,8 @@ out: > g_free(lpc); > } > > +#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */ > + > /* > * Common quirk probe entry points. > */ > @@ -1860,7 +1864,9 @@ 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_INTEL_IGD_PASSTHROUGH > vfio_probe_igd_bar4_quirk(vdev, nr); > +#endif /* CONFIG_INTEL_IGD_PASSTHROUGH */ > } > > void vfio_bar_quirk_exit(VFIOPCIDevice *vdev, int nr) > diff --git a/hw/pci-host/Kconfig b/hw/pci-host/Kconfig > index b0aa8351c4..0b7539765a 100644 > --- a/hw/pci-host/Kconfig > +++ b/hw/pci-host/Kconfig > @@ -1,6 +1,10 @@ > config PAM > bool > > +config INTEL_IGD_PASSTHROUGH > + default y > + bool > + > config PREP_PCI > bool > select PCI > @@ -32,6 +36,7 @@ config PCI_I440FX > bool > select PCI > select PAM > + imply INTEL_IGD_PASSTHROUGH > > config PCI_EXPRESS_Q35 > bool > diff --git a/hw/pci-host/Makefile.objs b/hw/pci-host/Makefile.objs > index efd752b766..3c925192dd 100644 > --- a/hw/pci-host/Makefile.objs > +++ b/hw/pci-host/Makefile.objs > @@ -13,7 +13,7 @@ common-obj-$(CONFIG_VERSATILE_PCI) += versatile.o > > common-obj-$(CONFIG_PCI_SABRE) += sabre.o > common-obj-$(CONFIG_FULONG) += bonito.o > -common-obj-$(CONFIG_PCI_I440FX) += i440fx.o > +obj-$(CONFIG_PCI_I440FX) += i440fx.o > common-obj-$(CONFIG_PCI_EXPRESS_Q35) += q35.o > common-obj-$(CONFIG_PCI_EXPRESS_GENERIC_BRIDGE) += gpex.o > common-obj-$(CONFIG_PCI_EXPRESS_XILINX) += xilinx-pcie.o
On 22/11/19 18:34, Alex Williamson wrote: > +config INTEL_IGD_PASSTHROUGH > + default y If it's "default y", it need not be "implied". It probably shouldn't be "default y", since it's I440FX-specific. Paolo > + bool > + > config PREP_PCI > bool > select PCI > @@ -32,6 +36,7 @@ config PCI_I440FX > bool > select PCI > select PAM > + imply INTEL_IGD_PASSTHROUGH >
On 22/11/2019 18.22, Philippe Mathieu-Daudé wrote: > Introduce a kconfig selector to allow builds without Intel > Integrated Graphics Device GPU PCIe passthrough. > We keep the default as enabled. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> > --- > RFC because to be able to use the Kconfig-generated > "config-devices.h" header we have to move this device > out of $common-obj and build i440fx.o on a per-target > basis, which is not optimal... IMHO you should move the code out of i440fx.o and into a separate file if possible. That's hopefully cleaner than #ifdeffing here, and you hopefully only need to move the new code into "obj-" and can keep i440fx.o in common-obj. Thomas
On 11/22/19 7:03 PM, Thomas Huth wrote: > On 22/11/2019 18.22, Philippe Mathieu-Daudé wrote: >> Introduce a kconfig selector to allow builds without Intel >> Integrated Graphics Device GPU PCIe passthrough. >> We keep the default as enabled. >> >> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> >> --- >> RFC because to be able to use the Kconfig-generated >> "config-devices.h" header we have to move this device >> out of $common-obj and build i440fx.o on a per-target >> basis, which is not optimal... > > IMHO you should move the code out of i440fx.o and into a separate file > if possible. That's hopefully cleaner than #ifdeffing here, and you > hopefully only need to move the new code into "obj-" and can keep > i440fx.o in common-obj. Correct. I wanted to try a surgical patch first ;)
Patchew URL: https://patchew.org/QEMU/20191122172201.11456-1-philmd@redhat.com/ Hi, This series failed the docker-quick@centos7 build test. Please find the testing commands and their output below. If you have Docker installed, you can probably reproduce it locally. === TEST SCRIPT BEGIN === #!/bin/bash make docker-image-centos7 V=1 NETWORK=1 time make docker-test-quick@centos7 SHOW_ENV=1 J=14 NETWORK=1 === TEST SCRIPT END === LINK aarch64-softmmu/qemu-system-aarch64 hw/vfio/pci.o: In function `vfio_realize': /tmp/qemu-test/src/hw/vfio/pci.c:2949: undefined reference to `vfio_pci_igd_opregion_init' collect2: error: ld returned 1 exit status make[1]: *** [qemu-system-x86_64] Error 1 make: *** [x86_64-softmmu/all] Error 2 make: *** Waiting for unfinished jobs.... hw/vfio/pci.o: In function `vfio_realize': /tmp/qemu-test/src/hw/vfio/pci.c:2949: undefined reference to `vfio_pci_igd_opregion_init' collect2: error: ld returned 1 exit status make[1]: *** [qemu-system-aarch64] Error 1 make: *** [aarch64-softmmu/all] Error 2 Traceback (most recent call last): File "./tests/docker/docker.py", line 662, in <module> sys.exit(main()) --- raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['sudo', '-n', 'docker', 'run', '--label', 'com.qemu.instance.uuid=57b8f6e005964f0cb505a02139414e88', '-u', '1003', '--security-opt', 'seccomp=unconfined', '--rm', '-e', 'TARGET_LIST=', '-e', 'EXTRA_CONFIGURE_OPTS=', '-e', 'V=', '-e', 'J=14', '-e', 'DEBUG=', '-e', 'SHOW_ENV=1', '-e', 'CCACHE_DIR=/var/tmp/ccache', '-v', '/home/patchew2/.cache/qemu-docker-ccache:/var/tmp/ccache:z', '-v', '/var/tmp/patchew-tester-tmp-o78ntsrk/src/docker-src.2019-11-22-15.23.40.28372:/var/tmp/qemu:z,ro', 'qemu:centos7', '/var/tmp/qemu/run', 'test-quick']' returned non-zero exit status 2. filter=--filter=label=com.qemu.instance.uuid=57b8f6e005964f0cb505a02139414e88 make[1]: *** [docker-run] Error 1 make[1]: Leaving directory `/var/tmp/patchew-tester-tmp-o78ntsrk/src' make: *** [docker-run-test-quick@centos7] Error 2 real 2m36.282s user 0m7.884s The full log is available at http://patchew.org/logs/20191122172201.11456-1-philmd@redhat.com/testing.docker-quick@centos7/?type=message. --- Email generated automatically by Patchew [https://patchew.org/]. Please send your feedback to patchew-devel@redhat.com
© 2016 - 2025 Red Hat, Inc.