<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/cpu/feat_ctl.c, branch linux-6.15.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.15.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-08-25T12:41:19Z</updated>
<entry>
<title>x86/cpu: Clarify the error message when BIOS does not support SGX</title>
<updated>2024-08-25T12:41:19Z</updated>
<author>
<name>WangYuli</name>
</author>
<published>2024-08-25T10:46:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7678a53a1688e3d03337ca884b284c6e7b060ec5'/>
<id>urn:sha1:7678a53a1688e3d03337ca884b284c6e7b060ec5</id>
<content type='text'>
When SGX is not supported by the BIOS, the kernel log contains the error
'SGX disabled by BIOS', which can be confusing since there might not be an
SGX-related option in the BIOS settings.

For the kernel it's difficult to distinguish between the BIOS not
supporting SGX and the BIOS supporting SGX but having it disabled.

Therefore, update the error message to 'SGX disabled or unsupported by
BIOS' to make it easier for those reading kernel logs to understand what's
happening.

Reported-by: Bo Wu &lt;wubo@uniontech.com&gt;
Co-developed-by: Zelong Xiang &lt;xiangzelong@uniontech.com&gt;
Signed-off-by: Zelong Xiang &lt;xiangzelong@uniontech.com&gt;
Signed-off-by: WangYuli &lt;wangyuli@uniontech.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Acked-by: Kai Huang &lt;kai.huang@intel.com&gt;
Link: https://lore.kernel.org/all/F8D977CB368423F3+20240825104653.1294624-1-wangyuli@uniontech.com
Closes: https://github.com/linuxdeepin/developer-center/issues/10032
</content>
</entry>
<entry>
<title>x86/cpu: Add a VMX flag to enumerate 5-level EPT support to userspace</title>
<updated>2024-02-23T00:03:56Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2024-01-10T00:23:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b1a3c366cbc783d6600b357ccfec2f440eed5453'/>
<id>urn:sha1:b1a3c366cbc783d6600b357ccfec2f440eed5453</id>
<content type='text'>
Add a VMX flag in /proc/cpuinfo, ept_5level, so that userspace can query
whether or not the CPU supports 5-level EPT paging.  EPT capabilities are
enumerated via MSR, i.e. aren't accessible to userspace without help from
the kernel, and knowing whether or not 5-level EPT is supported is useful
for debug, triage, testing, etc.

For example, when EPT is enabled, bits 51:48 of guest physical addresses
are consumed by the CPU if and only if 5-level EPT is enabled.  For CPUs
with MAXPHYADDR &gt; 48, KVM *can't* map all legal guest memory without
5-level EPT, making 5-level EPT support valuable information for userspace.

Reported-by: Yi Lai &lt;yi1.lai@intel.com&gt;
Cc: Tao Su &lt;tao1.su@linux.intel.com&gt;
Cc: Xudong Hao &lt;xudong.hao@intel.com&gt;
Link: https://lore.kernel.org/r/20240110002340.485595-1-seanjc@google.com
Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
</content>
</entry>
<entry>
<title>x86/cpu: Include the header of init_ia32_feat_ctl()'s prototype</title>
<updated>2022-09-26T15:06:27Z</updated>
<author>
<name>Luciano Leão</name>
</author>
<published>2022-09-22T20:00:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=30ea703a38ef76ca119673cd8bdd05c6e068e2ac'/>
<id>urn:sha1:30ea703a38ef76ca119673cd8bdd05c6e068e2ac</id>
<content type='text'>
Include the header containing the prototype of init_ia32_feat_ctl(),
solving the following warning:

  $ make W=1 arch/x86/kernel/cpu/feat_ctl.o
  arch/x86/kernel/cpu/feat_ctl.c:112:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes]
    112 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c)

This warning appeared after commit

  5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup")

had moved the function init_ia32_feat_ctl()'s prototype from
arch/x86/kernel/cpu/cpu.h to arch/x86/include/asm/cpu.h.

Note that, before the commit mentioned above, the header include "cpu.h"
(arch/x86/kernel/cpu/cpu.h) was added by commit

  0e79ad863df43 ("x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()")

solely to fix init_ia32_feat_ctl()'s missing prototype. So, the header
include "cpu.h" is no longer necessary.

  [ bp: Massage commit message. ]

Fixes: 5d5103595e9e5 ("x86/cpu: Reinitialize IA32_FEAT_CTL MSR on BSP during wakeup")
Signed-off-by: Luciano Leão &lt;lucianorsleao@gmail.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Nícolas F. R. A. Prado &lt;n@nfraprado.net&gt;
Link: https://lore.kernel.org/r/20220922200053.1357470-1-lucianorsleao@gmail.com
</content>
</entry>
<entry>
<title>x86/cpu: Add new VMX feature, Tertiary VM-Execution control</title>
<updated>2022-06-08T08:47:13Z</updated>
<author>
<name>Robert Hoo</name>
</author>
<published>2022-04-19T15:32:40Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=465932db25f3664893b66152c7b190afd28c32db'/>
<id>urn:sha1:465932db25f3664893b66152c7b190afd28c32db</id>
<content type='text'>
A new 64-bit control field "tertiary processor-based VM-execution
controls", is defined [1]. It's controlled by bit 17 of the primary
processor-based VM-execution controls.

Different from its brother VM-execution fields, this tertiary VM-
execution controls field is 64 bit. So it occupies 2 vmx_feature_leafs,
TERTIARY_CTLS_LOW and TERTIARY_CTLS_HIGH.

Its companion VMX capability reporting MSR,MSR_IA32_VMX_PROCBASED_CTLS3
(0x492), is also semantically different from its brothers, whose 64 bits
consist of all allow-1, rather than 32-bit allow-0 and 32-bit allow-1 [1][2].
Therefore, its init_vmx_capabilities() is a little different from others.

[1] ISE 6.2 "VMCS Changes"
https://www.intel.com/content/www/us/en/develop/download/intel-architecture-instruction-set-extensions-programming-reference.html

[2] SDM Vol3. Appendix A.3

Reviewed-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Maxim Levitsky &lt;mlevitsk@redhat.com&gt;
Signed-off-by: Robert Hoo &lt;robert.hu@linux.intel.com&gt;
Signed-off-by: Zeng Guang &lt;guang.zeng@intel.com&gt;
Message-Id: &lt;20220419153240.11549-1-guang.zeng@intel.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>x86/cpu/intel: Allow SGX virtualization without Launch Control support</title>
<updated>2021-04-06T07:43:41Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2021-03-19T07:22:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=332bfc7becf479de8a55864cc5ed0024baea28aa'/>
<id>urn:sha1:332bfc7becf479de8a55864cc5ed0024baea28aa</id>
<content type='text'>
The kernel will currently disable all SGX support if the hardware does
not support launch control.  Make it more permissive to allow SGX
virtualization on systems without Launch Control support.  This will
allow KVM to expose SGX to guests that have less-strict requirements on
the availability of flexible launch control.

Improve error message to distinguish between three cases.  There are two
cases where SGX support is completely disabled:
1) SGX has been disabled completely by the BIOS
2) SGX LC is locked by the BIOS.  Bare-metal support is disabled because
   of LC unavailability.  SGX virtualization is unavailable (because of
   Kconfig).
One where it is partially available:
3) SGX LC is locked by the BIOS.  Bare-metal support is disabled because
   of LC unavailability.  SGX virtualization is supported.

Signed-off-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Co-developed-by: Kai Huang &lt;kai.huang@intel.com&gt;
Signed-off-by: Kai Huang &lt;kai.huang@intel.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Acked-by: Dave Hansen &lt;dave.hansen@intel.com&gt;
Link: https://lkml.kernel.org/r/b3329777076509b3b601550da288c8f3c406a865.1616136308.git.kai.huang@intel.com
</content>
</entry>
<entry>
<title>x86/cpufeatures: Make SGX_LC feature bit depend on SGX bit</title>
<updated>2021-03-25T16:33:11Z</updated>
<author>
<name>Kai Huang</name>
</author>
<published>2021-03-19T07:22:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e9a15a40e857fc6ccfbb05fec7b184e9003057df'/>
<id>urn:sha1:e9a15a40e857fc6ccfbb05fec7b184e9003057df</id>
<content type='text'>
Move SGX_LC feature bit to CPUID dependency table to make clearing all
SGX feature bits easier. Also remove clear_sgx_caps() since it is just
a wrapper of setup_clear_cpu_cap(X86_FEATURE_SGX) now.

Suggested-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Kai Huang &lt;kai.huang@intel.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Sean Christopherson &lt;seanjc@google.com&gt;
Acked-by: Dave Hansen &lt;dave.hansen@intel.com&gt;
Acked-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Link: https://lkml.kernel.org/r/5d4220fd0a39f52af024d3fa166231c1d498dd10.1616136308.git.kai.huang@intel.com
</content>
</entry>
<entry>
<title>x86/cpu/intel: Add a nosgx kernel parameter</title>
<updated>2020-11-17T13:36:13Z</updated>
<author>
<name>Jarkko Sakkinen</name>
</author>
<published>2020-11-12T22:01:19Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=38853a303982e3be3eccb1a1132399a5c5e2d806'/>
<id>urn:sha1:38853a303982e3be3eccb1a1132399a5c5e2d806</id>
<content type='text'>
Add a kernel parameter to disable SGX kernel support and document it.

 [ bp: Massage. ]

Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Reviewed-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Acked-by: Jethro Beekman &lt;jethro@fortanix.com&gt;
Tested-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Link: https://lkml.kernel.org/r/20201112220135.165028-9-jarkko@kernel.org
</content>
</entry>
<entry>
<title>x86/cpu/intel: Detect SGX support</title>
<updated>2020-11-17T13:36:13Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2020-11-12T22:01:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=224ab3527f89f69ae57dc53555826667ac46a3cc'/>
<id>urn:sha1:224ab3527f89f69ae57dc53555826667ac46a3cc</id>
<content type='text'>
Kernel support for SGX is ultimately decided by the state of the launch
control bits in the feature control MSR (MSR_IA32_FEAT_CTL).  If the
hardware supports SGX, but neglects to support flexible launch control, the
kernel will not enable SGX.

Enable SGX at feature control MSR initialization and update the associated
X86_FEATURE flags accordingly.  Disable X86_FEATURE_SGX (and all
derivatives) if the kernel is not able to establish itself as the authority
over SGX Launch Control.

All checks are performed for each logical CPU (not just boot CPU) in order
to verify that MSR_IA32_FEATURE_CONTROL is correctly configured on all
CPUs. All SGX code in this series expects the same configuration from all
CPUs.

This differs from VMX where X86_FEATURE_VMX is intentionally cleared only
for the current CPU so that KVM can provide additional information if KVM
fails to load like which CPU doesn't support VMX.  There’s not much the
kernel or an administrator can do to fix the situation, so SGX neglects to
convey additional details about these kinds of failures if they occur.

Signed-off-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Co-developed-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Jarkko Sakkinen &lt;jarkko@kernel.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Jethro Beekman &lt;jethro@fortanix.com&gt;
Link: https://lkml.kernel.org/r/20201112220135.165028-8-jarkko@kernel.org
</content>
</entry>
<entry>
<title>x86/cpu: Fix a -Wmissing-prototypes warning for init_ia32_feat_ctl()</title>
<updated>2020-03-23T11:01:59Z</updated>
<author>
<name>Benjamin Thiel</name>
</author>
<published>2020-03-23T10:59:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0e79ad863df43b01090ae18c97de5c3787f069c6'/>
<id>urn:sha1:0e79ad863df43b01090ae18c97de5c3787f069c6</id>
<content type='text'>
Add a missing include in order to fix -Wmissing-prototypes warning:

  arch/x86/kernel/cpu/feat_ctl.c:95:6: warning: no previous prototype for ‘init_ia32_feat_ctl’ [-Wmissing-prototypes]
     95 | void init_ia32_feat_ctl(struct cpuinfo_x86 *c)

Signed-off-by: Benjamin Thiel &lt;b.thiel@posteo.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200323105934.26597-1-b.thiel@posteo.de
</content>
</entry>
<entry>
<title>x86/cpu: Print "VMX disabled" error message iff KVM is enabled</title>
<updated>2020-01-15T12:26:50Z</updated>
<author>
<name>Sean Christopherson</name>
</author>
<published>2020-01-14T20:25:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bb02e2cb715a3f3552dbe765ea4a07799e4dff43'/>
<id>urn:sha1:bb02e2cb715a3f3552dbe765ea4a07799e4dff43</id>
<content type='text'>
Don't print an error message about VMX being disabled by BIOS if KVM,
the sole user of VMX, is disabled. E.g. if KVM is disabled and the MSR
is unlocked, the kernel will intentionally disable VMX when locking
feature control and then complain that "BIOS" disabled VMX.

Fixes: ef4d3bf19855 ("x86/cpu: Clear VMX feature flag if VMX is not fully enabled")
Signed-off-by: Sean Christopherson &lt;sean.j.christopherson@intel.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20200114202545.20296-1-sean.j.christopherson@intel.com
</content>
</entry>
</feed>
