[RFC PATCH v3 04/14] hw/arm: Register TYPE_TARGET_ARM/AARCH64_MACHINE QOM interfaces

Philippe Mathieu-Daudé posted 14 patches 9 months, 3 weeks ago
There is a newer version of this series
[RFC PATCH v3 04/14] hw/arm: Register TYPE_TARGET_ARM/AARCH64_MACHINE QOM interfaces
Posted by Philippe Mathieu-Daudé 9 months, 3 weeks ago
Define the TYPE_TARGET_ARM_MACHINE and TYPE_TARGET_AARCH64_MACHINE
QOM interface names to allow machines to implement them.

Register these interfaces in common code in target_info-qom.c used
by all binaries because QOM interfaces must be registered before
being checked (see next commit with the 'none' machine).

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/hw/arm/machines-qom.h | 18 ++++++++++++++++++
 target_info-qom.c             |  9 +++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 include/hw/arm/machines-qom.h

diff --git a/include/hw/arm/machines-qom.h b/include/hw/arm/machines-qom.h
new file mode 100644
index 00000000000..a17225f5f92
--- /dev/null
+++ b/include/hw/arm/machines-qom.h
@@ -0,0 +1,18 @@
+/*
+ * QOM type definitions for ARM / Aarch64 machines
+ *
+ *  Copyright (c) Linaro
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_ARM_MACHINES_QOM_H
+#define HW_ARM_MACHINES_QOM_H
+
+#define TYPE_TARGET_ARM_MACHINE \
+        "target-info-arm-machine"
+
+#define TYPE_TARGET_AARCH64_MACHINE \
+        "target-info-aarch64-machine"
+
+#endif
diff --git a/target_info-qom.c b/target_info-qom.c
index a6fd8f1d5a3..7fd58d24818 100644
--- a/target_info-qom.c
+++ b/target_info-qom.c
@@ -8,8 +8,17 @@
 
 #include "qemu/osdep.h"
 #include "qom/object.h"
+#include "hw/arm/machines-qom.h"
 
 static const TypeInfo target_info_types[] = {
+    {
+        .name           = TYPE_TARGET_ARM_MACHINE,
+        .parent         = TYPE_INTERFACE,
+    },
+    {
+        .name           = TYPE_TARGET_AARCH64_MACHINE,
+        .parent         = TYPE_INTERFACE,
+    },
 };
 
 DEFINE_TYPES(target_info_types)
-- 
2.47.1


Re: [RFC PATCH v3 04/14] hw/arm: Register TYPE_TARGET_ARM/AARCH64_MACHINE QOM interfaces
Posted by Pierrick Bouvier 9 months, 3 weeks ago
On 4/18/25 10:28, Philippe Mathieu-Daudé wrote:
> Define the TYPE_TARGET_ARM_MACHINE and TYPE_TARGET_AARCH64_MACHINE
> QOM interface names to allow machines to implement them.
> 
> Register these interfaces in common code in target_info-qom.c used
> by all binaries because QOM interfaces must be registered before
> being checked (see next commit with the 'none' machine).
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/hw/arm/machines-qom.h | 18 ++++++++++++++++++
>   target_info-qom.c             |  9 +++++++++
>   2 files changed, 27 insertions(+)
>   create mode 100644 include/hw/arm/machines-qom.h
> 
> diff --git a/include/hw/arm/machines-qom.h b/include/hw/arm/machines-qom.h
> new file mode 100644
> index 00000000000..a17225f5f92
> --- /dev/null
> +++ b/include/hw/arm/machines-qom.h
> @@ -0,0 +1,18 @@
> +/*
> + * QOM type definitions for ARM / Aarch64 machines
> + *
> + *  Copyright (c) Linaro
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +
> +#ifndef HW_ARM_MACHINES_QOM_H
> +#define HW_ARM_MACHINES_QOM_H
> +
> +#define TYPE_TARGET_ARM_MACHINE \
> +        "target-info-arm-machine"
> +
> +#define TYPE_TARGET_AARCH64_MACHINE \
> +        "target-info-aarch64-machine"
> +
> +#endif
> diff --git a/target_info-qom.c b/target_info-qom.c
> index a6fd8f1d5a3..7fd58d24818 100644
> --- a/target_info-qom.c
> +++ b/target_info-qom.c
> @@ -8,8 +8,17 @@
>   
>   #include "qemu/osdep.h"
>   #include "qom/object.h"
> +#include "hw/arm/machines-qom.h"
>   
>   static const TypeInfo target_info_types[] = {
> +    {
> +        .name           = TYPE_TARGET_ARM_MACHINE,
> +        .parent         = TYPE_INTERFACE,
> +    },
> +    {
> +        .name           = TYPE_TARGET_AARCH64_MACHINE,
> +        .parent         = TYPE_INTERFACE,
> +    },
>   };
>   
>   DEFINE_TYPES(target_info_types)

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>