mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
To: "Zhao, Yan Y" <yan.y.zhao@intel.com>
Cc: "Gao, Chao" <chao.gao@intel.com>,
	"Hansen, Dave" <dave.hansen@intel.com>,
	"Xu, Yilun" <yilun.xu@intel.com>, "bp@alien8.de" <bp@alien8.de>,
	"kas@kernel.org" <kas@kernel.org>,
	"ackerleytng@google.com" <ackerleytng@google.com>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"x86@kernel.org" <x86@kernel.org>,
	"tglx@kernel.org" <tglx@kernel.org>,
	"Annapurve, Vishal" <vannapurve@google.com>,
	"nik.borisov@suse.com" <nik.borisov@suse.com>,
	"seanjc@google.com" <seanjc@google.com>
Subject: Re: [PATCH] x86/virt/tdx: Add command line param for DPAMT
Date: Wed, 2 Dec 2026 01:14:53 +0000	[thread overview]
Message-ID: <4b613304a9bf823c4045adfc9da7b3bcd1fee474.camel@intel.com> (raw)
In-Reply-To: <awfqJfLIZkxprFiY@yzhao56-desk>

On Thu, 2026-11-26 at 16:13 +0800, Yan Zhao wrote:
> > Also, I cherry-picked this from the last DPAMT patchset and didn't retest 
> > it on upstream yet. Will do, but I'm not expecting problems.
> Tested working with kvm-x86-next-2026.11.11, which is at v7.4.0-rc2.
> 

Thanks! Did you test on and off? Can I add your tested-by?

> > ---
> >   Documentation/admin-guide/kernel-parameters.txt |  7 +++++++
> >   arch/x86/virt/vmx/tdx/tdx.c                     | 12 ++++++++++++
> >   2 files changed, 19 insertions(+)
> > 
> > diff --git a/Documentation/admin-guide/kernel-parameters.txt
> > b/Documentation/admin-guide/kernel-parameters.txt
> > index 176648941aec2..af8b8eb54228e 100644
> > --- a/Documentation/admin-guide/kernel-parameters.txt
> > +++ b/Documentation/admin-guide/kernel-parameters.txt
> > @@ -7564,6 +7564,13 @@ Kernel parameters
> >   
> >   	tdfx=		[HW,DRM]
> >   
> > +	tdx_dpamt=
> > +			[X86] Controls whether TDX will use Dynamic PAMT
> [X86] --> [X86-64] ?

Oh yea.

> And is a "KNL" tag necessary?

Oh! I had thought KNL was knights landing for some reason, the Xeon Phi thing
that has nothing to do with TDX. Now I see in this file it means "Is a kernel
start-up parameter." so yes I'll add it. Thanks.

> 
> > +			to save memory, when supported.
> > +
> > +			Valid parameters: "on", "off"
> > +			Default: "off"
> > +
> >   	test_suspend=	[SUSPEND]
> >   			Format: { "mem" | "standby" | "freeze" }[,N]
> >   			Specify "mem" (for Suspend-to-RAM) or "standby"
> > (for
> > diff --git a/arch/x86/virt/vmx/tdx/tdx.c b/arch/x86/virt/vmx/tdx/tdx.c
> > index 96ced0494b687..ed5f37e5ebb29 100644
> > --- a/arch/x86/virt/vmx/tdx/tdx.c
> > +++ b/arch/x86/virt/vmx/tdx/tdx.c
> > @@ -50,6 +50,8 @@
> >   /* Number of DPAMT pages to be provided to TDX module per 2MB region of PA
> > */
> >   #define TDX_DPAMT_ENTRY_PAGE_CNT 2
> >   
> > +static bool tdx_enable_dpamt __ro_after_init;
> > +
> >   struct tdx_module_state {
> >   	bool initialized;
> >   	bool sysinit_done;
> > @@ -2055,6 +2057,9 @@ EXPORT_SYMBOL_FOR_KVM(tdh_phymem_page_wbinvd_hkid);
> >   
> >   bool tdx_supports_dynamic_pamt(const struct tdx_sys_info *sysinfo)
> >   {
> > +	if (!tdx_enable_dpamt)
> > +		return false;
> > +
> >   	return sysinfo->features.tdx_features0 &
> > TDX_FEATURES0_DYNAMIC_PAMT;
> >   }
> >   EXPORT_SYMBOL_FOR_KVM(tdx_supports_dynamic_pamt);
> > @@ -2316,6 +2321,13 @@ void tdx_free_control_page(struct page *page)
> >   }
> >   EXPORT_SYMBOL_FOR_KVM(tdx_free_control_page);
> >   
> > +static int __init tdx_dpamt_setup(char *str)
> > +{
> > +	return kstrtobool(str, &tdx_enable_dpamt) == 0;
> > +}
> > +
> > +__setup("tdx_dpamt=", tdx_dpamt_setup);
> It looks like core_param() is perferred over __setup() for a simple typed
> variable set from the cmdline?

Hmm... It does seem nice, but there isn't much use in the kernel actually.

> 
> How about:
> core_param(tdx_enable_dpamt, tdx_enable_dpamt, bool, 0444);

I'm not sure about 0444. We don't even want a sysfs knob for this either. It
looks like if you pass 0 it skips the sysfs knob.

> 
> >   void tdx_sys_disable(void)
> >   {
> >   	struct tdx_module_args args = {};
> > -- 
> > 2.56.1


  parent reply	other threads:[~2026-12-02  1:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  0:54 Rick Edgecombe
2026-11-26  8:13 ` Yan Zhao
2026-12-02  0:12   ` Dave Hansen
2026-12-02  1:14   ` Edgecombe, Rick P [this message]
2026-12-02  1:24     ` Yan Zhao
2026-11-26 10:48 ` Nikolay Borisov
2026-11-30 20:02   ` Edgecombe, Rick P
2026-11-30 20:42   ` Dave Hansen
2026-11-30 22:17     ` Nikolay Borisov
2026-11-30 22:20       ` Edgecombe, Rick P
2026-11-30 22:22       ` Dave Hansen

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=4b613304a9bf823c4045adfc9da7b3bcd1fee474.camel@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=ackerleytng@google.com \
    --cc=bp@alien8.de \
    --cc=chao.gao@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=kas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nik.borisov@suse.com \
    --cc=seanjc@google.com \
    --cc=tglx@kernel.org \
    --cc=vannapurve@google.com \
    --cc=x86@kernel.org \
    --cc=yan.y.zhao@intel.com \
    --cc=yilun.xu@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®