mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Binbin Wu <binbin.wu@linux.intel.com>
To: Xu Yilun <yilun.xu@linux.intel.com>
Cc: dave.hansen@intel.com, dave.hansen@linux.intel.com,
	x86@kernel.org, linux-kernel@vger.kernel.org, kas@kernel.org,
	nik.borisov@suse.com, rick.p.edgecombe@intel.com,
	yilun.xu@intel.com, linux-coco@lists.linux.dev
Subject: Re: [PATCH v5] x86/virt/tdx: Formalize SEAMCALL leaf version encoding support
Date: Thu, 10 Sep 2026 14:21:10 +0800	[thread overview]
Message-ID: <49900033-4aa4-416a-9b51-d91d5dc668e8@linux.intel.com> (raw)
In-Reply-To: <ap/Yy0uNp+78/wjv@yilunxu-OptiPlex-7050>

On 9/8/2026 5:43 PM, Xu Yilun wrote:
> On Tue, Sep 08, 2026 at 02:26:39PM +0800, Binbin Wu wrote:
>> On 9/1/2026 6:54 PM, Xu Yilun wrote:
>>> The TDX architecture includes a syscall-like ABI for OSes to communicate
>>> with SEAM mode software. This ABI has the concept of a "leaf". Each leaf
>>> is roughly analogous to a Linux syscall: it has a set of register
>>> arguments and does one logical thing like adding a page of memory to a
>>> VM or running a VM. The TDX architecture refers to this interface
>>> function as a "SEAMCALL leaf".
>>>
>>> Just like syscalls, the TDX architecture wants to evolve the ABI to
>>> extend functionality while keeping compatibility. But unlike syscalls,
>>> which do this by picking a totally new syscall number, the ABI encodes
>>> the "version" number directly into the bits of a register argument. So
>>> instead of openatN being whatever the next free number is, the SEAMCALL
>>> leaf number and version number are encoded into certain bits in how the
>>> RAX register is defined in the ABI.
>>>
>>> In Linux, several seamcall*() wrappers have been introduced to invoke
>>> SEAMCALL leafs. They all take a u64 "fn" argument for the leaf number
>>> which eventually get set in the register. As above, the version number
>>> lives in the same register as the leaf number. So callers that want to
>>> select a specific version of the leaf, can jam it in the right place in
>>> the register by passing it in the "fn" argument.
>>
>> Do you think it's worth explaining how callers determine the versions
>> supported by the TDX module,
> 
> Yeah I described this in v4 [1]. Generally it is "selecting the minimum
> workable version number for the required functionality".
> 
> But I feel it distracts people from the problem this patch wants to
> solve, so I removed it. This patch actually involves no runtime version
> selection. The future change for TDH.SYS.CONFIG does. Better we add the
> explaination in that patch?

It's OK for me.

I was wondering how did VMM know which version was supported.
Now I know It's based on the feature enumeration.

> 
> [1]: https://lore.kernel.org/all/20260804085054.190847-1-yilun.xu@linux.intel.com/
> 
>> and what happens if the specified version
>> is not supported by the TDX module?
> 
> I think it should not happen. This means the kernel is trying to enable a
> functionality that the module doesn't support. Either there is a problem
> on feature enumeration, or people are using a deprecated module. Anyway
> don't runtime check if a SEAMCALL version is supported.
> 
> Thanks,
> Yilun


  reply	other threads:[~2026-09-10  6:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 10:54 Xu Yilun
2026-09-07 11:20 ` Tony Lindgren
2026-09-07 14:35   ` Dave Hansen
2026-09-08  2:06     ` Xu Yilun
2026-09-08  6:26 ` Binbin Wu
2026-09-08  9:43   ` Xu Yilun
2026-09-10  6:21     ` Binbin Wu [this message]
2026-09-10 20:14 ` Edgecombe, Rick P
2026-09-10 20:15   ` Edgecombe, Rick P

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=49900033-4aa4-416a-9b51-d91d5dc668e8@linux.intel.com \
    --to=binbin.wu@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nik.borisov@suse.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=x86@kernel.org \
    --cc=yilun.xu@intel.com \
    --cc=yilun.xu@linux.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®