You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.5 KiB
72 lines
2.5 KiB
From 9f485c8df885bcd1ff6c5692463c6168bfec07fb Mon Sep 17 00:00:00 2001
|
|
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Fri, 31 May 2024 13:29:53 +0200
|
|
Subject: [PATCH 054/100] machine: allow early use of
|
|
machine_require_guest_memfd
|
|
|
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-MergeRequest: 245: SEV-SNP support
|
|
RH-Jira: RHEL-39544
|
|
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
RH-Acked-by: Bandan Das <bdas@redhat.com>
|
|
RH-Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
|
|
RH-Commit: [54/91] fd8c1a6624d5f27268215c8aa70dfc9d37bdb981 (bonzini/rhel-qemu-kvm)
|
|
|
|
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>
|
|
(cherry picked from commit dc0d28ca46c0e7ee3c055ad4da24022995bd3765)
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
---
|
|
hw/core/machine.c | 2 +-
|
|
include/exec/confidential-guest-support.h | 5 +++++
|
|
include/hw/boards.h | 1 -
|
|
3 files changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/hw/core/machine.c b/hw/core/machine.c
|
|
index 07b994e136..2055e0d312 100644
|
|
--- a/hw/core/machine.c
|
|
+++ b/hw/core/machine.c
|
|
@@ -1482,7 +1482,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)
|
|
diff --git a/include/exec/confidential-guest-support.h b/include/exec/confidential-guest-support.h
|
|
index e5b188cffb..02dc4e518f 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 815a1c4b26..0d1f9533ef 100644
|
|
--- a/include/hw/boards.h
|
|
+++ b/include/hw/boards.h
|
|
@@ -373,7 +373,6 @@ struct MachineState {
|
|
char *dt_compatible;
|
|
bool dump_guest_core;
|
|
bool mem_merge;
|
|
- bool require_guest_memfd;
|
|
bool usb;
|
|
bool usb_disabled;
|
|
char *firmware;
|
|
--
|
|
2.39.3
|
|
|