The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Dave Hansen <dave.hansen@intel.com>
To: Kiryl Shutsemau <kas@kernel.org>
Cc: Xu Yilun <yilun.xu@linux.intel.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org,
	rick.p.edgecombe@intel.com, dave.hansen@linux.intel.com,
	yilun.xu@intel.com, chao.gao@intel.com, djbw@kernel.org,
	linux-coco@lists.linux.dev, peter.fang@intel.com,
	xiaoyao.li@intel.com
Subject: Re: [PATCH v2] x86/virt/tdx: Formalize SEAMCALL version encoding support
Date: Fri, 10 Jul 2026 09:48:22 -0700	[thread overview]
Message-ID: <f8ef7a94-7824-4d1f-899a-60a0fbd2e2f7@intel.com> (raw)
In-Reply-To: <alEXflESyo6ndDTY@thinkstation>

On 7/10/26 09:21, Kiryl Shutsemau wrote:
> The version is not a register operand, it is part of the function
> number.

I'm not sure why that's important.

Sure, the arg structure is all full registers now. But it's not even all
the registers because RAX isn't there. So let's say we made the data
structure smarter:

struct tdx_module_args {
        union {
                u64 rax;
                struct {
                        u16 function_nr;
                        u8  version
                        u8  padding0;
                        u32 flags;
                };
        };
        u64 rcx;
        u64 rdx;
	...
}

All of the:

        struct tdx_module_args args = {};

instances would default to version=0. It would take a one-liner to get
bit 63 set:

 static int seamldr_call(u64 fn, struct tdx_module_args *args)
 {
 ...
+	args->flags |= SEAMLDR_BIT;
        guard(raw_spinlock)(&seamldr_lock);
        return seamcall_prerr(fn, args);
 }

The truth of the matter is that 'fn' *IS* the RAX from the TDX ABI.
We're carrying it around the kernel in that format, and it just doesn't
work very well.

The alternative is to carry the logical pieces of RAX around the kernel
and them assemble RAX out of them in one (or very few) places. *Not* to
build RAX in the TDX module ABI early far from the TDX module ABI layer
itself.



  reply	other threads:[~2026-07-10 16:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 17:03 [PATCH v2] x86/virt/tdx: Formalize SEAMCALL version encoding support Xu Yilun
2026-07-08 18:03 ` Dave Hansen
2026-07-09 10:16   ` Xu Yilun
2026-07-10 16:21   ` Kiryl Shutsemau
2026-07-10 16:48     ` Dave Hansen [this message]
2026-07-10 15:56 ` Kiryl Shutsemau

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=f8ef7a94-7824-4d1f-899a-60a0fbd2e2f7@intel.com \
    --to=dave.hansen@intel.com \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=djbw@kernel.org \
    --cc=kas@kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter.fang@intel.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=x86@kernel.org \
    --cc=xiaoyao.li@intel.com \
    --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