[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a2aacca8-cc70-451c-be2b-44911ca3caaa@redhat.com>
Date: Wed, 21 May 2025 15:17:26 +0200
From: David Hildenbrand <david@...hat.com>
To: ankita@...dia.com, jgg@...dia.com, maz@...nel.org,
oliver.upton@...ux.dev, joey.gouly@....com, suzuki.poulose@....com,
yuzenghui@...wei.com, catalin.marinas@....com, will@...nel.org,
ryan.roberts@....com, shahuang@...hat.com, lpieralisi@...nel.org
Cc: aniketa@...dia.com, cjia@...dia.com, kwankhede@...dia.com,
kjaju@...dia.com, targupta@...dia.com, vsethi@...dia.com,
acurrid@...dia.com, apopple@...dia.com, jhubbard@...dia.com,
danw@...dia.com, zhiw@...dia.com, mochs@...dia.com, udhoke@...dia.com,
dnigam@...dia.com, alex.williamson@...hat.com, sebastianene@...gle.com,
coltonlewis@...gle.com, kevin.tian@...el.com, yi.l.liu@...el.com,
ardb@...nel.org, akpm@...ux-foundation.org, gshan@...hat.com,
linux-mm@...ck.org, ddutile@...hat.com, tabba@...gle.com,
qperret@...gle.com, seanjc@...gle.com, kvmarm@...ts.linux.dev,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
maobibo@...ngson.cn
Subject: Re: [PATCH v4 3/5] kvm: arm64: New memslot flag to indicate cacheable
mapping
On 18.05.25 07:47, ankita@...dia.com wrote:
> From: Ankit Agrawal <ankita@...dia.com>
>
> Introduce a new memslot flag KVM_MEM_ENABLE_CACHEABLE_PFNMAP
> as a tool for userspace to indicate that it expects a particular
> PFN range to be mapped cacheable.
>
> This will serve as a guide for the KVM to activate the code that
> allows cacheable PFNMAP.
>
> CC: Oliver Upton <oliver.upton@...ux.dev>
> CC: Catalin Marinas <catalin.marinas@....com>
> CC: Jason Gunthorpe <jgg@...dia.com>
> Suggested-by: Marc Zyngier <maz@...nel.org>
> Signed-off-by: Ankit Agrawal <ankita@...dia.com>
> ---
> include/uapi/linux/kvm.h | 1 +
> virt/kvm/kvm_main.c | 6 ++++--
> 2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
> index b6ae8ad8934b..9defefe7bdf0 100644
> --- a/include/uapi/linux/kvm.h
> +++ b/include/uapi/linux/kvm.h
> @@ -51,6 +51,7 @@ struct kvm_userspace_memory_region2 {
> #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0)
> #define KVM_MEM_READONLY (1UL << 1)
> #define KVM_MEM_GUEST_MEMFD (1UL << 2)
> +#define KVM_MEM_ENABLE_CACHEABLE_PFNMAP (1UL << 3)
>
> /* for KVM_IRQ_LINE */
> struct kvm_irq_level {
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index e85b33a92624..a3e77fe57cc4 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1524,12 +1524,14 @@ static void kvm_replace_memslot(struct kvm *kvm,
> * only allows these.
> */
> #define KVM_SET_USER_MEMORY_REGION_V1_FLAGS \
> - (KVM_MEM_LOG_DIRTY_PAGES | KVM_MEM_READONLY)
> + (KVM_MEM_LOG_DIRTY_PAGES | KVM_MEM_READONLY | \
> + KVM_MEM_ENABLE_CACHEABLE_PFNMAP)
>
> static int check_memory_region_flags(struct kvm *kvm,
> const struct kvm_userspace_memory_region2 *mem)
> {
> - u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES;
> + u32 valid_flags = KVM_MEM_LOG_DIRTY_PAGES |
> + KVM_MEM_ENABLE_CACHEABLE_PFNMAP;
Should we have some kind of kvm_arch_supports ... check? Because anybody
else except arm64 will not respect this?
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists