From: David Woodhouse <[email protected]> The memory-attributes backport uses the ACC_* masks in mmu_internal.h, which cannot include spte.h because spte.h includes *it*. Anything pulling in mmu_internal.h without spte.h (debugfs.c, page_track.c) now fails to build.
Move the ACC_* definitions to mmu.h, next to the PT_WRITABLE_MASK and PT_USER_MASK definitions they are built from. Both headers already include it. Signed-off-by: David Woodhouse <[email protected]> Assisted-by: LLM --- arch/x86/kvm/mmu.h | 14 ++++++++++++++ arch/x86/kvm/mmu/spte.h | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/arch/x86/kvm/mmu.h b/arch/x86/kvm/mmu.h index 830f46145692..ae1068169925 100644 --- a/arch/x86/kvm/mmu.h +++ b/arch/x86/kvm/mmu.h @@ -32,6 +32,20 @@ extern bool __read_mostly enable_mmio_caching; #define PT_DIR_PAT_SHIFT 12 #define PT_DIR_PAT_MASK (1ULL << PT_DIR_PAT_SHIFT) +#define ACC_EXEC_MASK 1 +#define ACC_WRITE_MASK PT_WRITABLE_MASK +#define ACC_USER_MASK PT_USER_MASK +#define ACC_ALL (ACC_EXEC_MASK | ACC_WRITE_MASK | ACC_USER_MASK) + +/* + * Read permission for a gfn's memory protection attributes. Not part of + * ACC_ALL and never set in a PTE's access mask: PTE formats cannot express + * no-read, and x86 rejects protection attributes that forbid only read + * (kvm_arch_mem_attributes_supported_prot()), so a no-read gfn always + * takes a memory fault exit before any SPTE is created. + */ +#define ACC_READ_MASK BIT(3) + #define PT64_ROOT_5LEVEL 5 #define PT64_ROOT_4LEVEL 4 #define PT32_ROOT_LEVEL 2 diff --git a/arch/x86/kvm/mmu/spte.h b/arch/x86/kvm/mmu/spte.h index 217f6b40c50b..511aa0e0e222 100644 --- a/arch/x86/kvm/mmu/spte.h +++ b/arch/x86/kvm/mmu/spte.h @@ -45,20 +45,6 @@ static_assert(SPTE_TDP_AD_ENABLED == 0); #define SPTE_PERM_MASK (PT_PRESENT_MASK | PT_WRITABLE_MASK | shadow_user_mask \ | shadow_x_mask | shadow_nx_mask | shadow_me_mask) -#define ACC_EXEC_MASK 1 -#define ACC_WRITE_MASK PT_WRITABLE_MASK -#define ACC_USER_MASK PT_USER_MASK -#define ACC_ALL (ACC_EXEC_MASK | ACC_WRITE_MASK | ACC_USER_MASK) - -/* - * Read permission for a gfn's memory protection attributes. Not part of - * ACC_ALL and never set in a PTE's access mask: PTE formats cannot express - * no-read, and x86 rejects protection attributes that forbid only read - * (kvm_arch_mem_attributes_supported_prot()), so a no-read gfn always - * takes a memory fault exit before any SPTE is created. - */ -#define ACC_READ_MASK BIT(3) - /* The mask for the R/X bits in EPT PTEs */ #define SPTE_EPT_READABLE_MASK 0x1ull #define SPTE_EPT_EXECUTABLE_MASK 0x4ull -- 2.50.1

