[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI en
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum |
Date: |
Wed, 12 Feb 2025 12:24:03 +0100 |
Introduce the EndianMode type and the DEFINE_PROP_ENDIAN() macros.
Endianness can be BIG, LITTLE or unspecified (default).
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
qapi/common.json | 16 ++++++++++++++++
include/hw/qdev-properties-system.h | 7 +++++++
hw/core/qdev-properties-system.c | 11 +++++++++++
3 files changed, 34 insertions(+)
diff --git a/qapi/common.json b/qapi/common.json
index 6ffc7a37890..217feaaf683 100644
--- a/qapi/common.json
+++ b/qapi/common.json
@@ -212,3 +212,19 @@
##
{ 'struct': 'HumanReadableText',
'data': { 'human-readable-text': 'str' } }
+
+##
+# @EndianMode:
+#
+# An enumeration of three options: little, big, and unspecified
+#
+# @little: Little endianness
+#
+# @big: Big endianness
+#
+# @unspecified: Endianness not specified
+#
+# Since: 10.0
+##
+{ 'enum': 'EndianMode',
+ 'data': [ 'little', 'big', 'unspecified' ] }
diff --git a/include/hw/qdev-properties-system.h
b/include/hw/qdev-properties-system.h
index 7ec37f6316c..ead4dfc2f02 100644
--- a/include/hw/qdev-properties-system.h
+++ b/include/hw/qdev-properties-system.h
@@ -30,6 +30,7 @@ extern const PropertyInfo qdev_prop_pcie_link_speed;
extern const PropertyInfo qdev_prop_pcie_link_width;
extern const PropertyInfo qdev_prop_cpus390entitlement;
extern const PropertyInfo qdev_prop_iothread_vq_mapping_list;
+extern const PropertyInfo qdev_prop_endian_mode;
#define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
@@ -97,4 +98,10 @@ extern const PropertyInfo qdev_prop_iothread_vq_mapping_list;
DEFINE_PROP(_name, _state, _field, qdev_prop_iothread_vq_mapping_list, \
IOThreadVirtQueueMappingList *)
+#define DEFINE_PROP_ENDIAN(_name, _state, _field, _default) \
+ DEFINE_PROP_UNSIGNED(_name, _state, _field, _default, \
+ qdev_prop_endian_mode, EndianMode)
+#define DEFINE_PROP_ENDIAN_NODEFAULT(_name, _state, _field) \
+ DEFINE_PROP_ENDIAN(_name, _state, _field, ENDIAN_MODE_UNSPECIFIED)
+
#endif
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index a96675beb0d..89f954f569e 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -1283,3 +1283,14 @@ const PropertyInfo qdev_prop_iothread_vq_mapping_list = {
.set = set_iothread_vq_mapping_list,
.release = release_iothread_vq_mapping_list,
};
+
+/* --- Endian modes */
+
+const PropertyInfo qdev_prop_endian_mode = {
+ .name = "EndianMode",
+ .description = "Endian mode, big/little/unspecified",
+ .enum_table = &EndianMode_lookup,
+ .get = qdev_propinfo_get_enum,
+ .set = qdev_propinfo_set_enum,
+ .set_default_value = qdev_propinfo_set_default_value_enum,
+};
--
2.47.1
- [PATCH v6 00/11] hw/microblaze: Allow running cross-endian vCPUs, Philippe Mathieu-Daudé, 2025/02/12
- [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum,
Philippe Mathieu-Daudé <=
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, Thomas Huth, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, BALATON Zoltan, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, Philippe Mathieu-Daudé, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, Philippe Mathieu-Daudé, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, BALATON Zoltan, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, Philippe Mathieu-Daudé, 2025/02/12
- Re: [PATCH v6 01/11] hw/qdev-properties-system: Introduce EndianMode QAPI enum, BALATON Zoltan, 2025/02/12