[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 16/26] migration: Load confidential guest RAM using migration
From: |
Dov Murik |
Subject: |
[RFC PATCH 16/26] migration: Load confidential guest RAM using migration helper |
Date: |
Tue, 2 Mar 2021 15:48:12 -0500 |
When loading encrypted RAM pages of a confidential guest, ask the
in-guest migration helper to decrypt the incoming page and place it
correctly in the guest memory at the appropriate address. This way the
page's plaintext content remains inaccessible to the host.
Signed-off-by: Dov Murik <dovmurik@linux.vnet.ibm.com>
---
migration/ram.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/migration/ram.c b/migration/ram.c
index 8e55ed49fd..82a1d13f5f 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -3519,6 +3519,10 @@ void colo_release_ram_cache(void)
*/
static int ram_load_setup(QEMUFile *f, void *opaque)
{
+ if (confidential_guest()) {
+ cgs_mh_init();
+ }
+
if (compress_threads_load_setup(f)) {
return -1;
}
@@ -3812,6 +3816,8 @@ void colo_flush_ram_cache(void)
static int ram_load_precopy(QEMUFile *f)
{
int flags = 0, ret = 0, invalid_flags = 0, len = 0, i = 0;
+ ram_addr_t gpa;
+
/* ADVISE is earlier, it shows the source has the postcopy capability on */
bool postcopy_advised = postcopy_is_advised();
if (!migrate_use_compression()) {
@@ -3848,7 +3854,8 @@ static int ram_load_precopy(QEMUFile *f)
}
if (flags & (RAM_SAVE_FLAG_ZERO | RAM_SAVE_FLAG_PAGE |
- RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE)) {
+ RAM_SAVE_FLAG_COMPRESS_PAGE | RAM_SAVE_FLAG_XBZRLE |
+ RAM_SAVE_FLAG_GUEST_ENCRYPTED_PAGE)) {
RAMBlock *block = ram_block_from_stream(f, flags);
host = host_from_ram_block_offset(block, addr);
@@ -3977,6 +3984,16 @@ static int ram_load_precopy(QEMUFile *f)
break;
}
break;
+
+ case RAM_SAVE_FLAG_GUEST_ENCRYPTED_PAGE:
+ if (!kvm_physical_memory_addr_from_host(kvm_state, host, &gpa)) {
+ error_report("%s: failed to get gpa for host %p", __func__,
host);
+ ret = -EINVAL;
+ break;
+ }
+ ret = cgs_mh_load_encrypted_page(f, gpa);
+ break;
+
case RAM_SAVE_FLAG_EOS:
/* normal exit */
multifd_recv_sync_main();
--
2.20.1
- [RFC PATCH 00/26] Confidential guest live migration, Dov Murik, 2021/03/02
- [RFC PATCH 01/26] linux-headers: Add definitions of KVM page encryption bitmap ioctls, Dov Murik, 2021/03/02
- [RFC PATCH 02/26] kvm: add support to sync the page encryption state bitmap, Dov Murik, 2021/03/02
- [RFC PATCH 12/26] migration: Add helpers to save confidential RAM, Dov Murik, 2021/03/02
- [RFC PATCH 04/26] hw/boards: Add aux flag to CPUArchId, Dov Murik, 2021/03/02
- [RFC PATCH 11/26] softmmu: Add pause_all_vcpus_except_aux, Dov Murik, 2021/03/02
- [RFC PATCH 16/26] migration: Load confidential guest RAM using migration helper,
Dov Murik <=
- [RFC PATCH 06/26] hw/acpi: Don't include auxiliary vcpus in ACPI tables, Dov Murik, 2021/03/02
- [RFC PATCH 13/26] migration: Add helpers to load confidential RAM, Dov Murik, 2021/03/02
- [RFC PATCH 07/26] cpu: Add boolean aux field to CPUState, Dov Murik, 2021/03/02
- [RFC PATCH 23/26] target/i386: Re-sync kvm-clock after confidential guest migration, Dov Murik, 2021/03/02
- [RFC PATCH 03/26] machine: Add auxcpus=N suboption to -smp, Dov Murik, 2021/03/02
- [RFC PATCH 09/26] softmmu: Don't sync aux vcpus in pre_loadvm, Dov Murik, 2021/03/02
- [RFC PATCH 19/26] migration: Don't sync vcpus when migrating confidential guests, Dov Murik, 2021/03/02
- [RFC PATCH 08/26] hw/i386: Set CPUState.aux=true for auxiliary vcpus, Dov Murik, 2021/03/02
- [RFC PATCH 14/26] migration: Introduce gpa_inside_migration_helper_shared_area, Dov Murik, 2021/03/02
- [RFC PATCH 18/26] migration: Stop non-aux vcpus before copying the last pages, Dov Murik, 2021/03/02