All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <dahi@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, jdenemar@redhat.com, imammedo@redhat.com,
	cornelia.huck@de.ibm.com, borntraeger@de.ibm.com,
	fiuczy@linux.vnet.ibm.com, mimu@linux.vnet.ibm.com
Subject: [Qemu-devel] [Patch v3 16/30] s390x/sclp: propagate the ibc val(lowest and unblocked ibc)
Date: Wed, 24 Aug 2016 20:10:52 +0200	[thread overview]
Message-ID: <1472062266-53206-17-git-send-email-dahi@linux.vnet.ibm.com> (raw)
In-Reply-To: <1472062266-53206-1-git-send-email-dahi@linux.vnet.ibm.com>

If we have a lowest ibc, we can indicate the ibc to the guest.

Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
---
 hw/s390x/sclp.c           |  2 ++
 include/hw/s390x/sclp.h   |  3 ++-
 target-s390x/cpu_models.c | 21 +++++++++++++++++++++
 target-s390x/cpu_models.h | 12 ++++++++++++
 4 files changed, 37 insertions(+), 1 deletion(-)

diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
index 3c126ee..52f8bb9 100644
--- a/hw/s390x/sclp.c
+++ b/hw/s390x/sclp.c
@@ -62,6 +62,8 @@ static void read_SCP_info(SCLPDevice *sclp, SCCB *sccb)
     read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries));
     read_info->highest_cpu = cpu_to_be16(max_cpus);
 
+    read_info->ibc_val = cpu_to_be32(s390_get_ibc_val());
+
     /* Configuration Characteristic (Extension) */
     s390_get_feat_block(S390_FEAT_TYPE_SCLP_CONF_CHAR,
                          read_info->conf_char);
diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
index 30a40ea..664be9b 100644
--- a/include/hw/s390x/sclp.h
+++ b/include/hw/s390x/sclp.h
@@ -121,7 +121,8 @@ typedef struct ReadInfo {
     uint8_t  loadparm[8];               /* 24-31 */
     uint8_t  _reserved3[48 - 32];       /* 32-47 */
     uint64_t facilities;                /* 48-55 */
-    uint8_t  _reserved0[80 - 56];       /* 56-79 */
+    uint8_t  _reserved0[76 - 56];       /* 56-75 */
+    uint32_t ibc_val;
     uint8_t  conf_char[96 - 80];        /* 80-95 */
     uint8_t  _reserved4[100 - 96];      /* 96-99 */
     uint32_t rnsize2;
diff --git a/target-s390x/cpu_models.c b/target-s390x/cpu_models.c
index 4968fdc..70337b8 100644
--- a/target-s390x/cpu_models.c
+++ b/target-s390x/cpu_models.c
@@ -74,6 +74,27 @@ static const S390CPUDef s390_cpu_defs[] = {
     CPUDEF_INIT(0x2965, 13, 2, 47, 0x08000000U, "z13s", "IBM z13s GA1"),
 };
 
+uint32_t s390_get_ibc_val(void)
+{
+    uint16_t unblocked_ibc, lowest_ibc;
+    static S390CPU *cpu;
+
+    if (!cpu) {
+        cpu = S390_CPU(qemu_get_cpu(0));
+    }
+
+    if (!cpu || !cpu->model) {
+        return 0;
+    }
+    unblocked_ibc = s390_ibc_from_cpu_model(cpu->model);
+    lowest_ibc = cpu->model->lowest_ibc;
+    /* the lowest_ibc always has to be <= unblocked_ibc */
+    if (!lowest_ibc || lowest_ibc > unblocked_ibc) {
+        return 0;
+    }
+    return ((uint32_t) lowest_ibc << 16) | unblocked_ibc;
+}
+
 void s390_get_feat_block(S390FeatType type, uint8_t *data)
 {
     static S390CPU *cpu;
diff --git a/target-s390x/cpu_models.h b/target-s390x/cpu_models.h
index 04c47c6..bbb85ac 100644
--- a/target-s390x/cpu_models.h
+++ b/target-s390x/cpu_models.h
@@ -43,6 +43,18 @@ typedef struct S390CPUModel {
     uint8_t cpu_ver;        /* CPU version, usually "ff" for kvm */
 } S390CPUModel;
 
+#define S390_GEN_Z10 0xa
+
+uint32_t s390_get_ibc_val(void);
+static inline uint16_t s390_ibc_from_cpu_model(const S390CPUModel *model)
+{
+    uint16_t ibc = 0;
+
+    if (model->def->gen >= S390_GEN_Z10) {
+        ibc = ((model->def->gen - S390_GEN_Z10) << 4) + model->def->ec_ga;
+    }
+    return ibc;
+}
 void s390_get_feat_block(S390FeatType type, uint8_t *data);
 bool s390_has_feat(S390Feat feat);
 
-- 
2.6.6

  parent reply	other threads:[~2016-08-24 18:11 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-24 18:10 [Qemu-devel] [Patch v3 00/30] s390x CPU models: exposing features David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 01/30] qmp: details about CPU definitions in query-cpu-definitions David Hildenbrand
2016-08-24 20:49   ` Eric Blake
2016-08-24 20:55     ` David Hildenbrand
2016-08-29  9:09       ` Cornelia Huck
2016-08-29 10:13   ` [Qemu-devel] [Patch " David Hildenbrand
2016-08-29 14:47     ` Eric Blake
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 02/30] s390x/cpumodel: "host" and "qemu" as CPU subclasses David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 03/30] s390x/cpumodel: expose CPU class properties David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 04/30] s390x/cpumodel: introduce CPU features David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 05/30] s390x/cpumodel: generate CPU feature lists for CPU models David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 06/30] s390x/cpumodel: generate CPU feature group lists David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 07/30] s390x/cpumodel: introduce CPU feature group definitions David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 08/30] s390x/cpumodel: register defined CPU models as subclasses David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 09/30] s390x/cpumodel: store the CPU model in the CPU instance David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 10/30] s390x/cpumodel: expose features and feature groups as properties David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 11/30] s390x/cpumodel: let the CPU model handle feature checks David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 12/30] s390x/cpumodel: check and apply the CPU model David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 13/30] s390x/sclp: factor out preparation of cpu entries David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 14/30] s390x/sclp: introduce sclp feature blocks David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 15/30] s390x/sclp: indicate sclp features David Hildenbrand
2016-08-24 18:10 ` David Hildenbrand [this message]
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 17/30] s390x/sclp: propagate the mha via sclp David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 18/30] s390x/sclp: propagate hmfai David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 19/30] linux-headers: update against kvm/next David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 20/30] s390x/kvm: allow runtime-instrumentation for "none" machine David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 21/30] s390x/kvm: implement CPU model support David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 22/30] s390x/kvm: disable host model for problematic compat machines David Hildenbrand
2016-08-24 18:10 ` [Qemu-devel] [Patch v3 23/30] s390x/kvm: let the CPU model control CMM(A) David Hildenbrand
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 24/30] s390x/kvm: don't enable key wrapping if msa3 is disabled David Hildenbrand
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 25/30] qmp: add QMP interface "query-cpu-model-expansion" David Hildenbrand
2016-08-24 19:43   ` Eduardo Habkost
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 26/30] qmp: add QMP interface "query-cpu-model-comparison" David Hildenbrand
2016-08-24 19:45   ` Eduardo Habkost
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 27/30] qmp: add QMP interface "query-cpu-model-baseline" David Hildenbrand
2016-08-24 19:46   ` Eduardo Habkost
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 28/30] s390x/cpumodel: implement QMP interface "query-cpu-model-expansion" David Hildenbrand
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 29/30] s390x/cpumodel: implement QMP interface "query-cpu-model-comparison" David Hildenbrand
2016-08-24 18:11 ` [Qemu-devel] [Patch v3 30/30] s390x/cpumodel: implement QMP interface "query-cpu-model-baseline" David Hildenbrand
2016-08-24 19:02 ` [Qemu-devel] [Patch v3 00/30] s390x CPU models: exposing features no-reply
2016-08-29  8:34 ` David Hildenbrand
2016-08-29  9:11   ` Cornelia Huck
2016-08-29 11:37 ` Cornelia Huck

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=1472062266-53206-17-git-send-email-dahi@linux.vnet.ibm.com \
    --to=dahi@linux.vnet.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=ehabkost@redhat.com \
    --cc=fiuczy@linux.vnet.ibm.com \
    --cc=imammedo@redhat.com \
    --cc=jdenemar@redhat.com \
    --cc=mimu@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.