[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 02/70] RAMBlock: Add support of KVM private guest memfd
From: |
Isaku Yamahata |
Subject: |
Re: [PATCH v3 02/70] RAMBlock: Add support of KVM private guest memfd |
Date: |
Fri, 17 Nov 2023 12:35:28 -0800 |
On Wed, Nov 15, 2023 at 02:14:11AM -0500,
Xiaoyao Li <xiaoyao.li@intel.com> wrote:
> diff --git a/system/physmem.c b/system/physmem.c
> index fc2b0fee0188..0af2213cbd9c 100644
> --- a/system/physmem.c
> +++ b/system/physmem.c
> @@ -1841,6 +1841,20 @@ static void ram_block_add(RAMBlock *new_block, Error
> **errp)
> }
> }
>
> +#ifdef CONFIG_KVM
> + if (kvm_enabled() && new_block->flags & RAM_GUEST_MEMFD &&
> + new_block->guest_memfd < 0) {
> + /* TODO: to decide if KVM_GUEST_MEMFD_ALLOW_HUGEPAGE is supported */
> + uint64_t flags = 0;
> + new_block->guest_memfd =
> kvm_create_guest_memfd(new_block->max_length,
> + flags, errp);
> + if (new_block->guest_memfd < 0) {
> + qemu_mutex_unlock_ramlist();
> + return;
> + }
> + }
> +#endif
> +
We should define kvm_create_guest_memfd() stub in accel/stub/kvm-stub.c.
We can remove this #ifdef.
--
Isaku Yamahata <isaku.yamahata@linux.intel.com>
[PATCH v3 03/70] RAMBlock/guest_memfd: Enable KVM_GUEST_MEMFD_ALLOW_HUGEPAGE, Xiaoyao Li, 2023/11/15