From 75a8a2c657ef0ba950304429b89f31180d634e19 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 24 Nov 2022 11:38:28 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Use 32-bit function ID for PSCI MEM_PROTECT call The PSCI specification defines only a 32-bit function ID for the MEM_PROTECT call used to protect against cold reboot attacks. Fix the pKVM hypervisor invocation of MEM_PROTECT to use the 32-bit function ID instead of the unallocated 64-bit flavour. Bug: 260316363 Signed-off-by: Will Deacon Change-Id: I675a57419064f7f006960ca5370e9dc2d5279a90 --- arch/arm64/kvm/hyp/nvhe/psci-relay.c | 2 +- include/uapi/linux/psci.h | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/psci-relay.c b/arch/arm64/kvm/hyp/nvhe/psci-relay.c index 1a4d2a67b813..81aa189d4ca6 100644 --- a/arch/arm64/kvm/hyp/nvhe/psci-relay.c +++ b/arch/arm64/kvm/hyp/nvhe/psci-relay.c @@ -235,7 +235,7 @@ static u64 psci_mem_protect(s64 offset) return cnt; if (!cnt || !new) - psci_call(PSCI_1_1_FN64_MEM_PROTECT, offset < 0 ? 0 : 1, 0, 0); + psci_call(PSCI_1_1_FN_MEM_PROTECT, offset < 0 ? 0 : 1, 0, 0); cnt = new; return cnt; diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index b1484a5a3c36..1529f3154d5d 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -51,12 +51,11 @@ #define PSCI_1_0_FN_SYSTEM_SUSPEND PSCI_0_2_FN(14) #define PSCI_1_0_FN_SET_SUSPEND_MODE PSCI_0_2_FN(15) #define PSCI_1_1_FN_SYSTEM_RESET2 PSCI_0_2_FN(18) +#define PSCI_1_1_FN_MEM_PROTECT PSCI_0_2_FN(19) #define PSCI_1_0_FN64_SYSTEM_SUSPEND PSCI_0_2_FN64(14) #define PSCI_1_1_FN64_SYSTEM_RESET2 PSCI_0_2_FN64(18) -#define PSCI_1_1_FN64_MEM_PROTECT PSCI_0_2_FN64(19) - /* PSCI v0.2 power state encoding for CPU_SUSPEND function */ #define PSCI_0_2_POWER_STATE_ID_MASK 0xffff #define PSCI_0_2_POWER_STATE_ID_SHIFT 0