hw/arm/smmuv3: 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: Shameer Kolothum <skolothumtho@nvidia.com> Message-Id: <20260410200031.18572-3-philmd@linaro.org>
Philippe Mathieu-Daudé committed
Mar 10, 2026 at 12:06 UTC
12ce4d9630ae09edec706f6254417e3ec96e08e5
3 files changed
+55
-44
hw/arm/meson.build
+3
-2
@@ -84,8 +84,9 @@ arm_common_ss.add(when: 'CONFIG_ARMSSE', if_true: files('armsse.c'))
84
arm_common_ss.add(when: 'CONFIG_FSL_IMX7', if_true: files('fsl-imx7.c', 'mcimx7d-sabre.c'))
85
arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP', if_true: files('fsl-imx8mp.c'))
86
arm_common_ss.add(when: 'CONFIG_FSL_IMX8MP_EVK', if_true: files('imx8mp-evk.c'))
87
-arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
88
-arm_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
87
+arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
88
+arm_common_ss.add(when: 'CONFIG_ARM_SMMUV3_ACCEL', if_true: files('smmuv3-accel.c'))
89
+stub_ss.add(files('smmuv3-accel-stubs.c'))
90
arm_common_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
91
arm_common_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
92
arm_common_ss.add(when: 'CONFIG_XEN', if_true: files(
hw/arm/smmuv3-accel-stubs.c
new
+52
@@ -0,0 +1,52 @@
1
+/*
2
+ * Stubs for accelerated SMMU instance backed by an iommufd vIOMMU object.
3
+ *
4
+ * SPDX-License-Identifier: GPL-2.0-or-later
5
+ */
6
+
7
+#include "qemu/osdep.h"
8
+#include "qapi/error.h"
9
+#include "hw/arm/smmuv3.h"
10
+#include "hw/arm/smmuv3-accel.h"
11
+
12
+bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
13
+{
14
+ error_setg(errp, "accel=on support not compiled in");
15
+ return false;
16
+}
17
+
18
+bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
19
+ Error **errp)
20
+{
21
+ return true;
22
+}
23
+
24
+bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
25
+ Error **errp)
26
+{
27
+ return true;
28
+}
29
+
30
+bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
31
+{
32
+ return true;
33
+}
34
+
35
+bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
36
+ Error **errp)
37
+{
38
+ return true;
39
+}
40
+
41
+void smmuv3_accel_idr_override(SMMUv3State *s)
42
+{
43
+}
44
+
45
+bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
46
+{
47
+ return true;
48
+}
49
+
50
+void smmuv3_accel_reset(SMMUv3State *s)
51
+{
52
+}
hw/arm/smmuv3-accel.h
-42
@@ -14,7 +14,6 @@
14
#ifdef CONFIG_LINUX
15
#include <linux/iommufd.h>
16
#endif
17
-#include CONFIG_DEVICES
17
18
/*
19
* Represents an accelerated SMMU instance backed by an iommufd vIOMMU object.
@@ -41,7 +40,6 @@ typedef struct SMMUv3AccelDevice {
40
SMMUv3AccelState *s_accel;
41
} SMMUv3AccelDevice;
42
44
-#ifdef CONFIG_ARM_SMMUV3_ACCEL
43
bool smmuv3_accel_init(SMMUv3State *s, Error **errp);
44
bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
45
Error **errp);
@@ -53,45 +51,5 @@ bool smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
51
void smmuv3_accel_idr_override(SMMUv3State *s);
52
bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp);
53
void smmuv3_accel_reset(SMMUv3State *s);
56
-#else
57
-#include "qapi/error.h"
58
-static inline bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
59
-{
60
- error_setg(errp, "accel=on support not compiled in");
61
- return false;
62
-}
63
-static inline bool
64
-smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
65
- Error **errp)
66
-{
67
- return true;
68
-}
69
-static inline bool
70
-smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
71
- Error **errp)
72
-{
73
- return true;
74
-}
75
-static inline bool smmuv3_accel_attach_gbpa_hwpt(SMMUv3State *s, Error **errp)
76
-{
77
- return true;
78
-}
79
-static inline bool
80
-smmuv3_accel_issue_inv_cmd(SMMUv3State *s, void *cmd, SMMUDevice *sdev,
81
- Error **errp)
82
-{
83
- return true;
84
-}
85
-static inline void smmuv3_accel_idr_override(SMMUv3State *s)
86
-{
87
-}
88
-static inline bool smmuv3_accel_alloc_veventq(SMMUv3State *s, Error **errp)
89
-{
90
- return true;
91
-}
92
-static inline void smmuv3_accel_reset(SMMUv3State *s)
93
-{
94
-}
95
-#endif
54
55
#endif /* HW_ARM_SMMUV3_ACCEL_H */