[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220506212930.GA2145958@private.email.ne.jp>
Date: Fri, 6 May 2022 14:29:30 -0700
From: Isaku Yamahata <isaku.yamahata@...il.com>
To: Xiaoyao Li <xiaoyao.li@...el.com>
Cc: isaku.yamahata@...el.com, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, isaku.yamahata@...il.com,
Paolo Bonzini <pbonzini@...hat.com>, erdemaktas@...gle.com,
Sean Christopherson <seanjc@...gle.com>,
Sagi Shahar <sagis@...gle.com>
Subject: Re: [RFC PATCH v6 011/104] KVM: TDX: Initialize TDX module when
loading kvm_intel.ko
On Fri, May 06, 2022 at 09:57:09PM +0800,
Xiaoyao Li <xiaoyao.li@...el.com> wrote:
> On 5/6/2022 2:14 AM, isaku.yamahata@...el.com wrote:
> > +int __init tdx_module_setup(void)
> > +{
> > + const struct tdsysinfo_struct *tdsysinfo;
> > + int ret = 0;
> > +
> > + BUILD_BUG_ON(sizeof(*tdsysinfo) != 1024);
> > + BUILD_BUG_ON(TDX_MAX_NR_CPUID_CONFIGS != 37);
> > +
> > + ret = tdx_detect();
> > + if (ret) {
> > + pr_info("Failed to detect TDX module.\n");
> > + return ret;
> > + }
> > +
> > + ret = tdx_init();
> > + if (ret) {
> > + pr_info("Failed to initialize TDX module.\n");
> > + return ret;
> > + }
> > +
> > + tdsysinfo = tdx_get_sysinfo();
> > + if (tdx_caps.nr_cpuid_configs > TDX_MAX_NR_CPUID_CONFIGS)
> > + return -EIO;
>
> It needs to check tdsysinfo->num_cpuid_config against
> TDX_MAX_NR_CPUID_CONFIG
>
> or move the check down after tdx_caps is initialized.
Thanks for catching it. I'll replace it with tdsysinfo->num_cpuid_config.
--
Isaku Yamahata <isaku.yamahata@...il.com>
Powered by blists - more mailing lists