@samitouri / QOSamiQemu / commits / 566ca14890

hw/s390x/s390-pci-vfio: Avoid including CONFIG_DEVICES in hw/ header

By turning the inline functions into stubs we can avoid the use of target-specific CONFIG_DEVICES include in a hw/ header, allowing to build the source files including it as common objects. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Farhan Ali<alifm@linux.ibm.com> Message-Id: <20260225031658.32095-4-philmd@linaro.org>

Philippe Mathieu-Daudé committed Feb 25, 2026 at 04:05 UTC 566ca148901bcd020e01e281eaad62e87ab68cca
3 files changed +33 -20
hw/s390x/meson.build
+1
@@ -34,6 +34,7 @@ s390x_ss.add(when: 'CONFIG_S390_CCW_VIRTIO', if_true: files(
34 ))
35 s390x_ss.add(when: 'CONFIG_TERMINAL3270', if_true: files('3270-ccw.c'))
36 s390x_ss.add(when: 'CONFIG_VFIO', if_true: files('s390-pci-vfio.c'))
37 +stub_ss.add(files('s390-pci-vfio-stubs.c'))
38 s390x_ss.add(when: 'CONFIG_VFIO_AP', if_false: files('ap-stub.c'))
39
40 virtio_ss = ss.source_set()
hw/s390x/s390-pci-vfio-stubs.c new
+32
@@ -0,0 +1,32 @@
1 +/*
2 + * s390 vfio-pci stubs
3 + *
4 + * SPDX-License-Identifier: GPL-2.0-or-later
5 + */
6 +
7 +#include "qemu/osdep.h"
8 +#include "hw/s390x/s390-pci-vfio.h"
9 +
10 +bool s390_pci_update_dma_avail(int fd, unsigned int *avail)
11 +{
12 + return false;
13 +}
14 +
15 +S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
16 + S390PCIBusDevice *pbdev)
17 +{
18 + return NULL;
19 +}
20 +
21 +void s390_pci_end_dma_count(S390pciState *s, S390PCIDMACount *cnt)
22 +{
23 +}
24 +
25 +bool s390_pci_get_host_fh(S390PCIBusDevice *pbdev, uint32_t *fh)
26 +{
27 + return false;
28 +}
29 +
30 +void s390_pci_get_clp_info(S390PCIBusDevice *pbdev)
31 +{
32 +}
include/hw/s390x/s390-pci-vfio.h
-20
@@ -13,32 +13,12 @@
13 #define HW_S390_PCI_VFIO_H
14
15 #include "hw/s390x/s390-pci-bus.h"
16 -#include CONFIG_DEVICES
16
18 -#ifdef CONFIG_VFIO
17 bool s390_pci_update_dma_avail(int fd, unsigned int *avail);
18 S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
19 S390PCIBusDevice *pbdev);
20 void s390_pci_end_dma_count(S390pciState *s, S390PCIDMACount *cnt);
21 bool s390_pci_get_host_fh(S390PCIBusDevice *pbdev, uint32_t *fh);
22 void s390_pci_get_clp_info(S390PCIBusDevice *pbdev);
25 -#else
26 -static inline bool s390_pci_update_dma_avail(int fd, unsigned int *avail)
27 -{
28 - return false;
29 -}
30 -static inline S390PCIDMACount *s390_pci_start_dma_count(S390pciState *s,
31 - S390PCIBusDevice *pbdev)
32 -{
33 - return NULL;
34 -}
35 -static inline void s390_pci_end_dma_count(S390pciState *s,
36 - S390PCIDMACount *cnt) { }
37 -static inline bool s390_pci_get_host_fh(S390PCIBusDevice *pbdev, uint32_t *fh)
38 -{
39 - return false;
40 -}
41 -static inline void s390_pci_get_clp_info(S390PCIBusDevice *pbdev) { }
42 -#endif
23
24 #endif