qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anton Johansson via <qemu-devel@nongnu.org>
To: qemu-devel@nongnu.org
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Richard Henderson" <richard.henderson@linaro.org>
Subject: [PATCH v2 1/7] target/alpha: Introduce alpha_phys_addr_space_bits()
Date: Mon, 15 Dec 2025 20:42:50 +0100	[thread overview]
Message-ID: <20251215-phys_addr-v2-1-633aa1d922cd@rev.ng> (raw)
In-Reply-To: <20251215-phys_addr-v2-0-633aa1d922cd@rev.ng>

In preparation for dropping TARGET_PHYS_ADDR_SPACE_BITS, add a
a runtime function to correctly represent the size of the physical
address space for EV4-6 based on the current CPU version.

Signed-off-by: Anton Johansson <anjo@rev.ng>
---
 linux-user/alpha/target_proc.h | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/linux-user/alpha/target_proc.h b/linux-user/alpha/target_proc.h
index da437ee0e5..6b491ffa3a 100644
--- a/linux-user/alpha/target_proc.h
+++ b/linux-user/alpha/target_proc.h
@@ -6,6 +6,27 @@
 #ifndef ALPHA_TARGET_PROC_H
 #define ALPHA_TARGET_PROC_H
 
+#include "qemu/osdep.h"
+#include "target/alpha/cpu.h"
+
+static uint8_t alpha_phys_addr_space_bits(CPUAlphaState *env)
+{
+    switch (env->implver) {
+    case IMPLVER_2106x:
+        /* EV4 */
+        return 34;
+    case IMPLVER_21164:
+        /* EV5 */
+        return 40;
+    case IMPLVER_21264:
+    case IMPLVER_21364:
+        /* EV6 and EV7*/
+        return 44;
+    default:
+        g_assert_not_reached();
+    }
+}
+
 static int open_cpuinfo(CPUArchState *cpu_env, int fd)
 {
     int max_cpus = sysconf(_SC_NPROCESSORS_CONF);
@@ -57,7 +78,7 @@ static int open_cpuinfo(CPUArchState *cpu_env, int fd)
             "L1 Dcache\t\t: n/a\n"
             "L2 cache\t\t: n/a\n"
             "L3 cache\t\t: n/a\n",
-            model, TARGET_PAGE_SIZE, TARGET_PHYS_ADDR_SPACE_BITS,
+            model, TARGET_PAGE_SIZE, alpha_phys_addr_space_bits(cpu_env),
             max_cpus, num_cpus, cpu_mask);
 
     return 0;

-- 
2.51.0



  reply	other threads:[~2025-12-15 19:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 19:42 [PATCH v2 0/7] single-binary: Drop TARGET_PHYS_ADDR_SPACE_BITS Anton Johansson via
2025-12-15 19:42 ` Anton Johansson via [this message]
2025-12-15 19:42 ` [PATCH v2 2/7] target/hppa: Define PA[20|1X] physical address space size Anton Johansson via
2025-12-15 19:42 ` [PATCH v2 3/7] target/i386: Drop physical address range checks Anton Johansson via
2025-12-15 19:42 ` [PATCH v2 4/7] target/loongarch: Introduce loongarch_palen_mask() Anton Johansson via
2025-12-15 19:42 ` [PATCH v2 5/7] hw/loongarch: Use loongarch_palen_mask() Anton Johansson via
2025-12-15 19:42 ` [PATCH v2 6/7] hw/riscv: Fix IOMMU PAS capability to 56 bits Anton Johansson via
2025-12-15 19:42 ` [PATCH v2 7/7] Drop TARGET_PHYS_ADDR_SPACE_BITS Anton Johansson via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251215-phys_addr-v2-1-633aa1d922cd@rev.ng \
    --to=qemu-devel@nongnu.org \
    --cc=anjo@rev.ng \
    --cc=philmd@linaro.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).