Re: [PATCH v7 05/12] KVM: guest_memfd: Add flag to remove from direct map
From: Mike Rapoport
Date: Sat Nov 01 2025 - 05:39:45 EST
On Fri, Oct 31, 2025 at 05:30:12PM +0000, Brendan Jackman wrote:
> On Wed Sep 24, 2025 at 3:22 PM UTC, Patrick Roy wrote:
> > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
> > index 1d0585616aa3..73a15cade54a 100644
> > --- a/include/linux/kvm_host.h
> > +++ b/include/linux/kvm_host.h
> > @@ -731,6 +731,12 @@ static inline bool kvm_arch_has_private_mem(struct kvm *kvm)
> > bool kvm_arch_supports_gmem_mmap(struct kvm *kvm);
> > #endif
> >
> > +#ifdef CONFIG_KVM_GUEST_MEMFD
> > +#ifndef kvm_arch_gmem_supports_no_direct_map
> > +#define kvm_arch_gmem_supports_no_direct_map can_set_direct_map
> > +#endif
> > +#endif /* CONFIG_KVM_GUEST_MEMFD */
>
> The test robot seems happy so I think I'm probably mistaken here, but
> AFAICS can_set_direct_map only exists when ARCH_HAS_SET_DIRECT_MAP,
> which powerpc doesn't set.
We have stubs returning 0 for architectures that don't have
ARCH_HAS_SET_DIRECT_MAP.
> If this is indeed an issue I think it can be fixed by just defining
> can_set_direct_map() to false when !ARCH_HAS_SET_DIRECT_MAP.
--
Sincerely yours,
Mike.