linux-user: Add missing /proc/cpuinfo fields for sparc
PATCH 1/1 linux-user: Add missing /proc/cpuinfo fields for sparc
Add some missing fields which may be parsed by userspace applications.
linux-user/sparc/target_proc.h +16 -0
@@ -8,7 +8,23 @@static int open_cpuinfo (CPUArchState *cpu_env,int fd) { +int i, num_cpus; + + num_cpus =sysconf (_SC_NPROCESSORS_ONLN); + +dprintf (fd,"cpu\t\t: TI UltraSparc II QEMU (BlackBird)\n" ); +dprintf (fd,"fpu\t\t: UltraSparc II integrated FPU\n" ); +dprintf (fd,"promlib\t\t: Version 3 Revision 17\n" ); +dprintf (fd,"prom\t\t: 3.17.0\n" );dprintf (fd,"type\t\t: sun4u\n" ); +dprintf (fd,"ncpus probed\t: %d\n" , num_cpus); +dprintf (fd,"ncpus active\t: %d\n" , num_cpus); +dprintf (fd,"MMU Type\t: Spitfire\n" ); +dprintf (fd,"State:\n" ); +for (i =0 ; i < num_cpus; i++) { +dprintf (fd,"CPU%d:\t\t: online\n" , i); + } +return 0 ; }#define HAVE_ARCH_PROC_CPUINFO
Quoted 10 lines · Helge Deller
Add some missing fields which may be parsed by userspace applications.
Signed-off-by Helge Deller <[email protected]>linux-user/sparc/target_proc.h +0
-0
linux-user/sparc/target_proc.h line 15
Quoted 8 lines
linux-user/sparc/target_proc.h +5
-0@@ -8,7 +8,23 @@static int open_cpuinfo (CPUArchState *cpu_env,int fd) { +int i, num_cpus; + + num_cpus =sysconf (_SC_NPROCESSORS_ONLN); + +dprintf (fd,"cpu\t\t: TI UltraSparc II QEMU (BlackBird)\n" );
Obviously won't match with non-default cpu.
r~
linux-user/sparc/target_proc.h line 18
Quoted 3 lines
linux-user/sparc/target_proc.h +3
-0+dprintf (fd,"fpu\t\t: UltraSparc II integrated FPU\n" ); +dprintf (fd,"promlib\t\t: Version 3 Revision 17\n" ); +dprintf (fd,"prom\t\t: 3.17.0\n" );
Do we really want to pretend with any of these?
r~
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Helge Deller
Add some missing fields which may be parsed by userspace applications.
Signed-off-by Helge Deller <[email protected]>
Quoted 14 lines
linux-user/sparc/target_proc.h line 14
Quoted 12 lines
linux-user/sparc/target_proc.h +5
-0@@ -8,7 +8,23 @@ static int open_cpuinfo(CPUArchState *cpu_env, int fd) { + int i, num_cpus; + + num_cpus = sysconf(_SC_NPROCESSORS_ONLN); + + dprintf(fd, "cpu\t\t: TI UltraSparc II QEMU (BlackBird)\n");Obviously won't match with non-default cpu.
OIC!
Well, this would need much more coding which I won't do now (and without any benefit as I haven't seen a program yet which really cares about that specific CPU info).
Quoted 5 lines
linux-user/sparc/target_proc.h line 18
Quoted 3 lines
linux-user/sparc/target_proc.h +3
-0+ dprintf(fd, "fpu\t\t: UltraSparc II integrated FPU\n"); + dprintf(fd, "promlib\t\t: Version 3 Revision 17\n"); + dprintf(fd, "prom\t\t: 3.17.0\n");Do we really want to pretend with any of these?
I'm now sparc expert, so I don't know.
My suggestion:
I change my patch to just add:
+ dprintf(fd, "ncpus probed\t: %d\n", num_cpus);
+ dprintf(fd, "ncpus active\t: %d\n", num_cpus);
+ dprintf(fd, "State:\n");
+ for (i = 0; i < num_cpus; i++) {+ dprintf(fd, "CPU%d:\t\t: online\n", i);
+ }
Those were the lines which I was mostly interested in since I found one application which wants to parse /proc/cpuinfo to get number of CPUs in system.
Would that be acceptable (for now) ?
Helge
Quoted 10 lines · Helge Deller
My suggestion:
I change my patch to just add:+
dprintf(fd, "ncpus probed\t: %d\n", num_cpus); +dprintf(fd, "ncpus active\t: %d\n", num_cpus); +dprintf(fd, "State:\n");
+ for (i = 0; i <num_cpus; i++) {
+dprintf(fd, "CPU%d:\t\t: online\n", i); + }
Quoted 4 lines
Those were the lines which I was mostly interested in since I found one application which wants to parse
/proc/cpuinfoto get number of CPUs in system.
Would that be acceptable (for now) ?
Yes, thanks. If only linux had added a prctl or something to not require parsing...
r~
Quoted 11 lines · Richard Henderson
Quoted 10 lines · Helge Deller
My suggestion:
I change my patch to just add:+
dprintf(fd, "ncpus probed\t: %d\n", num_cpus); +dprintf(fd, "ncpus active\t: %d\n", num_cpus); +dprintf(fd, "State:\n");
+ for (i = 0; i <num_cpus; i++) {
+dprintf(fd, "CPU%d:\t\t: online\n", i); + }
Quoted 6 lines
Quoted 4 lines
Those were the lines which I was mostly interested in since I found one application which wants to parse
/proc/cpuinfoto get number of CPUs in system.
Would that be acceptable (for now) ?Yes, thanks. If only linux had added a prctl or something to not require parsing...
True, but most people forget about glibc providing sysconf(_SC_NPROCESSORS_ONLN) as portable function so that people do not need to implement parsing /proc/cpuinfo for each architecture themselves.
I'll respin the patch.
Helge