etoken patch for 3.1
cover etoken patch for 3.1
this depends on the current kvms390/next kernel tree.
Christian Borntraeger (2):
header sync
s390x/kvm: add etoken facility
linux-headers/asm-s390/kvm.h | 5 ++++- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 7 files changed, 43 insertions(+), 5 deletions(-)
Signature · 1 line
2.17.0
PATCH 1/2 header sync
-> place holder for proper header sync.
--- linux-headers/asm-s390/kvm.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
linux-headers/asm-s390/kvm.h +4 -1
@@ -4,7 +4,7 @@/* * KVM s390 specific structures and definitions * -* Copyright IBM Corp. 2008 +* Copyright IBM Corp. 2008, 2018 * * Author(s): Carsten Otte <[email protected]> * Christian Borntraeger <[email protected]>
@@ -225,6 +225,7 @@ struct kvm_guest_debug_arch {#define KVM_SYNC_FPRS (1UL << 8)#define KVM_SYNC_GSCB (1UL << 9)#define KVM_SYNC_BPBC (1UL << 10) +#define KVM_SYNC_ETOKEN (1UL << 11)/* length and alignment of the sdnx as a power of two */ #define SDNXC 8#define SDNXL (1UL << SDNXC)
@@ -258,6 +259,8 @@ struct kvm_sync_regs {struct {__u64 reserved1[2 ];__u64 gscb[4 ]; +__u64 etoken; +__u64 etoken_extension; }; }; };
Signature · 1 line
2.17.0
PATCH 2/2 s390x/kvm: add etoken facility
In reply to Christian BorntraegerProvide the etoken facility. We need to handle cpu model, migration and clear reset.
--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
target/s390x/cpu.h +3 -0
@@ -2,6 +2,7 @@* S/390 virtual CPU header * * Copyright (c) 2009 Ulrich Hecht +* Copyright IBM Corp. 2012, 2018 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public
@@ -68,6 +69,8 @@ struct CPUS390XState {uint32_t aregs[16 ];/* access registers */ uint8_t riccb[64 ];/* runtime instrumentation control */ uint64_t gscb[4 ];/* guarded storage control */ +uint64_t etoken;/* etoken */ +uint64_t etoken_extension;/* etoken extension */ /* Fields up to this point are not cleared by initial CPU reset */ struct {} start_initial_reset_fields;
target/s390x/cpu_features.c +2 -1
@@ -1,7 +1,7 @@/* * CPU features/facilities for s390x * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): David Hildenbrand <[email protected]> *
@@ -106,6 +106,7 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("irbm" ,S390_FEAT_TYPE_STFL ,145 ,"Insert-reference-bits-multiple facility" ),FEAT_INIT ("msa8-base" ,S390_FEAT_TYPE_STFL ,146 ,"Message-security-assist-extension-8 facility (excluding subfunctions)" ),FEAT_INIT ("cmmnt" ,S390_FEAT_TYPE_STFL ,147 ,"CMM: ESSA-enhancement (no translate) facility" ), +FEAT_INIT ("etoken" ,S390_FEAT_TYPE_STFL ,156 ,"etoken facility" ),/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility"),
target/s390x/cpu_features_def.h +2 -1
@@ -1,7 +1,7 @@/* * CPU features/facilities for s390 * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller <[email protected]> * David Hildenbrand <[email protected]>
@@ -93,6 +93,7 @@ typedef enum {S390_FEAT_INSERT_REFERENCE_BITS_MULT ,S390_FEAT_MSA_EXT_8 ,S390_FEAT_CMM_NT , +S390_FEAT_ETOKEN ,/* Sclp Conf Char */ S390_FEAT_SIE_GSLS,
target/s390x/gen-features.c +2 -1
@@ -1,7 +1,7 @@/* * S390 feature list generator * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller <[email protected]> * David Hildenbrand <[email protected]>
@@ -471,6 +471,7 @@ static uint16_t full_GEN14_GA1[] = {S390_FEAT_GROUP_MSA_EXT_7 ,S390_FEAT_GROUP_MSA_EXT_8 ,S390_FEAT_CMM_NT , +S390_FEAT_ETOKEN ,S390_FEAT_HPMA2 ,S390_FEAT_SIE_KSS , S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
target/s390x/kvm.c +11 -0
@@ -493,6 +493,12 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_BPBC ; } +if (can_sync_regs (cs,KVM_SYNC_ETOKEN )) { + cs->kvm_run->s.regs.etoken = env->etoken; + cs->kvm_run->s.regs.etoken_extension = env->etoken_extension; + cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_ETOKEN ; + } +/* Finally the prefix */ if (can_sync_regs (cs,KVM_SYNC_PREFIX )) { cs->kvm_run->s.regs.prefix = env->psa;
@@ -607,6 +613,11 @@ int kvm_arch_get_registers(CPUState *cs) env->bpbc = cs->kvm_run->s.regs.bpbc; } +if (can_sync_regs (cs,KVM_SYNC_ETOKEN )) { + env->etoken = cs->kvm_run->s.regs.etoken; + env->etoken_extension = cs->kvm_run->s.regs.etoken_extension; + } +/* pfault parameters */ if (can_sync_regs (cs,KVM_SYNC_PFAULT )) { env->pfault_token = cs->kvm_run->s.regs.pft;
target/s390x/machine.c +19 -1
@@ -1,7 +1,7 @@/* * S390x machine definitions and functions * -* Copyright IBM Corp. 2014 +* Copyright IBM Corp. 2014, 2018 * * Authors: * Thomas Huth <[email protected]>
@@ -216,6 +216,23 @@ const VMStateDescription vmstate_bpbc = { } }; +static bool etoken_needed (void *opaque) +{ +return s390_has_feat (S390_FEAT_ETOKEN ); +} + +const VMStateDescription vmstate_etoken = { + .name ="cpu/etoken" , + .version_id =1 , + .minimum_version_id =1 , + .needed = etoken_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64 (env.etoken,S390CPU ), +VMSTATE_UINT64 (env.etoken_extension,S390CPU ), +VMSTATE_END_OF_LIST () + } +}; +const VMStateDescription vmstate_s390_cpu = { .name ="cpu" , .post_load = cpu_post_load,
@@ -251,6 +268,7 @@ const VMStateDescription vmstate_s390_cpu = { &vmstate_exval, &vmstate_gscb, &vmstate_bpbc, + &vmstate_etoken, NULL }, };
Signature · 1 line
2.17.0
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
Quoted 15 lines · On Tue, 31 Jul 2018 11:04:48 +0200 Christian Borntraeger…
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
target/s390x/cpu_features.c static const S390FeatDef s390_features[] = { · line 109
Quoted 4 lines
target/s390x/cpu_features.c +1
-0@@ -106,6 +106,7 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("irbm" ,S390_FEAT_TYPE_STFL ,145 ,"Insert-reference-bits-multiple facility" ),FEAT_INIT ("msa8-base" ,S390_FEAT_TYPE_STFL ,146 ,"Message-security-assist-extension-8 facility (excluding subfunctions)" ),FEAT_INIT ("cmmnt" ,S390_FEAT_TYPE_STFL ,147 ,"CMM: ESSA-enhancement (no translate) facility" ), + FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "etoken facility"),
Don't facilities usually start with a capital letter?
Quoted 3 lines
target/s390x/cpu_features.c +0
-0/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility"),
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
Quoted 17 lines · Cornelia Huck
Quoted 13 lines · On Tue, 31 Jul 2018 11:04:48 +0200 Christian Borntraeger…
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
Quoted 7 lines
target/s390x/cpu_features.c static const S390FeatDef s390_features[] = { · line 109
Quoted 5 lines
target/s390x/cpu_features.c +1
-0@@ -106,6 +106,7 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("irbm" ,S390_FEAT_TYPE_STFL ,145 ,"Insert-reference-bits-multiple facility" ),FEAT_INIT ("msa8-base" ,S390_FEAT_TYPE_STFL ,146 ,"Message-security-assist-extension-8 facility (excluding subfunctions)" ),FEAT_INIT ("cmmnt" ,S390_FEAT_TYPE_STFL ,147 ,"CMM: ESSA-enhancement (no translate) facility" ), + FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "etoken facility"),Don't facilities usually start with a capital letter?
Yes, we should make it Etoken.
Quoted 5 lines
Quoted 4 lines
target/s390x/cpu_features.c +0
-0/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility"),
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
In reply to Christian BorntraegerQuoted 2 lines · On Tue, 31 Jul 2018 11:04:48 +0200 Christian Borntraeger…
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
^^^^^^^^^^^
Hm, anything special for that? I don't see it in the patch.
Quoted 11 lines
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
Quoted 6 lines · Cornelia Huck
Quoted 2 lines · On Tue, 31 Jul 2018 11:04:48 +0200 Christian Borntraeger…
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
^^^^^^^^^^^
Clear reset is the "strong one". Here we do a memset of the env structure. So this should be cleared along with the other registers.
Quoted 15 lines
Hm, anything special for that? I don't see it in the patch.
Quoted 11 lines
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
Quoted 10 lines · On Tue, 31 Jul 2018 12:14:28 +0200 Christian Borntraeger…
Quoted 6 lines · Cornelia Huck
Quoted 2 lines · On Tue, 31 Jul 2018 11:04:48 +0200 Christian Borntraeger…
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
^^^^^^^^^^^
Clear reset is the "strong one". Here we do a memset of the env structure. So this should be cleared along with the other registers.
I was confused why it was singled out...
Quoted 16 lines
Quoted 15 lines
Hm, anything special for that? I don't see it in the patch.
Quoted 11 lines
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)
Re: [Qemu-devel] [PATCH 2/2] s390x/kvm: add etoken facility
In reply to Christian BorntraegerQuoted 166 lines · Christian Borntraeger
Provide the etoken facility. We need to handle cpu model, migration and clear reset.
Signed-off-by Christian Borntraeger <[email protected]>Acked-by Janosch Frank <[email protected]>--- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-)target/s390x/cpu.h +3
-0@@ -2,6 +2,7 @@* S/390 virtual CPU header * * Copyright (c) 2009 Ulrich Hecht +* Copyright IBM Corp. 2012, 2018 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -68,6 +69,8 @@ struct CPUS390XState {uint32_t aregs[16 ];/* access registers */ uint8_t riccb[64 ];/* runtime instrumentation control */ uint64_t gscb[4 ];/* guarded storage control */ +uint64_t etoken;/* etoken */ +uint64_t etoken_extension;/* etoken extension */ /* Fields up to this point are not cleared by initial CPU reset */ struct {} start_initial_reset_fields;target/s390x/cpu_features.c +2
-1@@ -1,7 +1,7 @@/* * CPU features/facilities for s390x * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): David Hildenbrand <[email protected]> * @@ -106,6 +106,7 @@ static const S390FeatDef s390_features[] = {FEAT_INIT ("irbm" ,S390_FEAT_TYPE_STFL ,145 ,"Insert-reference-bits-multiple facility" ),FEAT_INIT ("msa8-base" ,S390_FEAT_TYPE_STFL ,146 ,"Message-security-assist-extension-8 facility (excluding subfunctions)" ),FEAT_INIT ("cmmnt" ,S390_FEAT_TYPE_STFL ,147 ,"CMM: ESSA-enhancement (no translate) facility" ), +FEAT_INIT ("etoken" ,S390_FEAT_TYPE_STFL ,156 ,"etoken facility" ),/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility"),target/s390x/cpu_features_def.h +2
-1@@ -1,7 +1,7 @@/* * CPU features/facilities for s390 * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller <[email protected]> * David Hildenbrand <[email protected]> @@ -93,6 +93,7 @@ typedef enum {S390_FEAT_INSERT_REFERENCE_BITS_MULT ,S390_FEAT_MSA_EXT_8 ,S390_FEAT_CMM_NT , +S390_FEAT_ETOKEN ,/* Sclp Conf Char */ S390_FEAT_SIE_GSLS,target/s390x/gen-features.c +2
-1@@ -1,7 +1,7 @@/* * S390 feature list generator * -* Copyright 2016 IBM Corp. +* Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller <[email protected]> * David Hildenbrand <[email protected]> @@ -471,6 +471,7 @@ static uint16_t full_GEN14_GA1[] = {S390_FEAT_GROUP_MSA_EXT_7 ,S390_FEAT_GROUP_MSA_EXT_8 ,S390_FEAT_CMM_NT , +S390_FEAT_ETOKEN ,S390_FEAT_HPMA2 ,S390_FEAT_SIE_KSS , S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,target/s390x/kvm.c +11
-0@@ -493,6 +493,12 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_BPBC ; } +if (can_sync_regs (cs,KVM_SYNC_ETOKEN )) { + cs->kvm_run->s.regs.etoken = env->etoken; + cs->kvm_run->s.regs.etoken_extension = env->etoken_extension; + cs->kvm_run->kvm_dirty_regs |=KVM_SYNC_ETOKEN ; + } +/* Finally the prefix */ if (can_sync_regs (cs,KVM_SYNC_PREFIX )) { cs->kvm_run->s.regs.prefix = env->psa;@@ -607,6 +613,11 @@ int kvm_arch_get_registers(CPUState *cs) env->bpbc = cs->kvm_run->s.regs.bpbc; } +if (can_sync_regs (cs,KVM_SYNC_ETOKEN )) { + env->etoken = cs->kvm_run->s.regs.etoken; + env->etoken_extension = cs->kvm_run->s.regs.etoken_extension; + } +/* pfault parameters */ if (can_sync_regs (cs,KVM_SYNC_PFAULT )) { env->pfault_token = cs->kvm_run->s.regs.pft;target/s390x/machine.c +18
-1@@ -1,7 +1,7 @@/* * S390x machine definitions and functions * -* Copyright IBM Corp. 2014 +* Copyright IBM Corp. 2014, 2018 * * Authors: * Thomas Huth <[email protected]> @@ -216,6 +216,23 @@ const VMStateDescription vmstate_bpbc = { } }; +static bool etoken_needed (void *opaque) +{ +return s390_has_feat (S390_FEAT_ETOKEN ); +} + +const VMStateDescription vmstate_etoken = { + .name ="cpu/etoken" , + .version_id =1 , + .minimum_version_id =1 , + .needed = etoken_needed, + .fields = (VMStateField []) { +VMSTATE_UINT64 (env.etoken,S390CPU ), +VMSTATE_UINT64 (env.etoken_extension,S390CPU ), +VMSTATE_END_OF_LIST () + } +}; +const VMStateDescription vmstate_s390_cpu = { .name ="cpu" , .post_load = cpu_post_load,
target/s390x/machine.c const VMStateDescription vmstate_s390_cpu = { · line 274
Quoted 7 lines
target/s390x/machine.c +1
-0@@ -251,6 +268,7 @@ const VMStateDescription vmstate_s390_cpu = { &vmstate_exval, &vmstate_gscb, &vmstate_bpbc, + &vmstate_etoken, NULL }, };
Apart from the capital letter, this looks good to me!
Signature · 3 lines
Thanks, David / dhildenb
Quoted 6 lines · On Tue, 31 Jul 2018 11:04:46 +0200 Christian Borntraeger…
this depends on the current kvms390/next kernel tree.
Christian Borntraeger (2):
header sync
s390x/kvm: add etoken facility
Quoted 9 lines
linux-headers/asm-s390/kvm.h | 5 ++++- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 7 files changed, 43 insertions(+), 5 deletions(-)
I can merge this (with a capital E in the feature name and a real headers update) once the kernel headers update hits Linux master. Please ping me if I forget :)
Quoted 19 lines · Cornelia Huck
Quoted 6 lines · On Tue, 31 Jul 2018 11:04:46 +0200 Christian Borntraeger…
this depends on the current kvms390/next kernel tree.
Christian Borntraeger (2):
header sync
s390x/kvm: add etoken facilityQuoted 9 lines
linux-headers/asm-s390/kvm.h | 5 ++++- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 7 files changed, 43 insertions(+), 5 deletions(-)
Quoted 3 lines
I can merge this (with a capital E in the feature name and a real headers update) once the kernel headers update hits Linux master. Please ping me if I forget :)
Thanks, will do.
Cornelia Huck
AppliedQuoted 19 lines · On Tue, 31 Jul 2018 13:29:30 +0200 Cornelia Huck <[email protected]> wrote:
Quoted 6 lines · On Tue, 31 Jul 2018 11:04:46 +0200 Christian Borntraeger…
this depends on the current kvms390/next kernel tree.
Christian Borntraeger (2):
header sync
s390x/kvm: add etoken facilityQuoted 9 lines
linux-headers/asm-s390/kvm.h | 5 ++++- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 7 files changed, 43 insertions(+), 5 deletions(-)
Quoted 3 lines
I can merge this (with a capital E in the feature name and a real headers update) once the kernel headers update hits Linux master. Please ping me if I forget :)
I did not forget; in fact, I just pushed it out to s390-next :)
Thanks, applied.