> -----Original Message-----
> From: Philippe Mathieu-Daudé <[email protected]>
> Sent: 25 February 2026 03:17
> To: [email protected]
> Cc: Paolo Bonzini <[email protected]>; Thomas Huth
> <[email protected]>; [email protected]; Pierrick Bouvier
> <[email protected]>; Shameer Kolothum Thodi
> <[email protected]>; [email protected]; Philippe Mathieu-
> Daudé <[email protected]>; Peter Maydell <[email protected]>; Eric
> Auger <[email protected]>
> Subject: [PATCH 1/3] hw/arm/smmuv3: Avoid including CONFIG_DEVICES in
> hw/ header
>
> External email: Use caution opening links or attachments
>
>
> By inlinining the 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.
Thanks.
However, smmuv3.c currently has a:
#ifndef CONFIG_ARM_SMMUV3_ACCEL
in smmu_validate_property().
which leads to the build failure below:
[30/195] Compiling C object libsystem_arm.a.p/hw_arm_smmuv3.c.o
FAILED: libsystem_arm.a.p/hw_arm_smmuv3.c.o
...
../hw/arm/smmuv3.c: In function ‘smmu_validate_property’:
../hw/arm/smmuv3.c:1939:9: error: attempt to use poisoned
"CONFIG_ARM_SMMUV3_ACCEL"
1939 | #ifndef CONFIG_ARM_SMMUV3_ACCEL
| ^
One way to fix this is to remove the CONFIG_ check from smmuv3.c
and rely on the stub implementation for smmuv3_accel_init () instead:
diff --git a/hw/arm/smmuv3-accel.h b/hw/arm/smmuv3-accel.h
index 7e48d1555d..a224017c6c 100644
--- a/hw/arm/smmuv3-accel.h
+++ b/hw/arm/smmuv3-accel.h
@@ -39,7 +39,7 @@ typedef struct SMMUv3AccelDevice {
SMMUv3AccelState *s_accel;
} SMMUv3AccelDevice;
-void smmuv3_accel_init(SMMUv3State *s);
+bool smmuv3_accel_init(SMMUv3State *s, Error **errp);
bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
Error **errp);
bool smmuv3_accel_install_ste_range(SMMUv3State *s, SMMUSIDRange *range,
diff --git a/hw/arm/smmuv3-accel-stubs.c b/hw/arm/smmuv3-accel-stubs.c
index b64f1e4d93..c08caa6fa4 100644
--- a/hw/arm/smmuv3-accel-stubs.c
+++ b/hw/arm/smmuv3-accel-stubs.c
@@ -8,8 +8,10 @@
#include "hw/arm/smmuv3.h"
#include "hw/arm/smmuv3-accel.h"
-void smmuv3_accel_init(SMMUv3State *s)
+bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
{
+ error_setg(errp, "accel=on support not compiled in");
+ return false;
}
bool smmuv3_accel_install_ste(SMMUv3State *s, SMMUDevice *sdev, int sid,
diff --git a/hw/arm/smmuv3-accel.c b/hw/arm/smmuv3-accel.c
index f5cd4df336..ed647c45b8 100644
--- a/hw/arm/smmuv3-accel.c
+++ b/hw/arm/smmuv3-accel.c
@@ -758,11 +758,12 @@ static void smmuv3_accel_as_init(SMMUv3State *s)
address_space_init(shared_as_sysmem, &root, "smmuv3-accel-as-sysmem");
}
-void smmuv3_accel_init(SMMUv3State *s)
+bool smmuv3_accel_init(SMMUv3State *s, Error **errp)
{
SMMUState *bs = ARM_SMMU(s);
s->s_accel = g_new0(SMMUv3AccelState, 1);
bs->iommu_ops = &smmuv3_accel_ops;
smmuv3_accel_as_init(s);
+ return true;
}
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
index c08d58c579..8c51554c39 100644
--- a/hw/arm/smmuv3.c
+++ b/hw/arm/smmuv3.c
@@ -1936,13 +1936,6 @@ static void smmu_reset_exit(Object *obj, ResetType type)
static bool smmu_validate_property(SMMUv3State *s, Error **errp)
{
-#ifndef CONFIG_ARM_SMMUV3_ACCEL
- if (s->accel) {
- error_setg(errp, "accel=on support not compiled in");
- return false;
- }
-#endif
-
if (!s->accel) {
if (!s->ril) {
error_setg(errp, "ril can only be disabled if accel=on");
@@ -1996,7 +1989,9 @@ static void smmu_realize(DeviceState *d, Error **errp)
}
if (s->accel) {
- smmuv3_accel_init(s);
+ if (!smmuv3_accel_init(s, errp)) {
+ return;
+ }
error_setg(&s->migration_blocker, "Migration not supported with SMMUv3
"
"accelerator mode enabled");
if (migrate_add_blocker(&s->migration_blocker, errp) < 0) {
Thanks,
Shameer