Re: [PATCH] x86/virt/tdx: Add command line param for DPAMT
From: Yan Zhao
Date: Tue Dec 01 2026 - 21:06:59 EST
On Wed, Dec 02, 2026 at 09:14:53AM +0800, Edgecombe, Rick P wrote:
> 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?
Yes. On and off. Sure.
> > > +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.
Right, core_param() is later introduced. See
Author: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Date: Wed Oct 22 10:00:23 2008 -0500
core_param() for genuinely core kernel parameters
There are a lot of one-liner uses of __setup() in the kernel: they're
cumbersome and not queryable (definitely not settable) via /sys. Yet
it's ugly to simplify them to module_param(), because by default that
inserts a prefix of the module name (usually filename).
So, introduce a "core_param". The parameter gets no prefix, but
appears in /sys/module/kernel/parameters/ (if non-zero perms arg). I
thought about using the name "core", but that's more common than
"kernel". And if you create a module called "kernel", you will die
a horrible death.
Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
It looks like __setup() is an old way, which fills "struct obs_kernel_param"
and gets parsed by obsolete_checksetup() during kernel boot-up. __setup() does
not have knob in sysfs.
> > 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.
Hmm, a leading 0 is not a permission bit, but a C's octal prefix.
Only all 0 will skip the sysfs knob. With 0444, there's a sysfs knob:
/sys/module/kernel/parameters/tdx_enable_dpamt, with perms "-r--r--r--".
> > > void tdx_sys_disable(void)
> > > {
> > > struct tdx_module_args args = {};
> > > --
> > > 2.56.1
>