@@ -73,6 +73,9 @@ typedef u64 kvm_pte_t;
KVM_PTE_LEAF_ATTR_LO_S2_S2AP_W | \
KVM_PTE_LEAF_ATTR_HI_S2_XN)
+#define KVM_PTE_LEAF_ATTRS (KVM_PTE_LEAF_ATTR_LO | \
+ KVM_PTE_LEAF_ATTR_HI)
+
#define KVM_PTE_ADDR_MASK GENMASK(47, PAGE_SHIFT)
#define KVM_PTE_ADDR_51_48 GENMASK(15, 12)
@@ -111,7 +111,7 @@ static kvm_pte_t kvm_init_valid_leaf_pte(u64 pa, kvm_pte_t attr, u32 level)
u64 type = (level == KVM_PGTABLE_MAX_LEVELS - 1) ? KVM_PTE_TYPE_PAGE :
KVM_PTE_TYPE_BLOCK;
- pte |= attr & (KVM_PTE_LEAF_ATTR_LO | KVM_PTE_LEAF_ATTR_HI);
+ pte |= attr & KVM_PTE_LEAF_ATTRS;
pte |= FIELD_PREP(KVM_PTE_TYPE, type);
pte |= KVM_PTE_VALID;
@@ -1027,10 +1027,9 @@ static int stage2_update_leaf_attrs(struct kvm_pgtable *pgt, u64 addr,
u32 *level, enum kvm_pgtable_walk_flags flags)
{
int ret;
- kvm_pte_t attr_mask = KVM_PTE_LEAF_ATTR_LO | KVM_PTE_LEAF_ATTR_HI;
struct stage2_attr_data data = {
- .attr_set = attr_set & attr_mask,
- .attr_clr = attr_clr & attr_mask,
+ .attr_set = attr_set & KVM_PTE_LEAF_ATTRS,
+ .attr_clr = attr_clr & KVM_PTE_LEAF_ATTRS,
};
struct kvm_pgtable_walker walker = {
.cb = stage2_attr_walker,
No functional change intended. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> --- arch/arm64/include/asm/kvm_pgtable.h | 3 +++ arch/arm64/kvm/hyp/pgtable.c | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-)