[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ce358ac4-a473-158c-ccce-c50af813fb6d@intel.com>
Date: Mon, 12 Sep 2022 07:31:13 -0700
From: Reinette Chatre <reinette.chatre@...el.com>
To: Jarkko Sakkinen <jarkko@...nel.org>,
Kai Huang <kai.huang@...el.com>
CC: <linux-sgx@...r.kernel.org>, <dave.hansen@...ux.intel.com>,
<seanjc@...gle.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/intel: Clear SGX bit if both SGX driver and KVM SGX
are not enabled
Hi Jarkko,
On 9/12/2022 3:47 AM, Jarkko Sakkinen wrote:
> On Fri, Sep 09, 2022 at 08:08:53PM +1200, Kai Huang wrote:
>> Currently on platform which has SGX enabled, if CONFIG_X86_SGX is not
>> enabled, the X86_FEATURE_SGX is not cleared, resulting in /proc/cpuinfo
>> shows "sgx" feature. This is not desired.
>>
>> Clear SGX feature bit if both SGX driver and KVM SGX are not enabled in
>> init_ia32_feat_ctl().
>>
>> Signed-off-by: Kai Huang <kai.huang@...el.com>
>
> Is it a pattern that flags are cleared when they are disabled by the
> kernel? I don't know the answer for this.
There appears to be relevant text in Documentation/x86/cpuinfo.rst:
tl;dr "In general, /proc/cpuinfo shows features which the kernel supports."
Longer quote:
"If users want to know if a feature is available on a given system, they
try to find the flag in /proc/cpuinfo. If a given flag is present, it
means that the kernel supports it and is currently making it available.
If such flag represents a hardware feature, it also means that the
hardware supports it.
If the expected flag does not appear in /proc/cpuinfo, things are murkier.
Users need to find out the reason why the flag is missing and find the way
how to enable it, which is not always easy. There are several factors that
can explain missing flags: the expected feature failed to enable, the feature
is missing in hardware, platform firmware did not enable it, the feature is
disabled at build or run time, an old kernel is in use, or the kernel does
not support the feature and thus has not enabled it. In general, /proc/cpuinfo
shows features which the kernel supports. For a full list of CPUID flags
which the CPU supports, use tools/arch/x86/kcpuid."
>
> I could imagine that sometimes you might want to know whether the CPU
> supports a feature, even if e.g. your distribution kernel does not.
Indeed ... this seems to fall into the "murkier" part of the above quote.
Reinette
Powered by blists - more mailing lists