arm: add kvm-psci-version vcpu property
cover arm: add kvm-psci-version vcpu property
This series adds a vcpu knob to request a specific PSCI version from KVM via the KVM_REG_ARM_PSCI_VERSION FW register.
Note: in order to support PSCI v0.1 we need to drop vcpu initialization with KVM_CAP_ARM_PSCI_0_2 in that case. Alternatively we could limit support to versions >=0.2 .
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu property
docs/system/arm/cpu-features.rst | 5 +++ target/arm/cpu.h | 6 +++ target/arm/kvm-consts.h | 2 + target/arm/kvm.c | 70 +++++++++++++++++++++++++++++++- 4 files changed, 82 insertions(+), 1 deletion(-)
Signature · 1 line
2.42.0
PATCH 1/2 target/arm/kvm: add constants for new PSCI versions
Add constants for PSCI version 1_2 and 1_3.
--- target/arm/kvm-consts.h | 2 ++ 1 file changed, 2 insertions(+)
target/arm/kvm-consts.h +2 -0
@@ -97,6 +97,8 @@ MISMATCH_CHECK(QEMU_PSCI_1_0_FN_PSCI_FEATURES, PSCI_1_0_FN_PSCI_FEATURES);#define QEMU_PSCI_VERSION_0_2 0x00002#define QEMU_PSCI_VERSION_1_0 0x10000#define QEMU_PSCI_VERSION_1_1 0x10001 +#define QEMU_PSCI_VERSION_1_2 0x10002 +#define QEMU_PSCI_VERSION_1_3 0x10003MISMATCH_CHECK (QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED ,PSCI_0_2_TOS_MP );/* We don't bother to check every possible version value */
Signature · 1 line
2.42.0
Re: [PATCH 1/2] target/arm/kvm: add constants for new PSCI versions
Quoted 12 lines · Sebastian Ott
Add constants for PSCI version 1_2 and 1_3.
Signed-off-by Sebastian Ott <[email protected]>--- target/arm/kvm-consts.h | 2 ++ 1 file changed, 2 insertions(+)target/arm/kvm-consts.h +0
-0
target/arm/kvm-consts.h MISMATCH_CHECK(QEMU_PSCI_1_0_FN_PSCI_FEATURES, PSCI_1_0_FN_PSCI_FEATURES); · line 104
Quoted 8 lines
target/arm/kvm-consts.h +2
-0@@ -97,6 +97,8 @@ MISMATCH_CHECK(QEMU_PSCI_1_0_FN_PSCI_FEATURES, PSCI_1_0_FN_PSCI_FEATURES);#define QEMU_PSCI_VERSION_0_2 0x00002#define QEMU_PSCI_VERSION_1_0 0x10000#define QEMU_PSCI_VERSION_1_1 0x10001 +#define QEMU_PSCI_VERSION_1_2 0x10002 +#define QEMU_PSCI_VERSION_1_3 0x10003MISMATCH_CHECK (QEMU_PSCI_0_2_RET_TOS_MIGRATION_NOT_REQUIRED ,PSCI_0_2_TOS_MP );/* We don't bother to check every possible version value */
I would simply squash this in next patch
Thanks
Eric
PATCH 2/2 target/arm/kvm: add kvm-psci-version vcpu property
In reply to Sebastian OttProvide a kvm specific vcpu property to override the default (as of kernel v6.13 that would be PSCI v1.3) PSCI version emulated by kvm. Current valid values are: 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3
--- docs/system/arm/cpu-features.rst | 5 +++ target/arm/cpu.h | 6 +++ target/arm/kvm.c | 70 +++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 1 deletion(-)
docs/system/arm/cpu-features.rst +5 -0
@@ -204,6 +204,11 @@ the list of KVM VCPU features and their descriptions. the guest scheduler behavior and/or be exposed to the guest userspace. +``kvm-psci-version`` + Override the default (as of kernel v6.13 that would be PSCI v1.3) + PSCI version emulated by the kernel. Current valid values are: + 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3 + TCG VCPU Features =================
target/arm/cpu.h +6 -0
@@ -974,6 +974,12 @@ struct ArchCPU {*/ uint32_t psci_version; +/* +* Intermediate value used during property parsing. +* Once finalized, the value should be read from psci_version. +*/ +uint32_t prop_psci_version; +/* Current power state, access guarded by BQL */ ARMPSCIState power_state;
target/arm/kvm.c +69 -1
94 lines not on this page · raw message
Signature · 1 line
2.42.0
Re: [PATCH 2/2] target/arm/kvm: add kvm-psci-version vcpu property
Hi Sebastian,
Quoted 68 lines · Sebastian Ott
Provide a kvm specific vcpu property to override the default (as of kernel v6.13 that would be PSCI v1.3) PSCI version emulated by kvm. Current valid values are: 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3
Signed-off-by Sebastian Ott <[email protected]>--- docs/system/arm/cpu-features.rst | 5 +++ target/arm/cpu.h | 6 +++ target/arm/kvm.c | 70 +++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 1 deletion(-)docs/system/arm/cpu-features.rst +5
-0@@ -204,6 +204,11 @@ the list of KVM VCPU features and their descriptions. the guest scheduler behavior and/or be exposed to the guest userspace. +``kvm-psci-version`` + Override the default (as of kernel v6.13 that would be PSCI v1.3) + PSCI version emulated by the kernel. Current valid values are: + 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3 + TCG VCPU Features =================target/arm/cpu.h +6
-0@@ -974,6 +974,12 @@ struct ArchCPU {*/ uint32_t psci_version; +/* +* Intermediate value used during property parsing. +* Once finalized, the value should be read from psci_version. +*/ +uint32_t prop_psci_version; +/* Current power state, access guarded by BQL */ ARMPSCIState power_state;target/arm/kvm.c +16
-0@@ -483,6 +483,59 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)ARM_CPU (obj)->kvm_steal_time = value ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ; } +static char *kvm_get_psci_version (Object *obj,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); +const char *val; + +switch (cpu->prop_psci_version) { +case QEMU_PSCI_VERSION_0_1 : + val ="0.1" ; +break ; +case QEMU_PSCI_VERSION_0_2 : + val ="0.2" ; +break ; +case QEMU_PSCI_VERSION_1_0 : + val ="1.0" ; +break ; +case QEMU_PSCI_VERSION_1_1 :
target/arm/kvm.c static void kvm_steal_time_set(Object *obj, bool value, Error **errp) · line 511
Quoted 10 lines
target/arm/kvm.c +10
-0+ val ="1.1" ; +break ; +case QEMU_PSCI_VERSION_1_2 : + val ="1.2" ; +break ; +case QEMU_PSCI_VERSION_1_3 : + val ="1.3" ; +break ; +default : + val ="0.2" ;
can you explain why you return 0.2 by default? Shouldn't we report the default value exposed by KVM?
Quoted 44 lines
target/arm/kvm.c +33
-0+break ; + } +return g_strdup (val); +} + +static void kvm_set_psci_version (Object *obj,const char *value,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); + +if (!strcmp (value,"0.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_1 ; + }else if (!strcmp (value,"0.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_2 ; + }else if (!strcmp (value,"1.0" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_0 ; + }else if (!strcmp (value,"1.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_1 ; + }else if (!strcmp (value,"1.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_2 ; + }else if (!strcmp (value,"1.3" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_3 ; + }else { +error_setg (errp,"Invalid PSCI-version value" ); +error_append_hint (errp,"Valid values are 0.1, 0.2, 1.0, 1.1, 1.2, 1.3\n" ); + } +} +/* KVM VCPU properties should be prefixed with "kvm-". */ void kvm_arm_add_vcpu_properties (ARMCPU *cpu) {@@ -504,6 +557,12 @@ void kvm_arm_add_vcpu_properties(ARMCPU *cpu) kvm_steal_time_set);object_property_set_description (obj,"kvm-steal-time" ,"Set off to disable KVM steal time." ); + +object_property_add_str (obj,"kvm-psci-version" , kvm_get_psci_version, + kvm_set_psci_version); +object_property_set_description (obj,"kvm-psci-version" , +"Set PSCI version. " +"Valid values are 0.1, 0.2, 1.0, 1.1, 1.2, 1.3" ); }bool kvm_arm_pmu_supported (void )
target/arm/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 1946
Quoted 6 lines
target/arm/kvm.c +2
-1@@ -1883,7 +1942,8 @@ int kvm_arch_init_vcpu(CPUState *cs)if (cs->start_powered_off) { cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_POWER_OFF ; } -if (kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PSCI_0_2 )) { +if (cpu->prop_psci_version !=QEMU_PSCI_VERSION_0_1 && +kvm_check_extension (cs->kvm_state,KVM_CAP_ARM_PSCI_0_2 )) {
I don't get why this change is needed. Please can you explain?
target/arm/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 1989
Quoted 12 lines
target/arm/kvm.c +5
-0cpu->psci_version =QEMU_PSCI_VERSION_0_2 ; cpu->kvm_init_features[0 ] |=1 <<KVM_ARM_VCPU_PSCI_0_2 ; }@@ -1922,6 +1982,14 @@ int kvm_arch_init_vcpu(CPUState *cs) } } +if (cpu->prop_psci_version) { + psciver = cpu->prop_psci_version; + ret =kvm_set_one_reg (cs,KVM_REG_ARM_PSCI_VERSION , &psciver); +if (ret) { +error_report ("PSCI version %lx is not supported by KVM" , psciver);
don't you need a PRIx64 here?
target/arm/kvm.c int kvm_arch_init_vcpu(CPUState *cs) · line 1995
Quoted 6 lines
target/arm/kvm.c +3
-0+return ret; + } + }/* * KVM reports the exact PSCI version it is implementing via a * special sysreg. If it is present, use its contents to determine
Thanks
Eric
Re: [PATCH 2/2] target/arm/kvm: add kvm-psci-version vcpu property
In reply to Sebastian OttQuoted 90 lines · Sebastian Ott
Provide a kvm specific vcpu property to override the default (as of kernel v6.13 that would be PSCI v1.3) PSCI version emulated by kvm. Current valid values are: 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3
Signed-off-by Sebastian Ott <[email protected]>--- docs/system/arm/cpu-features.rst | 5 +++ target/arm/cpu.h | 6 +++ target/arm/kvm.c | 70 +++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 1 deletion(-)docs/system/arm/cpu-features.rst +5
-0@@ -204,6 +204,11 @@ the list of KVM VCPU features and their descriptions. the guest scheduler behavior and/or be exposed to the guest userspace. +``kvm-psci-version`` + Override the default (as of kernel v6.13 that would be PSCI v1.3) + PSCI version emulated by the kernel. Current valid values are: + 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3 + TCG VCPU Features =================target/arm/cpu.h +6
-0@@ -974,6 +974,12 @@ struct ArchCPU {*/ uint32_t psci_version; +/* +* Intermediate value used during property parsing. +* Once finalized, the value should be read from psci_version. +*/ +uint32_t prop_psci_version; +/* Current power state, access guarded by BQL */ ARMPSCIState power_state;target/arm/kvm.c +37
-0@@ -483,6 +483,59 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)ARM_CPU (obj)->kvm_steal_time = value ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ; } +static char *kvm_get_psci_version (Object *obj,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); +const char *val; + +switch (cpu->prop_psci_version) { +case QEMU_PSCI_VERSION_0_1 : + val ="0.1" ; +break ; +case QEMU_PSCI_VERSION_0_2 : + val ="0.2" ; +break ; +case QEMU_PSCI_VERSION_1_0 : + val ="1.0" ; +break ; +case QEMU_PSCI_VERSION_1_1 : + val ="1.1" ; +break ; +case QEMU_PSCI_VERSION_1_2 : + val ="1.2" ; +break ; +case QEMU_PSCI_VERSION_1_3 : + val ="1.3" ; +break ; +default : + val ="0.2" ; +break ; + } +return g_strdup (val); +} + +static void kvm_set_psci_version (Object *obj,const char *value,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); + +if (!strcmp (value,"0.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_1 ;
target/arm/kvm.c static void kvm_steal_time_set(Object *obj, bool value, Error **errp) · line 532
Quoted 10 lines
target/arm/kvm.c +10
-0+ }else if (!strcmp (value,"0.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_2 ; + }else if (!strcmp (value,"1.0" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_0 ; + }else if (!strcmp (value,"1.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_1 ; + }else if (!strcmp (value,"1.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_2 ; + }else if (!strcmp (value,"1.3" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_3 ;
We already have six values here and it's not implausible we might end up with more in future; maybe we should make the mapping between string and constant data-driven rather than having code written out longhand in the get and set functions?
target/arm/kvm.c static void kvm_steal_time_set(Object *obj, bool value, Error **errp) · line 537
Quoted 5 lines
target/arm/kvm.c +5
-0+ }else { +error_setg (errp,"Invalid PSCI-version value" ); +error_append_hint (errp,"Valid values are 0.1, 0.2, 1.0, 1.1, 1.2, 1.3\n" ); + } +}
thanks
-- PMM
Re: [PATCH 2/2] target/arm/kvm: add kvm-psci-version vcpu property
Quoted 99 lines · Peter Maydell
Quoted 98 lines · Sebastian Ott
Provide a kvm specific vcpu property to override the default (as of kernel v6.13 that would be PSCI v1.3) PSCI version emulated by kvm. Current valid values are: 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3
Signed-off-by Sebastian Ott <[email protected]>--- docs/system/arm/cpu-features.rst | 5 +++ target/arm/cpu.h | 6 +++ target/arm/kvm.c | 70 +++++++++++++++++++++++++++++++- 3 files changed, 80 insertions(+), 1 deletion(-)docs/system/arm/cpu-features.rst +5
-0@@ -204,6 +204,11 @@ the list of KVM VCPU features and their descriptions. the guest scheduler behavior and/or be exposed to the guest userspace. +``kvm-psci-version`` + Override the default (as of kernel v6.13 that would be PSCI v1.3) + PSCI version emulated by the kernel. Current valid values are: + 0.1, 0.2, 1.0, 1.1, 1.2, and 1.3 + TCG VCPU Features =================target/arm/cpu.h +6
-0@@ -974,6 +974,12 @@ struct ArchCPU {*/ uint32_t psci_version; +/* +* Intermediate value used during property parsing. +* Once finalized, the value should be read from psci_version. +*/ +uint32_t prop_psci_version; +/* Current power state, access guarded by BQL */ ARMPSCIState power_state;target/arm/kvm.c +45
-0@@ -483,6 +483,59 @@ static void kvm_steal_time_set(Object *obj, bool value, Error **errp)ARM_CPU (obj)->kvm_steal_time = value ?ON_OFF_AUTO_ON :ON_OFF_AUTO_OFF ; } +static char *kvm_get_psci_version (Object *obj,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); +const char *val; + +switch (cpu->prop_psci_version) { +case QEMU_PSCI_VERSION_0_1 : + val ="0.1" ; +break ; +case QEMU_PSCI_VERSION_0_2 : + val ="0.2" ; +break ; +case QEMU_PSCI_VERSION_1_0 : + val ="1.0" ; +break ; +case QEMU_PSCI_VERSION_1_1 : + val ="1.1" ; +break ; +case QEMU_PSCI_VERSION_1_2 : + val ="1.2" ; +break ; +case QEMU_PSCI_VERSION_1_3 : + val ="1.3" ; +break ; +default : + val ="0.2" ; +break ; + } +return g_strdup (val); +} + +static void kvm_set_psci_version (Object *obj,const char *value,Error **errp) +{ +ARMCPU *cpu =ARM_CPU (obj); + +if (!strcmp (value,"0.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_1 ; + }else if (!strcmp (value,"0.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_0_2 ; + }else if (!strcmp (value,"1.0" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_0 ; + }else if (!strcmp (value,"1.1" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_1 ; + }else if (!strcmp (value,"1.2" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_2 ;
Quoted 8 lines
target/arm/kvm.c static void kvm_steal_time_set(Object *obj, bool value, Error **errp) · line 532
Quoted 2 lines
target/arm/kvm.c +2
-0+ }else if (!strcmp (value,"1.3" )) { + cpu->prop_psci_version =QEMU_PSCI_VERSION_1_3 ;We already have six values here and it's not implausible we might end up with more in future; maybe we should make the mapping between string and constant data-driven rather than having code written out longhand in the get and set functions?
Yes, sure. I'll send out a V2.
Thanks!
Sebastian
Quoted 11 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu property
Could we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
thanks
-- PMM
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .
Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the KVM_REG_ARM_PSCI_VERSION register (for KVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3
Regards,
Sebastian
Quoted 23 lines · Sebastian Ott
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the
KVM_REG_ARM_PSCI_VERSIONregister (forKVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.
Quoted 4 lines
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3
So if the destination kernel is post that commit and the source kernel pre-dates it, do we fail migration? Or is this only a migration failure when the destination doesn't support the PSCI version we defaulted to at the source end?
thanks
-- PMM
Quoted 24 lines · Peter Maydell
Quoted 23 lines · Sebastian Ott
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the
KVM_REG_ARM_PSCI_VERSIONregister (forKVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.
Quoted 7 lines
Quoted 4 lines
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3So if the destination kernel is post that commit and the source kernel pre-dates it, do we fail migration?
This case works with current qemu without any changes, since on target qemu would write the register value it has stored from the source side (QEMU_PSCI_VERSION_1_1) and thus requests kvm on target to emulate that version.
Quoted 3 lines
Or is
this only a migration failure when the destination doesn't support the PSCI version we defaulted to at the source end?
Yes, this doesn't work with current qemu. On target qemu would write QEMU_PSCI_VERSION_1_3 to the KVM_REG_ARM_PSCI_VERSION register but that kernel doesn't know this version and the migration will fail.
With this series you could request QEMU_PSCI_VERSION_1_1 on the source kernel to allow a migration.
(For RHEL we have distro specific machine types that will use this property to handle that via compats.)
Sebastian
Quoted 39 lines · Sebastian Ott
Quoted 24 lines · Peter Maydell
Quoted 23 lines · Sebastian Ott
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the
KVM_REG_ARM_PSCI_VERSIONregister (forKVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.Quoted 7 lines
Quoted 4 lines
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3So if the destination kernel is post that commit and the source kernel pre-dates it, do we fail migration?
This case works with current qemu without any changes, since on target qemu would write the register value it has stored from the source side (
QEMU_PSCI_VERSION_1_1) and thus requests kvm on target to emulate that version.
Quoted 8 lines
Quoted 3 lines
Or is
this only a migration failure when the destination doesn't support the PSCI version we defaulted to at the source end?Yes, this doesn't work with current qemu. On target qemu would write
QEMU_PSCI_VERSION_1_3to theKVM_REG_ARM_PSCI_VERSIONregister but that kernel doesn't know this version and the migration will fail.
I was under the impression that trying to migrate backwards from a newer kernel to an older one was likely to fail for various reasons (notably "new kernel reports a new system register the old one doesn't") ? Perhaps we should think about the problem in a wider scope than just the PSCI version...
thanks
-- PMM
Quoted 49 lines · Peter Maydell
Quoted 39 lines · Sebastian Ott
Quoted 24 lines · Peter Maydell
Quoted 23 lines · Sebastian Ott
Quoted 9 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the
KVM_REG_ARM_PSCI_VERSIONregister (forKVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.Quoted 7 lines
Quoted 4 lines
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9f KVM: arm64: Add support for PSCI v1.2 and v1.3So if the destination kernel is post that commit and the source kernel pre-dates it, do we fail migration?
This case works with current qemu without any changes, since on target qemu would write the register value it has stored from the source side (
QEMU_PSCI_VERSION_1_1) and thus requests kvm on target to emulate that version.Quoted 8 lines
Quoted 3 lines
Or is
this only a migration failure when the destination doesn't support the PSCI version we defaulted to at the source end?Yes, this doesn't work with current qemu. On target qemu would write
QEMU_PSCI_VERSION_1_3to theKVM_REG_ARM_PSCI_VERSIONregister but that kernel doesn't know this version and the migration will fail.
Quoted 6 lines
I was under the impression that trying to migrate backwards from a newer kernel to an older one was likely to fail for various reasons (notably "new kernel reports a new system register the old one doesn't") ? Perhaps we should think about the problem in a wider scope than just the PSCI version...
Yes we already are ;-) See this series from Cornelia:
https://lore.kernel.org/qemu-devel/[email protected]/
And this from Eric:
https://lore.kernel.org/qemu-devel/[email protected]/
Both will help mitigate register differences for a backwards/downgrade migration.
Sebastian
Hi Peter,
Quoted 59 lines · Sebastian Ott
Quoted 51 lines · Peter Maydell
Quoted 41 lines · Sebastian Ott
Quoted 26 lines · Peter Maydell
Quoted 24 lines · Sebastian Ott
Quoted 10 lines · Peter Maydell
Quoted 8 lines · Sebastian Ott
This series adds a vcpu knob to request a specific PSCI version from KVM via the
KVM_REG_ARM_PSCI_VERSIONFW register.Note: in order to support PSCI v0.1 we need to drop vcpu initialization with
KVM_CAP_ARM_PSCI_0_2in that case. Alternatively we could limit support to versions >=0.2 .Quoted 6 lines
Quoted 3 lines
Sebastian Ott (2):
target/arm/kvm: add constants for new PSCI versions target/arm/kvm: add kvm-psci-version vcpu propertyCould we have some rationale, please? What's the use case where you might need to specify a particular PSCI version?
The use case is migrating between different host kernel versions. Per default the kernel reports the latest PSCI version in the
KVM_REG_ARM_PSCI_VERSIONregister (forKVM_CAP_ARM_PSCI_0_2) - when that differs between source and target a migration will fail.Quoted 7 lines
Quoted 4 lines
This property allows to request a PSCI version that is supported by both sides. Specifically I want to support migration between host kernels with and without the following Linux commit:
8be82d536a9fKVM: arm64: Add support for PSCI v1.2 and v1.3So if the destination kernel is post that commit and the source kernel pre-dates it, do we fail migration?
This case works with current qemu without any changes, since on target qemu would write the register value it has stored from the source side (
QEMU_PSCI_VERSION_1_1) and thus requests kvm on target to emulate that version.Quoted 8 lines
Quoted 3 lines
Or is
this only a migration failure when the destination doesn't support the PSCI version we defaulted to at the source end?Yes, this doesn't work with current qemu. On target qemu would write
QEMU_PSCI_VERSION_1_3to theKVM_REG_ARM_PSCI_VERSIONregister but that kernel doesn't know this version and the migration will fail.Quoted 6 lines
I was under the impression that trying to migrate backwards from a newer kernel to an older one was likely to fail for various reasons (notably "new kernel reports a new system register the old one doesn't") ? Perhaps we should think about the problem in a wider scope than just the PSCI version...
Quoted 7 lines
Yes we already are ;-) See this series from Cornelia:
https://lore.kernel.org/qemu-devel/[email protected]/And this from Eric:
https://lore.kernel.org/qemu-devel/[email protected]/
the above series especially handles a class of migration errors where the source host kernel exposes more KVM regs to userspace than destination host kernel. In that case, currently, the vcpu state cannot be migrated. I should have called that: mitigation of* "failed to load cpu:cpreg_vmstate_array_len" migration errors. Sebastian tries to handle a change in the default value of a pseudo FW register. We would like to have a compat to keep the old value for old machine types. Thanks Eric *
Quoted 6 lines
Both will help mitigate register differences for a backwards/downgrade migration.
Sebastian