qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Collin Walling <walling@linux.ibm.com>
To: qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Cc: david@redhat.com, borntraeger@de.ibm.com, cohuck@redhat.com,
	pasic@linux.ibm.com, rth@twiddle.net
Subject: [Qemu-devel] [PATCH v2 2/3] s390x/cpumodel: default enable mepoch for z14 and later
Date: Mon, 11 Feb 2019 20:16:56 -0500	[thread overview]
Message-ID: <20190212011657.18324-2-walling@linux.ibm.com> (raw)
In-Reply-To: <20190212011657.18324-1-walling@linux.ibm.com>

Latest systems and host kernels support mepoch, which is a
feature that was meant to be supported for z14 GA1 from the
get-go. Let's copy it to the z14 GA1 default CPU model.

Machines s390-ccw-virtio-3.1 and older will retain the old CPU
models and will not provide this bit nor the extended PTFF
functions in the default model.

Signed-off-by: Collin Walling <walling@linux.ibm.com>
---
@Christian, @David: I elected to not add your r-b's to this
patch since I've added some code to disable feature groups.
I'd like to know what you both think :)
---
 hw/s390x/s390-virtio-ccw.c  |  2 ++
 target/s390x/cpu_models.c   | 24 ++++++++++++++++++++++++
 target/s390x/cpu_models.h   |  2 ++
 target/s390x/gen-features.c |  2 ++
 4 files changed, 30 insertions(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index fd9d0b0542..643265f0b4 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -757,6 +757,8 @@ DEFINE_CCW_MACHINE(4_0, "4.0", true);
 static void ccw_machine_3_1_instance_options(MachineState *machine)
 {
     ccw_machine_4_0_instance_options(machine);
+    s390_cpudef_featoff_greater(14, 1, S390_FEAT_MULTIPLE_EPOCH);
+    s390_cpudef_group_featoff_greater(14, 1, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF);
 }
 
 static void ccw_machine_3_1_class_options(MachineClass *mc)
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index b42b5fd327..d75a20e49d 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -117,6 +117,30 @@ void s390_cpudef_featoff_greater(uint8_t gen, uint8_t ec_ga, S390Feat feat)
     }
 }
 
+void s390_cpudef_group_featoff_greater(uint8_t gen, uint8_t ec_ga,
+                                       S390FeatGroup group)
+{
+    const S390FeatGroupDef *group_def = s390_feat_group_def(group);
+    S390FeatBitmap group_def_off;
+    int i;
+
+    bitmap_complement(group_def_off, group_def->feat, S390_FEAT_MAX);
+
+    for (i = 0; i < ARRAY_SIZE(s390_cpu_defs); i++) {
+        const S390CPUDef *cpu_def = &s390_cpu_defs[i];
+
+        if (cpu_def->gen < gen) {
+            continue;
+        }
+        if (cpu_def->gen == gen && cpu_def->ec_ga < ec_ga) {
+            continue;
+        }
+
+        bitmap_and((unsigned long *)&cpu_def->default_feat,
+                   cpu_def->default_feat, group_def_off, S390_FEAT_MAX);
+    }
+}
+
 uint32_t s390_get_hmfai(void)
 {
     static S390CPU *cpu;
diff --git a/target/s390x/cpu_models.h b/target/s390x/cpu_models.h
index 11cf5386fb..174a99e561 100644
--- a/target/s390x/cpu_models.h
+++ b/target/s390x/cpu_models.h
@@ -75,6 +75,8 @@ struct S390CPUModel {
 
 void s390_cpudef_featoff(uint8_t gen, uint8_t ec_ga, S390Feat feat);
 void s390_cpudef_featoff_greater(uint8_t gen, uint8_t ec_ga, S390Feat feat);
+void s390_cpudef_group_featoff_greater(uint8_t gen, uint8_t ec_ga,
+                                       S390FeatGroup group);
 uint32_t s390_get_hmfai(void);
 uint8_t s390_get_mha_pow(void);
 uint32_t s390_get_ibc_val(void);
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
index 70015eaaf5..4770f00105 100644
--- a/target/s390x/gen-features.c
+++ b/target/s390x/gen-features.c
@@ -550,6 +550,8 @@ static uint16_t default_GEN14_GA1[] = {
     S390_FEAT_GROUP_MSA_EXT_6,
     S390_FEAT_GROUP_MSA_EXT_7,
     S390_FEAT_GROUP_MSA_EXT_8,
+    S390_FEAT_MULTIPLE_EPOCH,
+    S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
 };
 
 /* QEMU (CPU model) features */
-- 
2.20.1

  reply	other threads:[~2019-02-12  1:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12  1:16 [Qemu-devel] [PATCH v2 1/3] s390x/cpumodel: mepochptff: warn when no mepoch and re-align group init Collin Walling
2019-02-12  1:16 ` Collin Walling [this message]
2019-02-12  9:04   ` [Qemu-devel] [PATCH v2 2/3] s390x/cpumodel: default enable mepoch for z14 and later David Hildenbrand
2019-02-12 17:03     ` [Qemu-devel] [qemu-s390x] " Collin Walling
2019-02-13  9:47   ` [Qemu-devel] " Cornelia Huck
2019-02-12  1:16 ` [Qemu-devel] [PATCH v2 3/3] s390x/cpumodel: add z14 GA2 model Collin Walling
2019-02-13  9:48   ` Cornelia Huck
2019-02-12 10:04 ` [Qemu-devel] [PATCH v2 1/3] s390x/cpumodel: mepochptff: warn when no mepoch and re-align group init Cornelia Huck
2019-02-12 17:02   ` [Qemu-devel] [qemu-s390x] " Collin Walling
2019-02-12 10:09 ` [Qemu-devel] " Christian Borntraeger
2019-02-12 17:03   ` Collin Walling
2019-02-12 19:35 ` David Hildenbrand
2019-02-13  9:45 ` 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=20190212011657.18324-2-walling@linux.ibm.com \
    --to=walling@linux.ibm.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@redhat.com \
    --cc=pasic@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    /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).