* [PATCH] machine: allow early use of machine_require_guest_memfd
@ 2024-05-31 11:26 Paolo Bonzini
2024-06-02 5:47 ` Zhao Liu
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2024-05-31 11:26 UTC (permalink / raw)
To: qemu-devel
Ask the ConfidentialGuestSupport object whether to use guest_memfd
for KVM-backend private memory. This bool can be set in instance_init
(or user_complete) so that it is available when the machine is created.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/exec/confidential-guest-support.h | 5 +++++
include/hw/boards.h | 1 -
hw/core/machine.c | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/include/exec/confidential-guest-support.h b/include/exec/confidential-guest-support.h
index e5b188cffbf..02dc4e518f0 100644
--- a/include/exec/confidential-guest-support.h
+++ b/include/exec/confidential-guest-support.h
@@ -31,6 +31,11 @@ OBJECT_DECLARE_TYPE(ConfidentialGuestSupport,
struct ConfidentialGuestSupport {
Object parent;
+ /*
+ * True if the machine should use guest_memfd for RAM.
+ */
+ bool require_guest_memfd;
+
/*
* ready: flag set by CGS initialization code once it's ready to
* start executing instructions in a potentially-secure
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 2fa800f11ae..73ad319d7da 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -375,7 +375,6 @@ struct MachineState {
char *dt_compatible;
bool dump_guest_core;
bool mem_merge;
- bool require_guest_memfd;
bool usb;
bool usb_disabled;
char *firmware;
diff --git a/hw/core/machine.c b/hw/core/machine.c
index 17292b13e62..77a356f232f 100644
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -1216,7 +1216,7 @@ bool machine_mem_merge(MachineState *machine)
bool machine_require_guest_memfd(MachineState *machine)
{
- return machine->require_guest_memfd;
+ return machine->cgs && machine->cgs->require_guest_memfd;
}
static char *cpu_slot_to_string(const CPUArchId *cpu)
--
2.45.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] machine: allow early use of machine_require_guest_memfd
2024-05-31 11:26 [PATCH] machine: allow early use of machine_require_guest_memfd Paolo Bonzini
@ 2024-06-02 5:47 ` Zhao Liu
0 siblings, 0 replies; 2+ messages in thread
From: Zhao Liu @ 2024-06-02 5:47 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Fri, May 31, 2024 at 01:26:36PM +0200, Paolo Bonzini wrote:
> Date: Fri, 31 May 2024 13:26:36 +0200
> From: Paolo Bonzini <pbonzini@redhat.com>
> Subject: [PATCH] machine: allow early use of machine_require_guest_memfd
> X-Mailer: git-send-email 2.45.1
>
> Ask the ConfidentialGuestSupport object whether to use guest_memfd
> for KVM-backend private memory. This bool can be set in instance_init
> (or user_complete) so that it is available when the machine is created.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> include/exec/confidential-guest-support.h | 5 +++++
> include/hw/boards.h | 1 -
> hw/core/machine.c | 2 +-
> 3 files changed, 6 insertions(+), 2 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-02 5:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-31 11:26 [PATCH] machine: allow early use of machine_require_guest_memfd Paolo Bonzini
2024-06-02 5:47 ` Zhao Liu
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).