79 lines
2.9 KiB
Diff
79 lines
2.9 KiB
Diff
From 6c84c60f50287a00c91dd390b8d71f008c704048 Mon Sep 17 00:00:00 2001
|
|
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
Date: Fri, 18 Jul 2025 18:03:50 +0200
|
|
Subject: [PATCH 102/115] i386/tdx: Fix the report of gpa in QAPI
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
|
|
RH-MergeRequest: 391: TDX support, including attestation and device assignment
|
|
RH-Jira: RHEL-15710 RHEL-20798 RHEL-49728
|
|
RH-Acked-by: Yash Mankad <None>
|
|
RH-Acked-by: Peter Xu <peterx@redhat.com>
|
|
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
RH-Commit: [102/115] ccaf1112d985ac652bd118bce4486853163cbc16 (bonzini/rhel-qemu-kvm)
|
|
|
|
Gpa is defined in QAPI but never reported to monitor because has_gpa is
|
|
never set to ture.
|
|
|
|
Fix it by setting has_gpa to ture when TDX_REPORT_FATAL_ERROR_GPA_VALID
|
|
is set in error_code.
|
|
|
|
Fixes: 6e250463b08b ("i386/tdx: Wire TDX_REPORT_FATAL_ERROR with GuestPanic facility")
|
|
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
|
|
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
|
|
Link: https://lore.kernel.org/r/20250710035538.303136-1-zhenzhong.duan@intel.com
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
(cherry picked from commit b28f6d5c16f19f8c56926c10929db29f913895ad)
|
|
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
---
|
|
target/i386/kvm/tdx.c | 8 ++++++--
|
|
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
|
|
index e56db74f58..20fcd9a4c5 100644
|
|
--- a/target/i386/kvm/tdx.c
|
|
+++ b/target/i386/kvm/tdx.c
|
|
@@ -1321,7 +1321,8 @@ void tdx_handle_setup_event_notify_interrupt(X86CPU *cpu, struct kvm_run *run)
|
|
}
|
|
|
|
static void tdx_panicked_on_fatal_error(X86CPU *cpu, uint64_t error_code,
|
|
- char *message, uint64_t gpa)
|
|
+ char *message, bool has_gpa,
|
|
+ uint64_t gpa)
|
|
{
|
|
GuestPanicInformation *panic_info;
|
|
|
|
@@ -1330,6 +1331,7 @@ static void tdx_panicked_on_fatal_error(X86CPU *cpu, uint64_t error_code,
|
|
panic_info->u.tdx.error_code = (uint32_t) error_code;
|
|
panic_info->u.tdx.message = message;
|
|
panic_info->u.tdx.gpa = gpa;
|
|
+ panic_info->u.tdx.has_gpa = has_gpa;
|
|
|
|
qemu_system_guest_panicked(panic_info);
|
|
}
|
|
@@ -1349,6 +1351,7 @@ int tdx_handle_report_fatal_error(X86CPU *cpu, struct kvm_run *run)
|
|
char *message = NULL;
|
|
uint64_t *tmp;
|
|
uint64_t gpa = -1ull;
|
|
+ bool has_gpa = false;
|
|
|
|
if (error_code & 0xffff) {
|
|
error_report("TDX: REPORT_FATAL_ERROR: invalid error code: 0x%"PRIx64,
|
|
@@ -1381,9 +1384,10 @@ int tdx_handle_report_fatal_error(X86CPU *cpu, struct kvm_run *run)
|
|
|
|
if (error_code & TDX_REPORT_FATAL_ERROR_GPA_VALID) {
|
|
gpa = run->system_event.data[R_R13];
|
|
+ has_gpa = true;
|
|
}
|
|
|
|
- tdx_panicked_on_fatal_error(cpu, error_code, message, gpa);
|
|
+ tdx_panicked_on_fatal_error(cpu, error_code, message, has_gpa, gpa);
|
|
|
|
return -1;
|
|
}
|
|
--
|
|
2.50.1
|
|
|