From 756818ff776b376033eb9a869801cc336e676fe2 Mon Sep 17 00:00:00 2001 From: Vincent Donnefort Date: Thu, 26 Jan 2023 09:48:24 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Fix PKVM_PAGE_RESTRICTED_PROT conflict Currently, PKVM_PAGE_RESTRICTED_PROT == __PKVM_PAGE_RESERVED + 2, i.e. BIT(55) | BIT(56) | BIT(1). IOW, It is not possible to distinguish RESTRICTED from ownership. Make PKVM_PAGE_RESTRICTED_PROT the second bit of pkvm_page_state so it can be combined with the ownership status. Bug: 244543039 Bug: 244373730 Change-Id: Iee9b84d4f07fca323b35e2d7da54f3657ae2cff9 Signed-off-by: Vincent Donnefort (cherry picked from commit 39176c9df038a14bc114a0dda74c1cb49f2e3db0) --- arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h index 55192b4d835f..ef1573d26036 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h +++ b/arch/arm64/kvm/hyp/include/nvhe/mem_protect.h @@ -30,8 +30,8 @@ enum pkvm_page_state { KVM_PGTABLE_PROT_SW1, /* Meta-states which aren't encoded directly in the PTE's SW bits */ - PKVM_NOPAGE, - PKVM_PAGE_RESTRICTED_PROT, + PKVM_NOPAGE = BIT(0), + PKVM_PAGE_RESTRICTED_PROT = BIT(1), }; #define PKVM_PAGE_STATE_PROT_MASK (KVM_PGTABLE_PROT_SW0 | KVM_PGTABLE_PROT_SW1)