machine: allow early use of machine_require_guest_memfd
PATCH 1/1 machine: allow early use of machine_require_guest_memfd
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 <[email protected]>
--- include/exec/confidential-guest-support.h | 5 +++++ include/hw/boards.h | 1 - hw/core/machine.c | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
include/exec/confidential-guest-support.h +5 -0
@@ -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
include/hw/boards.h +0 -1
@@ -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;
hw/core/machine.c +1 -1
@@ -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)
Signature · 1 line
2.45.1
Quoted 9 lines · Paolo Bonzini
Date: Fri, 31 May 2024 13:26:36 +0200
From: Paolo Bonzini <[email protected]>
Subject: [PATCH] machine: allow early use ofmachine_require_guest_memfd
X-Mailer: git-send-email 2.45.1Ask the ConfidentialGuestSupport object whether to use
guest_memfdfor KVM-backend private memory. This bool can be set ininstance_init(oruser_complete) so that it is available when the machine is created.
Quoted 6 lines
Signed-off-by Paolo Bonzini <[email protected]>--- 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 <[email protected]>