For in-place conversion, the source pointer is expected to be NULL since the data has already been written directly to guest memory and doesn't need to be copied in prior to encrypting it in-place for initial guest memory payload. Signed-off-by: Michael Roth --- target/i386/sev.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index cc16c6b071..87d88b7920 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -1240,7 +1240,15 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, memcpy(&snp_cpuid_info, data->hva, sizeof(snp_cpuid_info)); } - update.uaddr = (__u64)(unsigned long)data->hva; + /* + * For in-place conversion, the source pointer is expected to be NULL + * since the data has already been written directly to guest memory + * and only needs to be encrypted in-place for secure access. + */ + if (!machine_require_guest_memfd_convert_in_place( + MACHINE(qdev_get_machine()))) { + update.uaddr = (__u64)(unsigned long)data->hva; + } update.gfn_start = data->gpa >> TARGET_PAGE_BITS; update.len = data->len; update.type = data->type; -- 2.43.0