mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xiaoyao Li <xiaoyao.li@intel.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Kernel Mailing List, Linux" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Rick Edgecombe <rick.p.edgecombe@intel.com>,
	"Huang, Kai" <kai.huang@intel.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	reinette.chatre@intel.com, "Lindgren,
	Tony" <tony.lindgren@intel.com>,
	"Yamahata, Isaku" <isaku.yamahata@intel.com>,
	Yan Zhao <yan.y.zhao@intel.com>,
	mikko.ylinen@linux.intel.com, "Shutemov,
	Kirill" <kirill.shutemov@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	Binbin Wu <binbin.wu@linux.intel.com>
Subject: Re: [PATCH 3/3] KVM: TDX: Exit to userspace for GetTdVmCallInfo
Date: Fri, 20 Jun 2025 20:34:53 +0800	[thread overview]
Message-ID: <f633077e-a28a-4c6e-81b3-7a36044f8bae@intel.com> (raw)
In-Reply-To: <CABgObfaeYdKeYQb+6j6j6u5ytasgb=t2z03cQvkG2c+owfOCgg@mail.gmail.com>

On 6/20/2025 8:03 PM, Paolo Bonzini wrote:
> Il ven 20 giu 2025, 03:21 Xiaoyao Li <xiaoyao.li@intel.com> ha scritto:
>>
>>>                tdx->vp_enter_args.r11 = 0;
>>> +             tdx->vp_enter_args.r12 = 0;
>>>                tdx->vp_enter_args.r13 = 0;
>>>                tdx->vp_enter_args.r14 = 0;
>>> +             return 1;
>>
>> Though it looks OK to return all-0 for r12 == 0 and undefined case of
>> r12 > 1, I prefer returning TDVMCALL_STATUS_INVALID_OPERAND for
>> undefined case.
> 
> 
>  From the GHCI I wasn't sure that TDVMCALL_STATUS_INVALID_OPERAND is a
> valid result at all.

It's part of the new GHCI change, which currently is still in draft 
state. (Sorry for not informing you)

The proposed GHCI update defines VMCALL_OPERAND_INVALID for the case of 
input R12 value is not supported. So for VMM that doesn't implement the 
enumeration for the optional leafs when r12 = 1 can return this status 
code. As well, VMM can return this status code for the case of input R12 
 >= 2, to avoid the VMM introduces its own defined behavior.

> Paolo
> 
>>
>> So please make above "case 0:", and make the "default:" return
>> TDVMCALL_STATUS_INVALID_OPERAND
>>
>>>        }
>>> -     return 1;
>>>    }
>>>
>>>    static int tdx_complete_simple(struct kvm_vcpu *vcpu)
>>> diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
>>> index 6708bc88ae69..fb3b4cd8d662 100644
>>> --- a/include/uapi/linux/kvm.h
>>> +++ b/include/uapi/linux/kvm.h
>>> @@ -461,6 +461,11 @@ struct kvm_run {
>>>                                        __u64 gpa;
>>>                                        __u64 size;
>>>                                } get_quote;
>>> +                             struct {
>>> +                                     __u64 ret;
>>> +                                     __u64 leaf;
>>> +                                     __u64 r11, r12, r13, r14;
>>> +                             } get_tdvmcall_info;
>>>                        };
>>>                } tdx;
>>>                /* Fix the size of the union. */
>>
> 
> 


  reply	other threads:[~2025-06-20 12:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-19 18:01 [PATCH v2 0/3] TDX attestation support and GHCI fixup Paolo Bonzini
2025-06-19 18:01 ` [PATCH 1/3] KVM: TDX: Add new TDVMCALL status code for unsupported subfuncs Paolo Bonzini
2025-06-23 22:42   ` Huang, Kai
2025-06-19 18:01 ` [PATCH 2/3] KVM: TDX: Handle TDG.VP.VMCALL<GetQuote> Paolo Bonzini
2025-06-20  2:57   ` Binbin Wu
2025-06-20  3:05     ` Binbin Wu
2025-06-19 18:01 ` [PATCH 3/3] KVM: TDX: Exit to userspace for GetTdVmCallInfo Paolo Bonzini
2025-06-20  1:20   ` Xiaoyao Li
2025-06-20 12:03     ` Paolo Bonzini
2025-06-20 12:34       ` Xiaoyao Li [this message]
2025-06-20  1:30 ` [PATCH v2 0/3] TDX attestation support and GHCI fixup Xiaoyao Li
2025-06-20  2:10   ` Binbin Wu
2025-06-20 12:03   ` Paolo Bonzini
2025-06-20 12:48     ` Xiaoyao Li
2025-06-20 17:24       ` Paolo Bonzini
2025-06-20 17:47         ` Edgecombe, Rick P
2025-06-20  7:09 ` Binbin Wu
2025-06-20 18:33 [PATCH v3 " Paolo Bonzini
2025-06-20 18:33 ` [PATCH 3/3] KVM: TDX: Exit to userspace for GetTdVmCallInfo Paolo Bonzini

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=f633077e-a28a-4c6e-81b3-7a36044f8bae@intel.com \
    --to=xiaoyao.li@intel.com \
    --cc=adrian.hunter@intel.com \
    --cc=binbin.wu@linux.intel.com \
    --cc=isaku.yamahata@intel.com \
    --cc=jiewen.yao@intel.com \
    --cc=kai.huang@intel.com \
    --cc=kirill.shutemov@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikko.ylinen@linux.intel.com \
    --cc=pbonzini@redhat.com \
    --cc=reinette.chatre@intel.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=seanjc@google.com \
    --cc=tony.lindgren@intel.com \
    --cc=yan.y.zhao@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

all inboxes | Powered by JetHome®