Commit afb94ae333 for qemu.org
commit afb94ae3337fb430d2f54c7150df856ccf1ce94f
Author: Richard Henderson <richard.henderson@linaro.org>
Date: Tue Feb 17 19:51:01 2026 +1000
target-info: Add page_bits_{init,vary}
Add two fields that will hold TARGET_PAGE_BITS,
TARGET_PAGE_BITS_VARY, TARGET_PAGE_BITS_LEGACY.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20260217095106.598486-3-richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff --git a/configs/targets/aarch64-softmmu.c b/configs/targets/aarch64-softmmu.c
index 4e1e2f64da..82ccb57575 100644
--- a/configs/targets/aarch64-softmmu.c
+++ b/configs/targets/aarch64-softmmu.c
@@ -10,6 +10,7 @@
#include "qemu/target-info-impl.h"
#include "hw/arm/machines-qom.h"
#include "target/arm/cpu-qom.h"
+#include "target/arm/cpu-param.h"
static const TargetInfo target_info_aarch64_system = {
.target_name = "aarch64",
@@ -18,6 +19,8 @@ static const TargetInfo target_info_aarch64_system = {
.cpu_type = TYPE_ARM_CPU,
.machine_typename = TYPE_TARGET_AARCH64_MACHINE,
.endianness = ENDIAN_MODE_LITTLE,
+ .page_bits_vary = true,
+ .page_bits_init = TARGET_PAGE_BITS_LEGACY,
};
const TargetInfo *target_info(void)
diff --git a/configs/targets/arm-softmmu.c b/configs/targets/arm-softmmu.c
index 9b3fdd2854..18940e51e5 100644
--- a/configs/targets/arm-softmmu.c
+++ b/configs/targets/arm-softmmu.c
@@ -10,6 +10,7 @@
#include "qemu/target-info-impl.h"
#include "hw/arm/machines-qom.h"
#include "target/arm/cpu-qom.h"
+#include "target/arm/cpu-param.h"
static const TargetInfo target_info_arm_system = {
.target_name = "arm",
@@ -18,6 +19,8 @@ static const TargetInfo target_info_arm_system = {
.cpu_type = TYPE_ARM_CPU,
.machine_typename = TYPE_TARGET_ARM_MACHINE,
.endianness = ENDIAN_MODE_LITTLE,
+ .page_bits_vary = true,
+ .page_bits_init = TARGET_PAGE_BITS_LEGACY,
};
const TargetInfo *target_info(void)
diff --git a/include/qemu/target-info-impl.h b/include/qemu/target-info-impl.h
index e446585bf5..c917d546ea 100644
--- a/include/qemu/target-info-impl.h
+++ b/include/qemu/target-info-impl.h
@@ -25,6 +25,13 @@ typedef struct TargetInfo {
const char *machine_typename;
/* related to TARGET_BIG_ENDIAN definition */
EndianMode endianness;
+ /*
+ * runtime equivalent of
+ * TARGET_PAGE_BITS_VARY ? TARGET_PAGE_BITS_LEGACY : TARGET_PAGE_BITS
+ */
+ unsigned page_bits_init;
+ /* runtime equivalent of TARGET_PAGE_BITS_VARY definition */
+ bool page_bits_vary;
} TargetInfo;
/**
diff --git a/target-info-stub.c b/target-info-stub.c
index 65220cc782..896f16e582 100644
--- a/target-info-stub.c
+++ b/target-info-stub.c
@@ -23,6 +23,15 @@ static const TargetInfo target_info_stub = {
.cpu_type = CPU_RESOLVING_TYPE,
.machine_typename = TYPE_MACHINE,
.endianness = TARGET_BIG_ENDIAN ? ENDIAN_MODE_BIG : ENDIAN_MODE_LITTLE,
+#ifdef TARGET_PAGE_BITS_VARY
+ .page_bits_vary = true,
+# ifdef TARGET_PAGE_BITS_LEGACY
+ .page_bits_init = TARGET_PAGE_BITS_LEGACY,
+# endif
+#else
+ .page_bits_vary = false,
+ .page_bits_init = TARGET_PAGE_BITS,
+#endif
};
const TargetInfo *target_info(void)