Re: [PATCH] x86/virt/tdx: Add command line param for DPAMT

From: Edgecombe, Rick P

Date: Tue Dec 01 2026 - 20:15:07 EST


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