KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations
PATCH 1/1 KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations
pKVM initialization fails on systems with v1.1+ FF-A implementations, as the hyp does a strict match on the returned version from FFA_VERSION. This is a stronger assertion than required by the specification, which requires minor revisions be backwards compatible with earlier revisions of the same major version.
Relax the check in hyp_ffa_init() to only test the returned major version. Even though v1.1 broke ABI, the expectation is that firmware incapable of using the v1.0 ABI return NOT_SUPPORTED instead of a valid version.
--- arch/arm64/kvm/hyp/nvhe/ffa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
arch/arm64/kvm/hyp/nvhe/ffa.c +14 -1
@@ -705,7 +705,20 @@ int hyp_ffa_init(void *pages)if (res.a0 ==FFA_RET_NOT_SUPPORTED )return 0 ; -if (res.a0 !=FFA_VERSION_1_0 ) +/* +* Firmware returns the maximum supported version of the FF-A +* implementation. Check that the returned version is +* backwards-compatible with the hyp according to the rules in DEN0077A +* v1.1 REL0 13.2.1. +* +* Of course, things are never simple when dealing with firmware. v1.1 +* broke ABI with v1.0 on several structures, which is itself +* incompatible with the aforementioned versioning scheme. The +* expectation is that v1.x implementations that do not support the v1.0 +* ABI return NOT_SUPPORTED rather than a version number, according to +* DEN0077A v1.1 REL0 18.6.4. +*/ +if (FFA_MAJOR_VERSION (res.a0) !=1 )return -EOPNOTSUPP ;arm_smccc_1_1_smc (FFA_ID_GET ,0 ,0 ,0 ,0 ,0 ,0 ,0 , &res);
base-commit: 9d2a55b403eea26cab7c831d8e1c00ef1e6a6850
Signature · 1 line
2.41.0.255.g8b1d071c50-goog
Quoted 28 lines · Oliver Upton
pKVM initialization fails on systems with v1.1+ FF-A implementations, as the hyp does a strict match on the returned version from
FFA_VERSION. This is a stronger assertion than required by the specification, which requires minor revisions be backwards compatible with earlier revisions of the same major version.Relax the check in
hyp_ffa_init()to only test the returned major version. Even though v1.1 broke ABI, the expectation is that firmware incapable of using the v1.0 ABI returnNOT_SUPPORTEDinstead of a valid version.Signed-off-by Oliver Upton <[email protected]>--- arch/arm64/kvm/hyp/nvhe/ffa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)arch/arm64/kvm/hyp/nvhe/ffa.c +2
-1@@ -705,7 +705,20 @@ int hyp_ffa_init(void *pages)if (res.a0 ==FFA_RET_NOT_SUPPORTED )return 0 ; -if (res.a0 !=FFA_VERSION_1_0 ) +/* +* Firmware returns the maximum supported version of the FF-A
arch/arm64/kvm/hyp/nvhe/ffa.c int hyp_ffa_init(void *pages) · line 719
Quoted 10 lines
arch/arm64/kvm/hyp/nvhe/ffa.c +10
-0+* implementation. Check that the returned version is +* backwards-compatible with the hyp according to the rules in DEN0077A +* v1.1 REL0 13.2.1. +* +* Of course, things are never simple when dealing with firmware. v1.1 +* broke ABI with v1.0 on several structures, which is itself +* incompatible with the aforementioned versioning scheme. The +* expectation is that v1.x implementations that do not support the v1.0 +* ABI return NOT_SUPPORTED rather than a version number, according to +* DEN0077A v1.1 REL0 18.6.4.
To quote someone: "What a great!"
Quoted 7 lines
arch/arm64/kvm/hyp/nvhe/ffa.c +2
-0+*/ +if (FFA_MAJOR_VERSION (res.a0) !=1 )return -EOPNOTSUPP ;arm_smccc_1_1_smc (FFA_ID_GET ,0 ,0 ,0 ,0 ,0 ,0 ,0 , &res);base-commit:
9d2a55b403eea26cab7c831d8e1c00ef1e6a6850
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Quoted 32 lines · Oliver Upton
pKVM initialization fails on systems with v1.1+ FF-A implementations, as the hyp does a strict match on the returned version from
FFA_VERSION. This is a stronger assertion than required by the specification, which requires minor revisions be backwards compatible with earlier revisions of the same major version.Relax the check in
hyp_ffa_init()to only test the returned major version. Even though v1.1 broke ABI, the expectation is that firmware incapable of using the v1.0 ABI returnNOT_SUPPORTEDinstead of a valid version.Signed-off-by Oliver Upton <[email protected]>--- arch/arm64/kvm/hyp/nvhe/ffa.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)arch/arm64/kvm/hyp/nvhe/ffa.c +7
-1@@ -705,7 +705,20 @@ int hyp_ffa_init(void *pages)if (res.a0 ==FFA_RET_NOT_SUPPORTED )return 0 ; -if (res.a0 !=FFA_VERSION_1_0 ) +/* +* Firmware returns the maximum supported version of the FF-A +* implementation. Check that the returned version is +* backwards-compatible with the hyp according to the rules in DEN0077A +* v1.1 REL0 13.2.1. +* +* Of course, things are never simple when dealing with firmware. v1.1
arch/arm64/kvm/hyp/nvhe/ffa.c int hyp_ffa_init(void *pages) · line 724
Quoted 10 lines
arch/arm64/kvm/hyp/nvhe/ffa.c +7
-0+* broke ABI with v1.0 on several structures, which is itself +* incompatible with the aforementioned versioning scheme. The +* expectation is that v1.x implementations that do not support the v1.0 +* ABI return NOT_SUPPORTED rather than a version number, according to +* DEN0077A v1.1 REL0 18.6.4. +*/ +if (FFA_MAJOR_VERSION (res.a0) !=1 )return -EOPNOTSUPP ;arm_smccc_1_1_smc (FFA_ID_GET ,0 ,0 ,0 ,0 ,0 ,0 ,0 , &res);
Hopefully firmware gets this right!
Will
Oliver Upton
AppliedQuoted 6 lines · Oliver Upton
pKVM initialization fails on systems with v1.1+ FF-A implementations, as the hyp does a strict match on the returned version from
FFA_VERSION. This is a stronger assertion than required by the specification, which requires minor revisions be backwards compatible with earlier revisions of the same major version.
Quoted 6 lines
Relax the check in
hyp_ffa_init()to only test the returned major version. Even though v1.1 broke ABI, the expectation is that firmware incapable of using the v1.0 ABI returnNOT_SUPPORTEDinstead of a valid version.[...]
Applied to kvmarm/fixes, thanks!
[1/1] KVM: arm64: Allow pKVM on v1.0 compatible FF-A implementations
https://git.kernel.org/kvmarm/kvmarm/c/84f686790321
--
Best,
Oliver