Commit 8930d9cca2 for qemu.org
commit 8930d9cca2f830565da6483128414f9a38e4d8d8
Author: Yonggang Luo <luoyonggang@gmail.com>
Date: Tue Oct 27 14:15:03 2026 +0800
qemu/arch-defs: increase width of QEMU_ARCH_* masks enums to be 64 bits
SYS_EMU_TARGET__MAX is already 29, nearing the 32-target limit.
So increase width of QEMU_ARCH_* masks enums and related types;
So that we can add needed Linux user-mode targets to EmuTarget;
And also enabled the possibility add more system-mode targets in future.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Message-ID: <20261027061504.2213-4-luoyonggang@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/include/qemu/base-arch-defs.h b/include/qemu/base-arch-defs.h
index a6478c2d3f..f2e3bc5420 100644
--- a/include/qemu/base-arch-defs.h
+++ b/include/qemu/base-arch-defs.h
@@ -9,7 +9,7 @@
#include "qapi/qapi-types-machine.h"
-#define QEMU_ARCH_BIT(target) (1UL << (target))
+#define QEMU_ARCH_BIT(target) (1ULL << (target))
enum {
QEMU_ARCH_ALPHA = QEMU_ARCH_BIT(SYS_EMU_TARGET_ALPHA),
@@ -44,7 +44,8 @@ enum {
QEMU_ARCH_ALL = QEMU_ARCH_BIT(SYS_EMU_TARGET__MAX) - 1,
};
-QEMU_BUILD_BUG_ON(SYS_EMU_TARGET__MAX > 32);
+/* Keep target-specific masks within qemu_opt_set_number()'s int64_t range. */
+QEMU_BUILD_BUG_ON(SYS_EMU_TARGET__MAX > 63);
/**
* qemu_arch_available:
@@ -52,6 +53,6 @@ QEMU_BUILD_BUG_ON(SYS_EMU_TARGET__MAX > 32);
*
* Return whether the current target architecture is contained in @arch_bitmask
*/
-bool qemu_arch_available(uint32_t arch_bitmask);
+bool qemu_arch_available(uint64_t arch_bitmask);
#endif
diff --git a/monitor/monitor-hmp-internal.h b/monitor/monitor-hmp-internal.h
index 4e2430551a..b61d271707 100644
--- a/monitor/monitor-hmp-internal.h
+++ b/monitor/monitor-hmp-internal.h
@@ -69,7 +69,7 @@ typedef struct HMPCommand {
* Allow to restrict the command for a particular set of
* target architectures.
*/
- uint32_t arch_bitmask;
+ uint64_t arch_bitmask;
bool coroutine;
} HMPCommand;
diff --git a/system/arch_init.c b/system/arch_init.c
index 1ad2f3d6f7..b8362b12a6 100644
--- a/system/arch_init.c
+++ b/system/arch_init.c
@@ -26,7 +26,7 @@
#include "qemu/bitops.h"
#include "qemu/target-info-qapi.h"
-bool qemu_arch_available(uint32_t arch_bitmask)
+bool qemu_arch_available(uint64_t arch_bitmask)
{
- return extract32(arch_bitmask, target_arch(), 1);
+ return extract64(arch_bitmask, target_arch(), 1);
}
diff --git a/system/qdev-monitor.c b/system/qdev-monitor.c
index 8185822daa..b3ca619f3c 100644
--- a/system/qdev-monitor.c
+++ b/system/qdev-monitor.c
@@ -54,7 +54,7 @@ typedef struct QDevAlias
{
const char *typename;
const char *alias;
- uint32_t arch_mask;
+ uint64_t arch_mask;
} QDevAlias;
/* default virtio transport per architecture */
diff --git a/system/vl.c b/system/vl.c
index 468a9fc247..fbe580746d 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -928,7 +928,7 @@ typedef struct QEMUOption {
const char *name;
int flags;
int index;
- uint32_t arch_mask;
+ uint64_t arch_mask;
} QEMUOption;
static const QEMUOption qemu_options[] = {