Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2b0f981 authored by Xiao Guangrong's avatar Xiao Guangrong Committed by Paolo Bonzini
Browse files

KVM: MMU: move FNAME(is_rsvd_bits_set) to mmu.c



FNAME(is_rsvd_bits_set) does not depend on guest mmu mode, move it
to mmu.c to stop being compiled multiple times

Signed-off-by: default avatarXiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 6f691251
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -3546,6 +3546,14 @@ static inline bool is_last_gpte(struct kvm_mmu *mmu, unsigned level, unsigned gp
	return mmu->last_pte_bitmap & (1 << index);
}

static bool is_rsvd_bits_set(struct kvm_mmu *mmu, u64 gpte, int level)
{
	int bit7 = (gpte >> 7) & 1, low6 = gpte & 0x3f;

	return (gpte & mmu->rsvd_bits_mask[bit7][level-1]) |
		((mmu->bad_mt_xwr & (1ull << low6)) != 0);
}

#define PTTYPE_EPT 18 /* arbitrary */
#define PTTYPE PTTYPE_EPT
#include "paging_tmpl.h"
+2 −11
Original line number Diff line number Diff line
@@ -128,14 +128,6 @@ static inline void FNAME(protect_clean_gpte)(unsigned *access, unsigned gpte)
	*access &= mask;
}

static bool FNAME(is_rsvd_bits_set)(struct kvm_mmu *mmu, u64 gpte, int level)
{
	int bit7 = (gpte >> 7) & 1, low6 = gpte & 0x3f;

	return (gpte & mmu->rsvd_bits_mask[bit7][level-1]) |
		((mmu->bad_mt_xwr & (1ull << low6)) != 0);
}

static inline int FNAME(is_present_gpte)(unsigned long pte)
{
#if PTTYPE != PTTYPE_EPT
@@ -172,7 +164,7 @@ static bool FNAME(prefetch_invalid_gpte)(struct kvm_vcpu *vcpu,
				  struct kvm_mmu_page *sp, u64 *spte,
				  u64 gpte)
{
	if (FNAME(is_rsvd_bits_set)(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL))
	if (is_rsvd_bits_set(&vcpu->arch.mmu, gpte, PT_PAGE_TABLE_LEVEL))
		goto no_present;

	if (!FNAME(is_present_gpte)(gpte))
@@ -353,8 +345,7 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
		if (unlikely(!FNAME(is_present_gpte)(pte)))
			goto error;

		if (unlikely(FNAME(is_rsvd_bits_set)(mmu, pte,
					             walker->level))) {
		if (unlikely(is_rsvd_bits_set(mmu, pte, walker->level))) {
			errcode |= PFERR_RSVD_MASK | PFERR_PRESENT_MASK;
			goto error;
		}