From: Xiaoyao Li <xiaoyao.li@intel.com>
To: David Hildenbrand <david@redhat.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, Xiaoyao Li <xiaoyao.li@intel.com>,
Stefano Garzarella <sgarzare@redhat.com>
Subject: [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs
Date: Mon, 21 Jul 2025 14:52:20 +0800 [thread overview]
Message-ID: <20250721065220.895606-1-xiaoyao.li@intel.com> (raw)
shm can surely serve as the shared memory for coco-VMs. But currently it
doesn't check the backend->guest_memfd to pass down the RAM_GUEST_MEMFD
flag. It leads to failure when creating coco-VMs (e.g., TDX guest) which
require private mmeory.
Set and pass down RAM_GUEST_MEMFD when backend->guest_memfd is true, to
allow shm memory backend serve as shared memory for coco-VMs.
cc: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
backends/hostmem-shm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/backends/hostmem-shm.c b/backends/hostmem-shm.c
index f66211a2ec92..806e2670e039 100644
--- a/backends/hostmem-shm.c
+++ b/backends/hostmem-shm.c
@@ -54,6 +54,7 @@ have_fd:
/* Let's do the same as memory-backend-ram,share=on would do. */
ram_flags = RAM_SHARED;
ram_flags |= backend->reserve ? 0 : RAM_NORESERVE;
+ ram_flags |= backend->guest_memfd ? RAM_GUEST_MEMFD : 0;
return memory_region_init_ram_from_fd(&backend->mr, OBJECT(backend),
backend_name, backend->size,
--
2.43.0
next reply other threads:[~2025-07-21 7:02 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 6:52 Xiaoyao Li [this message]
2025-07-21 7:50 ` [PATCH] hostmem/shm: Allow shm memory backend serve as shared memory for coco-VMs Stefano Garzarella
2025-07-21 8:00 ` David Hildenbrand
2025-08-14 9:45 ` Xiaoyao Li
2025-09-12 5:45 ` Xiaoyao Li
2025-10-24 0:51 ` Xiaoyao Li
2025-10-24 15:52 ` Peter Xu
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=20250721065220.895606-1-xiaoyao.li@intel.com \
--to=xiaoyao.li@intel.com \
--cc=david@redhat.com \
--cc=imammedo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=sgarzare@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).