[PATCH v2 2/7] target-info: Add page_bits_{init,vary}

Richard Henderson posted 7 patches 1 month, 3 weeks ago
Maintainers: Pierrick Bouvier <pierrick.bouvier@linaro.org>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Peter Maydell <peter.maydell@linaro.org>
[PATCH v2 2/7] target-info: Add page_bits_{init,vary}
Posted by Richard Henderson 1 month, 3 weeks ago
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>
---
 include/qemu/target-info-impl.h   | 7 +++++++
 configs/targets/aarch64-softmmu.c | 3 +++
 configs/targets/arm-softmmu.c     | 3 +++
 target-info-stub.c                | 9 +++++++++
 4 files changed, 22 insertions(+)

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/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/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)
-- 
2.43.0
Re: [PATCH v2 2/7] target-info: Add page_bits_{init,vary}
Posted by Philippe Mathieu-Daudé 1 month, 3 weeks ago
On 17/2/26 10:51, Richard Henderson wrote:
> 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>
> ---
>   include/qemu/target-info-impl.h   | 7 +++++++
>   configs/targets/aarch64-softmmu.c | 3 +++
>   configs/targets/arm-softmmu.c     | 3 +++
>   target-info-stub.c                | 9 +++++++++
>   4 files changed, 22 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>