[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aWnXMiIa8MzQt8qj@intel.com>
Date: Fri, 16 Jan 2026 14:14:10 +0800
From: Chao Gao <chao.gao@...el.com>
To: Xu Yilun <yilun.xu@...ux.intel.com>
CC: <linux-coco@...ts.linux.dev>, <linux-kernel@...r.kernel.org>,
<x86@...nel.org>, <reinette.chatre@...el.com>, <ira.weiny@...el.com>,
<kai.huang@...el.com>, <dan.j.williams@...el.com>, <sagis@...gle.com>,
<vannapurve@...gle.com>, <paulmck@...nel.org>, <nik.borisov@...e.com>,
"Farrah Chen" <farrah.chen@...el.com>, "Kirill A. Shutemov" <kas@...nel.org>,
"Dave Hansen" <dave.hansen@...ux.intel.com>, Thomas Gleixner
<tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov
<bp@...en8.de>, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH v2 11/21] x86/virt/seamldr: Allocate and populate a
module update request
On Wed, Jan 14, 2026 at 02:45:02PM +0800, Xu Yilun wrote:
>> +/* Allocate and populate a seamldr_params */
>> +static struct seamldr_params *alloc_seamldr_params(const void *module, int module_size,
>> + const void *sig, int sig_size)
>> +{
>> + struct seamldr_params *params;
>> + const u8 *ptr;
>> + int i;
>> +
>> + BUILD_BUG_ON(sizeof(struct seamldr_params) != SZ_4K);
>> + if (module_size > SEAMLDR_MAX_NR_MODULE_4KB_PAGES * SZ_4K)
>> + return ERR_PTR(-EINVAL);
>> +
>> + if (!IS_ALIGNED(module_size, SZ_4K) || !IS_ALIGNED(sig_size, SZ_4K) ||
>> + !IS_ALIGNED((unsigned long)module, SZ_4K) ||
>> + !IS_ALIGNED((unsigned long)sig, SZ_4K))
>> + return ERR_PTR(-EINVAL);
>> +
>> + /* seamldr_params accepts one 4KB-page for sigstruct */
>> + if (sig_size != SZ_4K)
>
>Why we check both IS_ALIGNED(sig_size, SZ_4K) and sig_size != SZ_4K, I
>assume the former is redundant.
Yes. it is redundant.
But in the next version, I will implement an extension that increases the
sigstruct size limit from a single 4KB page to four 4KB pages, so this will
become:
/* P-SEAMLDR accepts up to 4 4KB pages for sigstruct */
if (sig_size > 4 * SZ_4K)
return ERR_PTR(-EINVAL);
>
>> + return ERR_PTR(-EINVAL);
>> +
>> + params = (struct seamldr_params *)get_zeroed_page(GFP_KERNEL);
>> + if (!params)
>> + return ERR_PTR(-ENOMEM);
>> +
>> + params->scenario = SEAMLDR_SCENARIO_UPDATE;
>> + params->sigstruct_pa = (vmalloc_to_pfn(sig) << PAGE_SHIFT) +
>
>This void * buffer comes from FW_UPLOAD callback, which is a kvmalloc
>buffer, so we do vmalloc_to_pfn() here. But that knowledge resides in
>FW_UPLOAD driver context, the kAPI entry, seamldr_install_module()
>doesn't say that. So could we add the kernel-doc to specify this
>"const u8 *data" at ...
Good suggestion. Will do.
Powered by blists - more mailing lists