qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Pierre Morel <pmorel@linux.ibm.com>
To: qemu-s390x@nongnu.org
Cc: thuth@redhat.com, ehabkost@redhat.com, david@redhat.com,
	cohuck@redhat.com, richard.henderson@linaro.org,
	qemu-devel@nongnu.org, armbru@redhat.com, pasic@linux.ibm.com,
	borntraeger@de.ibm.com, pbonzini@redhat.com, eblake@redhat.com
Subject: [PATCH v1 2/9] s390x: toplogy: adding drawers and books to smp parsing
Date: Wed, 14 Jul 2021 18:53:09 +0200	[thread overview]
Message-ID: <1626281596-31061-3-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1626281596-31061-1-git-send-email-pmorel@linux.ibm.com>

Drawers and Books are levels 4 and 3 of the S390 CPU
topology.
We allow the user to define these levels and we will
store the values inside the S390CcwMachineState.

Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
 hw/s390x/s390-virtio-ccw.c         | 22 +++++++++++++++-------
 include/hw/s390x/s390-virtio-ccw.h |  2 ++
 qapi/machine.json                  |  2 ++
 softmmu/vl.c                       |  6 ++++++
 4 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 899d3a4137..42d9be7333 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -591,12 +591,17 @@ static void s390_smp_parse(MachineState *ms, QemuOpts *opts)
     unsigned cpus    = qemu_opt_get_number(opts, "cpus", 1);
     unsigned sockets = qemu_opt_get_number(opts, "sockets", 1);
     unsigned cores   = qemu_opt_get_number(opts, "cores", 1);
+    unsigned drawers = qemu_opt_get_number(opts, "drawers", 1);
+    unsigned books   = qemu_opt_get_number(opts, "books", 1);
+    S390CcwMachineState *s390ms = S390_CCW_MACHINE(ms);
 
     if (opts) {
-        if (cpus == 0 || sockets == 0 || cores == 0) {
+        if (cpus == 0 || drawers == 0 || books == 0 || sockets == 0 ||
+            cores == 0) {
             error_report("cpu topology: "
-                         "sockets (%u), cores (%u) or number of CPU(%u) "
-                         "can not be zero", sockets, cores, cpus);
+                         "drawers (%u) books (%u) sockets (%u), cores (%u) "
+                         "or number of CPU(%u) can not be zero", drawers,
+                         books, sockets, cores, cpus);
             exit(1);
         }
     }
@@ -608,12 +613,13 @@ static void s390_smp_parse(MachineState *ms, QemuOpts *opts)
     }
 
     if (!qemu_opt_find(opts, "cores")) {
-        cores = ms->smp.max_cpus / sockets;
+        cores = ms->smp.max_cpus / (drawers * books * sockets);
     }
 
-    if (sockets * cores != ms->smp.max_cpus) {
-        error_report("Invalid CPU topology: sockets (%u) * cores (%u) "
-                     "!= maxcpus (%u)", sockets, cores, ms->smp.max_cpus);
+    if (drawers * books * sockets * cores != ms->smp.max_cpus) {
+        error_report("Invalid CPU topology: drawers (%u) books (%u) "
+                     "sockets (%u) * cores (%u) != maxcpus (%u)",
+                     drawers, books, sockets, cores, ms->smp.max_cpus);
         exit(1);
     }
 
@@ -621,6 +627,8 @@ static void s390_smp_parse(MachineState *ms, QemuOpts *opts)
     ms->smp.cpus = cpus;
     ms->smp.cores = cores;
     ms->smp.sockets = sockets;
+    s390ms->drawers = drawers;
+    s390ms->books = books;
 }
 
 static void ccw_machine_class_init(ObjectClass *oc, void *data)
diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-virtio-ccw.h
index 3331990e02..fb3c3a50ce 100644
--- a/include/hw/s390x/s390-virtio-ccw.h
+++ b/include/hw/s390x/s390-virtio-ccw.h
@@ -28,6 +28,8 @@ struct S390CcwMachineState {
     bool dea_key_wrap;
     bool pv;
     uint8_t loadparm[8];
+    int drawers;
+    int books;
 };
 
 struct S390CcwMachineClass {
diff --git a/qapi/machine.json b/qapi/machine.json
index c3210ee1fb..98aff804c6 100644
--- a/qapi/machine.json
+++ b/qapi/machine.json
@@ -883,6 +883,8 @@
   'data': { '*node-id': 'int',
             '*socket-id': 'int',
             '*die-id': 'int',
+            '*drawer-id': 'int',
+            '*book-id': 'int',
             '*core-id': 'int',
             '*thread-id': 'int'
   }
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 4df1496101..fc73107b91 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -699,6 +699,12 @@ static QemuOptsList qemu_smp_opts = {
         }, {
             .name = "dies",
             .type = QEMU_OPT_NUMBER,
+        }, {
+            .name = "books",
+            .type = QEMU_OPT_NUMBER,
+        }, {
+            .name = "drawers",
+            .type = QEMU_OPT_NUMBER,
         }, {
             .name = "cores",
             .type = QEMU_OPT_NUMBER,
-- 
2.25.1



  parent reply	other threads:[~2021-07-14 16:54 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 16:53 [PATCH v1 0/9] s390x: CPU Topology Pierre Morel
2021-07-14 16:53 ` [PATCH v1 1/9] s390x: smp: s390x dedicated smp parsing Pierre Morel
2021-07-16  8:54   ` Cornelia Huck
2021-07-16  9:14     ` Daniel P. Berrangé
2021-07-16 10:59       ` Pierre Morel
     [not found]       ` <e4865ad6-f8ec-e7ba-66ef-9c95334ba9b3@linux.ibm.com>
2021-07-19 15:43         ` Cornelia Huck
2021-07-19 15:52           ` Daniel P. Berrangé
2021-07-20  7:37             ` Pierre Morel
2021-07-20  8:33               ` Pierre Morel
2021-07-16 10:47     ` Pierre Morel
2021-07-14 16:53 ` Pierre Morel [this message]
2021-07-15  6:16   ` [PATCH v1 2/9] s390x: toplogy: adding drawers and books to " Markus Armbruster
2021-07-15  8:19     ` Pierre Morel
2021-07-15 10:48       ` Markus Armbruster
2021-07-16  9:10         ` Cornelia Huck
2021-07-16  9:18           ` Daniel P. Berrangé
2021-07-16 10:44             ` Cornelia Huck
2021-07-16 10:49               ` Daniel P. Berrangé
2021-07-19 15:50                 ` Cornelia Huck
2021-07-20  7:52                   ` Pierre Morel
2021-07-20  8:20                     ` Cornelia Huck
2021-07-20  8:46                       ` Pierre Morel
2021-07-20  9:00                         ` Cornelia Huck
2021-07-20  9:19                         ` Daniel P. Berrangé
2021-07-20 12:29                           ` Pierre Morel
2021-07-16  9:23     ` Daniel P. Berrangé
2021-07-16 11:08       ` Pierre Morel
2021-07-14 16:53 ` [PATCH v1 3/9] s390x: cpu topology: CPU topology objects and structures Pierre Morel
2021-07-14 16:53 ` [PATCH v1 4/9] s390x: Topology list entries and SYSIB 15.x.x Pierre Morel
2021-07-14 16:53 ` [PATCH v1 5/9] s390x: topology: implementating Store Topology System Information Pierre Morel
2021-07-14 16:53 ` [PATCH v1 6/9] s390x: kvm: topology: interception of PTF instruction Pierre Morel
2021-07-16  9:22   ` Cornelia Huck
2021-07-16 11:23     ` Pierre Morel
2021-07-16 11:56       ` Cornelia Huck
2021-07-14 16:53 ` [PATCH v1 7/9] s390x: SCLP: reporting the maximum nested topology entries Pierre Morel
2021-07-16  9:24   ` Cornelia Huck
2021-07-16 11:12     ` Pierre Morel
2021-07-14 16:53 ` [PATCH v1 8/9] s390x: numa: define drawers and books for NUMA Pierre Morel
2021-07-14 16:53 ` [PATCH v1 9/9] s390x: numa: implement NUMA for S390x Pierre Morel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1626281596-31061-3-git-send-email-pmorel@linux.ibm.com \
    --to=pmorel@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=eblake@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).