All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Roth <michael.roth@amd.com>
To: <qemu-devel@nongnu.org>
Cc: <pbonzini@redhat.com>, <berrange@redhat.com>, <armbru@redhat.com>,
	<pankaj.gupta@amd.com>, <isaku.yamahata@intel.com>,
	<xiaoyao.li@intel.com>, <chao.p.peng@linux.intel.com>,
	<david@kernel.org>, Peter Xu <peterx@redhat.com>
Subject: [PATCH v5 10/12] memory: Rename memory_region_init_ram_guest_memfd() to *_private()
Date: Tue, 8 Sep 2026 08:31:00 -0500	[thread overview]
Message-ID: <20260908133151.836685-11-michael.roth@amd.com> (raw)
In-Reply-To: <20260908133151.836685-1-michael.roth@amd.com>

From: Peter Xu <peterx@redhat.com>

Differenciate it from fully shared guest-memfd use cases.

Suggested-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>
Reviewed-by: Michael Roth <michael.roth@amd.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Michael Roth <michael.roth@amd.com>
---
 backends/igvm.c         |  4 ++--
 hw/i386/pc.c            |  4 ++--
 hw/i386/pc_sysfw.c      |  4 ++--
 hw/i386/x86-common.c    |  4 ++--
 include/system/memory.h | 10 +++++-----
 system/memory.c         |  8 +++++---
 6 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/backends/igvm.c b/backends/igvm.c
index 7b7bdc72b7..228d332f42 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -259,8 +259,8 @@ static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size,
         imr->mr = g_new0(MemoryRegion, 1);
         if (ctx->machine_state->cgs &&
             ctx->machine_state->cgs->require_guest_memfd) {
-            if (!memory_region_init_ram_guest_memfd(imr->mr, NULL,
-                                                    region_name, size, errp)) {
+            if (!memory_region_init_ram_guest_memfd_private(
+                    imr->mr, NULL, region_name, size, errp)) {
                 g_free(imr->mr);
                 g_free(imr);
                 return NULL;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 9c2d77e494..1e5b23d7aa 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -874,8 +874,8 @@ void pc_memory_init(PCMachineState *pcms,
     if (!is_tdx_vm()) {
         option_rom_mr = g_malloc(sizeof(*option_rom_mr));
         if (machine_require_guest_memfd_private(machine)) {
-            memory_region_init_ram_guest_memfd(option_rom_mr, NULL, "pc.rom",
-                                            PC_ROM_SIZE, &error_fatal);
+            memory_region_init_ram_guest_memfd_private(
+                option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE, &error_fatal);
         } else {
             memory_region_init_ram(option_rom_mr, NULL, "pc.rom", PC_ROM_SIZE,
                                 &error_fatal);
diff --git a/hw/i386/pc_sysfw.c b/hw/i386/pc_sysfw.c
index 4a7694c131..3e0b9e1d28 100644
--- a/hw/i386/pc_sysfw.c
+++ b/hw/i386/pc_sysfw.c
@@ -52,8 +52,8 @@ 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_private(MACHINE(pcms))) {
-        memory_region_init_ram_guest_memfd(isa_bios, NULL, "isa-bios",
-                                           isa_bios_size, &error_fatal);
+        memory_region_init_ram_guest_memfd_private(
+            isa_bios, NULL, "isa-bios", isa_bios_size, &error_fatal);
     } else {
         memory_region_init_ram(isa_bios, NULL, "isa-bios", isa_bios_size,
                                &error_fatal);
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c
index dd526c561c..ffe9cc90b6 100644
--- a/hw/i386/x86-common.c
+++ b/hw/i386/x86-common.c
@@ -1037,8 +1037,8 @@ static void load_bios_from_file(X86MachineState *x86ms, const char *bios_name,
 
     /* BIOS load */
     if (machine_require_guest_memfd_private(MACHINE(x86ms))) {
-        memory_region_init_ram_guest_memfd(&x86ms->bios, NULL, "pc.bios",
-                                           bios_size, &error_fatal);
+        memory_region_init_ram_guest_memfd_private(
+            &x86ms->bios, NULL, "pc.bios", bios_size, &error_fatal);
         if (is_tdx_vm()) {
             tdx_set_tdvf_region(&x86ms->bios);
         }
diff --git a/include/system/memory.h b/include/system/memory.h
index 96ab920e7d..027ca81bd2 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -1358,11 +1358,11 @@ bool memory_region_init_ram(MemoryRegion *mr,
                             uint64_t size,
                             Error **errp);
 
-bool memory_region_init_ram_guest_memfd(MemoryRegion *mr,
-                                        Object *owner,
-                                        const char *name,
-                                        uint64_t size,
-                                        Error **errp);
+bool memory_region_init_ram_guest_memfd_private(MemoryRegion *mr,
+                                                Object *owner,
+                                                const char *name,
+                                                uint64_t size,
+                                                Error **errp);
 
 /**
  * memory_region_init_rom: Initialize a ROM memory region.
diff --git a/system/memory.c b/system/memory.c
index b520cca1a0..b3b678617b 100644
--- a/system/memory.c
+++ b/system/memory.c
@@ -3617,9 +3617,11 @@ bool memory_region_init_ram(MemoryRegion *mr, Object *owner,
     return true;
 }
 
-bool memory_region_init_ram_guest_memfd(MemoryRegion *mr, Object *owner,
-                                        const char *name, uint64_t size,
-                                        Error **errp)
+bool memory_region_init_ram_guest_memfd_private(MemoryRegion *mr,
+                                                Object *owner,
+                                                const char *name,
+                                                uint64_t size,
+                                                Error **errp)
 {
     if (!memory_region_init_ram_flags_nomigrate(mr, owner, name, size,
                                                 RAM_GUEST_MEMFD_PRIVATE, errp)) {
-- 
2.43.0



  parent reply	other threads:[~2026-09-08 13:33 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08 13:30 [PATCH v5 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends Michael Roth
2026-09-08 13:30 ` [PATCH v5 01/12] kvm: Decouple memory attribute check from kvm_guest_memfd_supported Michael Roth
2026-09-10  8:47   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 02/12] kvm: Detect guest-memfd flags supported Michael Roth
2026-09-08 13:30 ` [PATCH v5 03/12] kvm: Provide explicit error for kvm_create_guest_memfd() Michael Roth
2026-09-10  8:48   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 04/12] ramblock: Rename guest_memfd to guest_memfd_private Michael Roth
2026-09-10  8:49   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 05/12] memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE Michael Roth
2026-09-10  8:50   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 06/12] memory: Rename memory_region_has_guest_memfd() to *_private() Michael Roth
2026-09-10  8:50   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 07/12] hostmem: Rename guest_memfd to guest_memfd_private Michael Roth
2026-09-10  8:51   ` David Hildenbrand
2026-09-08 13:30 ` [PATCH v5 08/12] hostmem: Support fully shared guest memfd to back a VM Michael Roth
2026-09-08 14:03   ` Markus Armbruster
2026-09-10 22:58     ` Michael Roth
2026-09-11  5:56       ` Markus Armbruster
2026-09-11 19:22         ` Michael Roth
2026-09-10  8:54   ` David Hildenbrand
2026-09-10 23:00     ` Michael Roth
2026-09-11 12:06       ` Peter Xu
2026-09-11 16:00         ` David Hildenbrand (Arm)
2026-09-08 13:30 ` [PATCH v5 09/12] machine: Rename machine_require_guest_memfd() to *_private() Michael Roth
2026-09-10  8:55   ` David Hildenbrand
2026-09-10 23:08     ` Michael Roth
2026-09-11 10:48       ` David Hildenbrand (Arm)
2026-09-11 19:27         ` Michael Roth
2026-09-08 13:31 ` Michael Roth [this message]
2026-09-10  8:56   ` [PATCH v5 10/12] memory: Rename memory_region_init_ram_guest_memfd() " David Hildenbrand
2026-09-08 13:31 ` [PATCH v5 11/12] tests/migration-test: Support guest-memfd init shared mem type Michael Roth
2026-09-08 13:31 ` [PATCH v5 12/12] tests/migration-test: Add a precopy test for guest-memfd Michael Roth
2026-09-10  8:45 ` [PATCH v5 00/12] KVM/hostmem: Support init-shared guest-memfd as VM backends David Hildenbrand

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=20260908133151.836685-11-michael.roth@amd.com \
    --to=michael.roth@amd.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=david@kernel.org \
    --cc=isaku.yamahata@intel.com \
    --cc=pankaj.gupta@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoyao.li@intel.com \
    /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.