From e25b58a4e8053fd08c7313d47626db9875c1e719 Mon Sep 17 00:00:00 2001 From: a-ramses Date: Fri, 13 Dec 2024 01:18:43 +0100 Subject: [PATCH] Add support for retrieving boot cpu and mpidr for M3+ Signed-off-by: a-ramses --- proxyclient/experiments/cpu_pstate_latencies.py | 3 ++- proxyclient/m1n1/proxy.py | 6 ++++++ src/proxy.c | 6 ++++++ src/proxy.h | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/proxyclient/experiments/cpu_pstate_latencies.py b/proxyclient/experiments/cpu_pstate_latencies.py index 490c09d9e..601550bc3 100755 --- a/proxyclient/experiments/cpu_pstate_latencies.py +++ b/proxyclient/experiments/cpu_pstate_latencies.py @@ -88,7 +88,8 @@ p.ic_ivau(code, len(util.data)) def bench_cpu(idx, loops=10000000): - if idx == 0: + boot_cpu_name = "cpu" + str(p.get_boot_cpu_idx()) + if (cpu + idx) == boot_cpu_name: elapsed = p.call(util.bench, loops) / tfreq else: elapsed = p.smp_call_sync(idx, util.bench, loops) / tfreq diff --git a/proxyclient/m1n1/proxy.py b/proxyclient/m1n1/proxy.py index 9a89fb61f..92447a8eb 100644 --- a/proxyclient/m1n1/proxy.py +++ b/proxyclient/m1n1/proxy.py @@ -495,6 +495,8 @@ class M1N1Proxy(Reloadable): P_REBOOT = 0x010 P_SLEEP = 0x011 P_EL3_CALL = 0x012 + P_GET_BOOT_CPU_IDX = 0x013 + P_GET_BOOT_CPU_MPIDR = 0x014 P_WRITE64 = 0x100 P_WRITE32 = 0x101 @@ -725,6 +727,10 @@ def get_bootargs_rev(self): ba_addr = self.request(self.P_GET_BOOTARGS) rev = self.read16(ba_addr) return (ba_addr, rev) + def get_boot_cpu_idx(self): + return self.request(self.P_GET_BOOT_CPU_IDX) + def get_boot_cpu_mpidr(self): + return self.request(self.P_GET_BOOT_CPU_MPIDR) def get_base(self): return self.request(self.P_GET_BASE) def set_baud(self, baudrate): diff --git a/src/proxy.c b/src/proxy.c index c59225ca2..6cdff7ad8 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -54,6 +54,12 @@ int proxy_process(ProxyRequest *request, ProxyReply *reply) case P_GET_BOOTARGS: reply->retval = boot_args_addr; break; + case P_GET_BOOT_CPU_IDX: + reply->retval = boot_cpu_idx; + break; + case P_GET_BOOT_CPU_MPIDR: + reply->retval = boot_cpu_mpidr; + break; case P_GET_BASE: reply->retval = (u64)_base; break; diff --git a/src/proxy.h b/src/proxy.h index 34c419eed..e1f0ef4ad 100644 --- a/src/proxy.h +++ b/src/proxy.h @@ -25,6 +25,8 @@ typedef enum { P_REBOOT, P_SLEEP, P_EL3_CALL, + P_GET_BOOT_CPU_IDX, + P_GET_BOOT_CPU_MPIDR, P_WRITE64 = 0x100, // Generic register functions P_WRITE32,