qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Xiaoyao Li <xiaoyao.li@intel.com>
Cc: Zhenzhong Duan <zhenzhong.duan@intel.com>,
	qemu-devel@nongnu.org, chao.p.peng@intel.com
Subject: Re: [PATCH] i386/tdx: Fix the report of gpa in QAPI
Date: Thu, 10 Jul 2025 15:11:57 +0100	[thread overview]
Message-ID: <aG_KLeTIIblKbrY9@redhat.com> (raw)
In-Reply-To: <efbbe5f4-6f0c-4470-9968-c389cb206088@intel.com>

On Thu, Jul 10, 2025 at 10:06:10PM +0800, Xiaoyao Li wrote:
> On 7/10/2025 7:40 PM, Xiaoyao Li wrote:
> > On 7/10/2025 11:55 AM, Zhenzhong Duan wrote:
> > > 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.
> > 
> > Hi Zhenzhong,
> > 
> > I would like to understand what the problem is without panic_info-
> > >u.tdx.has_gpa being set?
> 
> Never mind, I figure it out.
> 
> qapi_event_send_guest_panicked() in qemu_system_guest_panicked will send the
> event and data. Libvirt tries to parse the data, but find the .has_data
> field is not set correctly.

Close, but not quite.

The "has_" fields are only present in the QEMU internal data structures,
never on the wire in the JSON messages that libvirt receives.

The problem is with QEMU's struct -> JSON serialization - if the 'has_gpa'
field is not set to 'true', then QEMU will *never* emit the 'gpa' field
in the JSON it sends to the client app.

So what libvirt receives is this:

 {"timestamp": {"seconds": 1752156518, "microseconds": 809325},
  "event": "GUEST_PANICKED",
  "data": {"action": "pause", "info": {
      "error-code": 0,
      "message": "TD misconfiguration: SEPT #VE has to be disabled",
      "type": "tdx"}}}

which has no 'gpa' present.

> My original patch used (gpa == -1) as the indicator for whether gpa is
> valid, this needs to be cleaned up. I will send the cleanup patch.

The value you assign to 'gpa' doesn't matter when 'has_gpa' is false,
as it'll never get into the JSON event, so having it be '-1' is not
significantly different from leaving it on 0.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2025-07-10 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-10  3:55 [PATCH] i386/tdx: Fix the report of gpa in QAPI Zhenzhong Duan
2025-07-10  7:08 ` Daniel P. Berrangé
2025-07-10  7:51 ` Paolo Bonzini
2025-07-10 11:40 ` Xiaoyao Li
2025-07-10 14:06   ` Xiaoyao Li
2025-07-10 14:11     ` Daniel P. Berrangé [this message]
2025-07-10 14:21       ` Xiaoyao Li
2025-07-10 14:24         ` Daniel P. Berrangé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aG_KLeTIIblKbrY9@redhat.com \
    --to=berrange@redhat.com \
    --cc=chao.p.peng@intel.com \
    --cc=qemu-devel@nongnu.org \
    --cc=xiaoyao.li@intel.com \
    --cc=zhenzhong.duan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).