Files
android_kernel_xiaomi_sm8450/include/linux
Stephen Boyd 1de111b51b KVM: arm64: ARM_SMCCC_ARCH_WORKAROUND_1 doesn't return SMCCC_RET_NOT_REQUIRED
According to the SMCCC spec[1](7.5.2 Discovery) the
ARM_SMCCC_ARCH_WORKAROUND_1 function id only returns 0, 1, and
SMCCC_RET_NOT_SUPPORTED.

 0 is "workaround required and safe to call this function"
 1 is "workaround not required but safe to call this function"
 SMCCC_RET_NOT_SUPPORTED is "might be vulnerable or might not be, who knows, I give up!"

SMCCC_RET_NOT_SUPPORTED might as well mean "workaround required, except
calling this function may not work because it isn't implemented in some
cases". Wonderful. We map this SMC call to

 0 is SPECTRE_MITIGATED
 1 is SPECTRE_UNAFFECTED
 SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE

For KVM hypercalls (hvc), we've implemented this function id to return
SMCCC_RET_NOT_SUPPORTED, 0, and SMCCC_RET_NOT_REQUIRED. One of those
isn't supposed to be there. Per the code we call
arm64_get_spectre_v2_state() to figure out what to return for this
feature discovery call.

 0 is SPECTRE_MITIGATED
 SMCCC_RET_NOT_REQUIRED is SPECTRE_UNAFFECTED
 SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE

Let's clean this up so that KVM tells the guest this mapping:

 0 is SPECTRE_MITIGATED
 1 is SPECTRE_UNAFFECTED
 SMCCC_RET_NOT_SUPPORTED is SPECTRE_VULNERABLE

Note: SMCCC_RET_NOT_AFFECTED is 1 but isn't part of the SMCCC spec

Fixes: c118bbb527 ("arm64: KVM: Propagate full Spectre v2 workaround state to KVM guests")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Cc: Andre Przywara <andre.przywara@arm.com>
Cc: Steven Price <steven.price@arm.com>
Cc: Marc Zyngier <maz@kernel.org>
Cc: stable@vger.kernel.org
Link: https://developer.arm.com/documentation/den0028/latest [1]
Link: https://lore.kernel.org/r/20201023154751.1973872-1-swboyd@chromium.org
Signed-off-by: Will Deacon <will@kernel.org>
2020-10-28 11:13:36 +00:00
..
2020-10-12 10:06:39 +02:00
2020-06-25 22:25:13 -07:00
2020-06-16 14:19:57 +02:00
2020-07-21 08:24:52 -05:00
2020-07-08 10:48:35 -07:00
2020-10-02 14:59:25 -07:00
2020-09-21 15:00:40 -07:00
2020-10-02 15:00:49 -07:00
2020-10-16 17:21:51 +02:00
2020-06-16 19:25:20 +02:00
2020-07-27 14:29:23 -04:00
2020-08-12 20:42:08 +02:00
2020-06-17 00:07:38 +02:00
2020-09-30 22:44:26 +02:00
2020-07-24 17:12:41 -07:00
2020-08-04 21:02:38 -04:00
2020-09-16 08:54:53 -05:00
2020-08-26 12:41:56 +02:00
2020-10-21 23:22:37 -04:00
2020-10-13 18:38:32 -07:00
2020-09-04 09:25:20 -07:00
2020-09-23 18:02:49 -07:00
2020-10-18 09:27:09 -07:00
2020-09-04 12:46:07 +01:00
2020-08-27 16:06:47 -04:00
2020-10-07 14:28:39 -04:00
2020-07-01 10:49:02 +02:00
2020-09-24 19:49:36 -07:00
2020-07-23 17:34:18 +10:00
2020-08-31 12:52:33 -07:00
2020-09-23 18:02:49 -07:00
2020-10-18 09:27:10 -07:00
2020-08-18 17:06:15 +02:00
2020-07-16 23:19:51 +02:00
2020-09-01 14:18:28 +02:00
2020-08-07 11:33:24 -07:00
2020-09-26 22:55:05 -04:00
2020-07-04 09:35:36 -05:00
2020-09-10 14:03:31 -07:00
2020-07-07 11:58:59 -05:00
2020-08-01 11:28:17 +02:00
2020-10-18 09:27:10 -07:00
2020-10-05 13:21:49 +02:00