All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Peter Xu <peterx@redhat.com>, qemu-devel@nongnu.org
Cc: Juraj Marcin <jmarcin@redhat.com>,
	David Hildenbrand <david@kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Chenyi Qiang <chenyi.qiang@intel.com>,
	Fabiano Rosas <farosas@suse.de>,
	Alexey Kardashevskiy <aik@amd.com>
Subject: Re: [PATCH v3 09/12] machine: Rename machine_require_guest_memfd() to *_private()
Date: Tue, 16 Dec 2025 14:55:56 +0800	[thread overview]
Message-ID: <4616e61e-fd49-4e94-aa03-93bdfb457a87@intel.com> (raw)
In-Reply-To: <20251215205203.1185099-10-peterx@redhat.com>

On 12/16/2025 4:52 AM, Peter Xu wrote:
> Differenciate it from fully shared guest-memfd use cases.
> 
> When at it, add proper brackets in kvm_handle_hc_map_gpa_range() otherwise
> checkpatch may complain.
> 
> Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   include/hw/boards.h   | 2 +-
>   backends/hostmem.c    | 2 +-
>   hw/core/machine.c     | 2 +-
>   hw/i386/pc.c          | 2 +-
>   hw/i386/pc_sysfw.c    | 4 ++--
>   hw/i386/x86-common.c  | 4 ++--
>   target/i386/kvm/kvm.c | 3 ++-
>   7 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index a48ed4f86a..3a0a051d19 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -42,7 +42,7 @@ bool machine_usb(MachineState *machine);
>   int machine_phandle_start(MachineState *machine);
>   bool machine_dump_guest_core(MachineState *machine);
>   bool machine_mem_merge(MachineState *machine);
> -bool machine_require_guest_memfd(MachineState *machine);
> +bool machine_require_guest_memfd_private(MachineState *machine);
>   HotpluggableCPUList *machine_query_hotpluggable_cpus(MachineState *machine);
>   void machine_set_cpu_numa_node(MachineState *machine,
>                                  const CpuInstanceProperties *props,
> diff --git a/backends/hostmem.c b/backends/hostmem.c
> index 70450733db..e2dcae50c4 100644
> --- a/backends/hostmem.c
> +++ b/backends/hostmem.c
> @@ -288,7 +288,7 @@ static void host_memory_backend_init(Object *obj)
>       /* TODO: convert access to globals to compat properties */
>       backend->merge = machine_mem_merge(machine);
>       backend->dump = machine_dump_guest_core(machine);
> -    backend->guest_memfd_private = machine_require_guest_memfd(machine);
> +    backend->guest_memfd_private = machine_require_guest_memfd_private(machine);
>       backend->reserve = true;
>       backend->prealloc_threads = machine->smp.cpus;
>   }
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index 27372bb01e..3bdce197f7 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -1376,7 +1376,7 @@ bool machine_mem_merge(MachineState *machine)
>       return machine->mem_merge;
>   }
>   
> -bool machine_require_guest_memfd(MachineState *machine)
> +bool machine_require_guest_memfd_private(MachineState *machine)
>   {
>       return machine->cgs && machine->cgs->require_guest_memfd;
>   }
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index f8b919cb6c..b2d55ceb5e 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -962,7 +962,7 @@ void pc_memory_init(PCMachineState *pcms,
>   
>       if (!is_tdx_vm()) {
>           option_rom_mr = g_malloc(sizeof(*option_rom_mr));
> -        if (machine_require_guest_memfd(machine)) {
> +        if (machine_require_guest_memfd_private(machine)) {
>               memory_region_init_ram_guest_memfd(option_rom_mr, NULL, "pc.rom",
>                                               PC_ROM_SIZE, &error_fatal);
>           } else {
> diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
> index 1a12b635ad..1c37258654 100644
> --- a/hw/i386/pc_sysfw.c
> +++ b/hw/i386/pc_sysfw.c
> @@ -52,7 +52,7 @@ static void pc_isa_bios_init(PCMachineState *pcms, MemoryRegion *isa_bios,
>   
>       /* map the last 128KB of the BIOS in ISA space */
>       isa_bios_size = MIN(flash_size, 128 * KiB);
> -    if (machine_require_guest_memfd(MACHINE(pcms))) {
> +    if (machine_require_guest_memfd_private(MACHINE(pcms))) {
>           memory_region_init_ram_guest_memfd(isa_bios, NULL, "isa-bios",
>                                              isa_bios_size, &error_fatal);
>       } else {
> @@ -71,7 +71,7 @@ static void pc_isa_bios_init(PCMachineState *pcms, MemoryRegion *isa_bios,
>              ((uint8_t*)flash_ptr) + (flash_size - isa_bios_size),
>              isa_bios_size);
>   
> -    if (!machine_require_guest_memfd(current_machine)) {
> +    if (!machine_require_guest_memfd_private(current_machine)) {
>           memory_region_set_readonly(isa_bios, true);
>       }
>   }
> diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
> index c844749900..33ac7fb6e9 100644
> --- a/hw/i386/x86-common.c
> +++ b/hw/i386/x86-common.c
> @@ -1044,7 +1044,7 @@ void x86_bios_rom_init(X86MachineState *x86ms, const char *default_firmware,
>           (bios_size % 65536) != 0) {
>           goto bios_error;
>       }
> -    if (machine_require_guest_memfd(MACHINE(x86ms))) {
> +    if (machine_require_guest_memfd_private(MACHINE(x86ms))) {
>           memory_region_init_ram_guest_memfd(&x86ms->bios, NULL, "pc.bios",
>                                              bios_size, &error_fatal);
>           if (is_tdx_vm()) {
> @@ -1074,7 +1074,7 @@ void x86_bios_rom_init(X86MachineState *x86ms, const char *default_firmware,
>       }
>       g_free(filename);
>   
> -    if (!machine_require_guest_memfd(MACHINE(x86ms))) {
> +    if (!machine_require_guest_memfd_private(MACHINE(x86ms))) {
>           /* map the last 128KB of the BIOS in ISA space */
>           x86_isa_bios_init(&x86ms->isa_bios, rom_memory, &x86ms->bios,
>                             !isapc_ram_fw);
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index 60c7981138..5d0d02bcaf 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -6050,8 +6050,9 @@ static int kvm_handle_hc_map_gpa_range(X86CPU *cpu, struct kvm_run *run)
>       uint64_t gpa, size, attributes;
>       int ret;
>   
> -    if (!machine_require_guest_memfd(current_machine))
> +    if (!machine_require_guest_memfd_private(current_machine)) {
>           return -EINVAL;
> +    }
>   
>       gpa = run->hypercall.args[0];
>       size = run->hypercall.args[1] * TARGET_PAGE_SIZE;



  reply	other threads:[~2025-12-16  6:56 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15 20:51 [PATCH v3 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends Peter Xu
2025-12-15 20:51 ` [PATCH v3 01/12] kvm: Decouple memory attribute check from kvm_guest_memfd_supported Peter Xu
2025-12-16 12:41   ` Xiaoyao Li
2025-12-23 16:56     ` Peter Xu
2025-12-16 13:53   ` Fabiano Rosas
2025-12-23 17:02     ` Peter Xu
2026-06-02  1:10   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 02/12] kvm: Detect guest-memfd flags supported Peter Xu
2025-12-16 13:54   ` Fabiano Rosas
2026-06-02  1:29   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 03/12] kvm: Provide explicit error for kvm_create_guest_memfd() Peter Xu
2025-12-16  4:03   ` Xiaoyao Li
2025-12-16 13:55   ` Fabiano Rosas
2026-06-02  1:31   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 04/12] ramblock: Rename guest_memfd to guest_memfd_private Peter Xu
2026-06-02  1:37   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 05/12] memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE Peter Xu
2025-12-16  5:49   ` Xiaoyao Li
2025-12-23 17:04     ` Peter Xu
2026-06-02  1:39   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 06/12] memory: Rename memory_region_has_guest_memfd() to *_private() Peter Xu
2026-06-02  1:40   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 07/12] hostmem: Rename guest_memfd to guest_memfd_private Peter Xu
2025-12-16  5:54   ` Xiaoyao Li
2026-06-02 18:56   ` Michael Roth
2025-12-15 20:51 ` [PATCH v3 08/12] hostmem: Support fully shared guest memfd to back a VM Peter Xu
2025-12-16  6:54   ` Xiaoyao Li
2025-12-16 14:02   ` Fabiano Rosas
2026-06-02 21:40   ` Michael Roth
2026-06-05  7:23     ` David Hildenbrand (Arm)
2026-06-05 11:23       ` David Hildenbrand (Arm)
2025-12-15 20:52 ` [PATCH v3 09/12] machine: Rename machine_require_guest_memfd() to *_private() Peter Xu
2025-12-16  6:55   ` Xiaoyao Li [this message]
2026-06-02 21:46   ` Michael Roth
2025-12-15 20:52 ` [PATCH v3 10/12] memory: Rename memory_region_init_ram_guest_memfd() " Peter Xu
2025-12-16  6:56   ` Xiaoyao Li
2026-06-02 21:49   ` Michael Roth
2025-12-15 20:52 ` [PATCH v3 11/12] tests/migration-test: Support guest-memfd init shared mem type Peter Xu
2025-12-16 14:18   ` Fabiano Rosas
2025-12-23 17:09     ` Peter Xu
2025-12-15 20:52 ` [PATCH v3 12/12] tests/migration-test: Add a precopy test for guest-memfd Peter Xu
2025-12-16 14:20   ` Fabiano Rosas
2026-06-02 22:02 ` [PATCH v3 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends Michael Roth
2026-06-03 19:27   ` Peter Xu
2026-06-04 22:36     ` Michael Roth
2026-06-05 14:57       ` Peter Xu
2026-06-08 17:59         ` Michael Roth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4616e61e-fd49-4e94-aa03-93bdfb457a87@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=aik@amd.com \
    --cc=chenyi.qiang@intel.com \
    --cc=david@kernel.org \
    --cc=farosas@suse.de \
    --cc=jmarcin@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.