qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v12 2/7] s390x/cpu topology: reporting the CPU topology to th


From: Pierre Morel
Subject: Re: [PATCH v12 2/7] s390x/cpu topology: reporting the CPU topology to the guest
Date: Tue, 6 Dec 2022 15:44:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0



On 11/29/22 18:42, Pierre Morel wrote:
The guest uses the STSI instruction to get information on the
CPU topology.

Let us implement the STSI instruction for the basis CPU topology
level, level 2.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
  target/s390x/cpu.h          |  77 +++++++++++++++
  hw/s390x/s390-virtio-ccw.c  |  12 +--
  target/s390x/cpu_topology.c | 186 ++++++++++++++++++++++++++++++++++++
  target/s390x/kvm/kvm.c      |   6 +-
  target/s390x/meson.build    |   1 +
  5 files changed, 274 insertions(+), 8 deletions(-)
  create mode 100644 target/s390x/cpu_topology.c


+ */
+static void s390_topology_add_cpu(S390Topology *topo, S390CPU *cpu)
+{
+    int core_id = cpu->env.core_id;
+    int bit, origin;
+    int socket_id;
+
+    cpu->machine_data = topo;

Sorry this wrong machine_data is already used as a pointer to the S390CcwMachineState machine.



+    socket_id = core_id / topo->num_cores;
+    /*

...snip...

+
+static int setup_stsi(S390CPU *cpu, SysIB_151x *sysib, int level)
+{
+    S390Topology *topo = (S390Topology *)cpu->machine_data;

Sorry, wrong too this must be:

    S390CcwMachineState *s390ms = cpu->machine_data;
    S390Topology *topo = S390_CPU_TOPOLOGY(s390ms->topology);

+    char *p = sysib->tle;
+
+    sysib->mnest = level;
+    switch (level) {
+    case 2:
+        sysib->mag[S390_TOPOLOGY_MAG2] = topo->num_sockets;
+        sysib->mag[S390_TOPOLOGY_MAG1] = topo->num_cores;
+        p = s390_top_set_level2(topo, p);
+        break;
+    }
+
+    return p - (char *)sysib;
+}
+


Regards,
Pierre

--
Pierre Morel
IBM Lab Boeblingen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]