diff mbox series

[v2,2/3] s390x/cpumodel: default enable mepoch for z14 and later

Message ID 20190212011657.18324-2-walling@linux.ibm.com
State New
Headers show
Series [v2,1/3] s390x/cpumodel: mepochptff: warn when no mepoch and re-align group init | expand

Commit Message

Collin Walling Feb. 12, 2019, 1:16 a.m. UTC
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(+)

Comments

David Hildenbrand Feb. 12, 2019, 9:04 a.m. UTC | #1
On 12.02.19 02:16, Collin Walling wrote:
> 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 :)

Looks good to me!

Reviewed-by: David Hildenbrand <david@redhat.com>

> ---
>  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 */
>
Collin Walling Feb. 12, 2019, 5:03 p.m. UTC | #2
On 2/12/19 4:04 AM, David Hildenbrand wrote:
> On 12.02.19 02:16, Collin Walling wrote:
>> 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 :)
> 
> Looks good to me!
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>
> 

Thanks!
Cornelia Huck Feb. 13, 2019, 9:47 a.m. UTC | #3
On Mon, 11 Feb 2019 20:16:56 -0500
Collin Walling <walling@linux.ibm.com> wrote:

> 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(+)

This gained a conflict in s390-virtio-ccw.c, which I fixed up.

Thanks, applied.
diff mbox series

Patch

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 */