On 6/9/26 15:09, Helge Deller wrote:
From: Helge Deller <[email protected]>
I've tried to mimic what I've seen on two debian porterboxes (ppc64 and
ppc64le), which are running via KVM/QEMU. I assume the model type of
pSeries and such doesn't make much sense for some older ppc chips, so
any better suggestions here are welcome.
Signed-off-by: Helge Deller <[email protected]>
Cc: [email protected]
---
linux-user/ppc/target_proc.h | 38 +++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/linux-user/ppc/target_proc.h b/linux-user/ppc/target_proc.h
index 43fe29ca72..fa965c0e69 100644
--- a/linux-user/ppc/target_proc.h
+++ b/linux-user/ppc/target_proc.h
@@ -1 +1,37 @@
-/* No target-specific /proc support */
+/*
+ * ppc specific proc functions for linux-user
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef PPC_TARGET_PROC_H
+#define PPC_TARGET_PROC_H
+
+static int open_cpuinfo(CPUArchState *cpu_env, int fd)
+{
+ int i, num_cpus;
+
+ PowerPCCPUClass *pcc = POWERPC_CPU_GET_CLASS(env_cpu(cpu_env));
+ DeviceClass *dc = DEVICE_CLASS(ppc_cpu_get_family_class(pcc));
+
+ num_cpus = sysconf(_SC_NPROCESSORS_ONLN);
+ for (i = 0; i < num_cpus; i++) {
+ dprintf(fd, "processor:\t: %d\n", i);
+ dprintf(fd, "cpu:\t\t: %s%s\n",
There are extra ':' here. Should be
processor :
cpu :
not
processor: :
cpu: :
+ dc->desc,
+ pcc->insns_flags & PPC_ALTIVEC ? ", altivec supported":"");
+ dprintf(fd, "clock\t\t: 3425.000000MHz\n");
Why hardcoded? Is the clock not accessible to user-only?
+ dprintf(fd, "revision\t: %d.%d (pvr %04x %04x)\n\n",
+ (pcc->pvr >> 8) & 0x0f, pcc->pvr & 0x0f,
+ pcc->pvr >> 16, pcc->pvr & 0xffff);
There's quite a bit of decode of pvr for maj.min in the kernel.
r~