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

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

 





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@xxxxxxxxxxxxx>
---
  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



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux