qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i386/tdx: Use .has_gpa field to check if the gpa is valid
@ 2025-07-10 14:15 Xiaoyao Li
  2025-07-10 14:25 ` Daniel P. Berrangé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Xiaoyao Li @ 2025-07-10 14:15 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Marcelo Tosatti, qemu-devel, Daniel P . Berrangé,
	Zhenzhong Duan, Xiaoyao Li

There is actually the .has_gpa field when translating the QAPI data
type GuestPanicInformationTdx to C structure.

Stop using the magic number -1 as the indicator for no valid gpa.
Instead just use .has_gpa field.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 system/runstate.c     | 2 +-
 target/i386/kvm/tdx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/system/runstate.c b/system/runstate.c
index 38900c935a35..87cdcab4f388 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -690,7 +690,7 @@ void qemu_system_guest_panicked(GuestPanicInformation *info)
                           " error code: 0x%" PRIx32 " error message:\"%s\"\n",
                           info->u.tdx.error_code, message);
             g_free(message);
-            if (info->u.tdx.gpa != -1ull) {
+            if (info->u.tdx.has_gpa) {
                 qemu_log_mask(LOG_GUEST_ERROR, "Additional error information "
                               "can be found at gpa page: 0x%" PRIx64 "\n",
                               info->u.tdx.gpa);
diff --git a/target/i386/kvm/tdx.c b/target/i386/kvm/tdx.c
index 370a9b6e656c..14704eb523c5 100644
--- a/target/i386/kvm/tdx.c
+++ b/target/i386/kvm/tdx.c
@@ -1298,7 +1298,7 @@ int tdx_handle_report_fatal_error(X86CPU *cpu, struct kvm_run *run)
     uint64_t reg_mask = run->system_event.data[R_ECX];
     char *message = NULL;
     uint64_t *tmp;
-    uint64_t gpa = -1ull;
+    uint64_t gpa = 0;
     bool has_gpa = false;
 
     if (error_code & 0xffff) {
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-09-12  5:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 14:15 [PATCH] i386/tdx: Use .has_gpa field to check if the gpa is valid Xiaoyao Li
2025-07-10 14:25 ` Daniel P. Berrangé
2025-07-11  3:22 ` Duan, Zhenzhong
2025-09-12  5:53 ` Xiaoyao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).