On Fri, 2022-09-02 at 09:55 +0200, Pierre Morel wrote:
The guest can use the STSI instruction to get a buffer filled
with the CPU topology description.
Let us implement the STSI instruction for the basis CPU topology
level, level 2.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
hw/s390x/cpu-topology.c | 4 ++
include/hw/s390x/cpu-topology.h | 5 ++
target/s390x/cpu.h | 49 +++++++++++++++
target/s390x/cpu_topology.c | 108 ++++++++++++++++++++++++++++++++
target/s390x/kvm/kvm.c | 6 +-
target/s390x/meson.build | 1 +
6 files changed, 172 insertions(+), 1 deletion(-)
create mode 100644 target/s390x/cpu_topology.c
[...]
diff --git a/target/s390x/cpu_topology.c b/target/s390x/cpu_topology.c
[...]
+static char *fill_tle_cpu(char *p, uint64_t mask, int origin)
+{
+ SysIBTl_cpu *tle = (SysIBTl_cpu *)p;
+
+ tle->nl = 0;
+ tle->dedicated = 1;
+ tle->polarity = S390_TOPOLOGY_POLARITY_H;
+ tle->type = S390_TOPOLOGY_CPU_TYPE;
+ tle->origin = origin * 64;
origin is a multibyte field too, so needs a conversion too.