Re: [PATCH v2 2/3] KVM: TDX: Fix the exit reason handling
From: Sean Christopherson
Date: Mon Aug 10 2026 - 20:03:34 EST
The shortlog is way too generic, and the changelog is light on details. Over
the weekend, I managed to forget why this was necessary, and it took me a few
seconds to recall why we need to avoid setting bits 31:16. Of course, one could
argue that says as much about me as it does the shortlog+changelog...
Oh, and shortlogs like "Fix the exit reason handling" sometimes lead to amusing
follow-ups like "Really fix the exit reason handling". Don't be that person :-)
Something like:
KVM: TDX: Don't clobber exit_reason[31:16] when TDX-Module didn't try VM-Entry
and then in the changelog explain precisely why KVM needs to avoid clobbering
those bits.
On Mon, Aug 10, 2026, Xiaoyao Li wrote:
> Get and check the exit reason from the low 16 bits of vp_enter_ret, and
> store the synthesized/transformed exit reason in the "basic" field.
>
> Some bits in the upper 16 bits in the exit reason have their own meanings
> and they might be 1. When handling the exit reason, only do handling on
> the lower 16 bits and keep the upper 16 bits unchanged. This change
> also helps remove the additional check in tdx_failed_vmentry().
>
> Note, due to the synthesized invalid exit reason, -1, is changed to
> assigned to the "basic" field, adjust the checking in tdx_get_exit_info()
> accordingly.