[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y5PFnQBfjSCOVLTL@google.com>
Date: Fri, 9 Dec 2022 15:32:45 -0800
From: David Matlack <dmatlack@...gle.com>
To: Ben Gardon <bgardon@...gle.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
Paolo Bonzini <pbonzini@...hat.com>,
Peter Xu <peterx@...hat.com>,
Sean Christopherson <seanjc@...gle.com>,
Vipin Sharma <vipinsh@...gle.com>
Subject: Re: [PATCH 3/7] KVM: x86/MMU: Move gfn_to_rmap() to rmap.c
On Tue, Dec 06, 2022 at 05:35:57PM +0000, Ben Gardon wrote:
> Move gfn_to_rmap() to rmap.c. While the function is not part of
> manipulating the rmap, it is the main way that the MMU gets pointers to
> the rmaps.
>
> No functional change intended.
>
> Signed-off-by: Ben Gardon <bgardon@...gle.com>
> ---
[...]
> diff --git a/arch/x86/kvm/mmu/rmap.c b/arch/x86/kvm/mmu/rmap.c
> index c3bad366b627..272e89147d96 100644
> --- a/arch/x86/kvm/mmu/rmap.c
> +++ b/arch/x86/kvm/mmu/rmap.c
> @@ -200,3 +200,11 @@ u64 *rmap_get_next(struct rmap_iterator *iter)
> return sptep;
> }
>
> +struct kvm_rmap_head *gfn_to_rmap(gfn_t gfn, int level,
> + const struct kvm_memory_slot *slot)
> +{
> + unsigned long idx;
> +
> + idx = gfn_to_index(gfn, slot->base_gfn, level);
> + return &slot->arch.rmap[level - PG_LEVEL_4K][idx];
> +}
Optional: Since this is such a short function maybe just make it a
static inline in rmap.h?
Powered by blists - more mailing lists