<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/cpu/microcode/amd.c, branch linux-6.0.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.0.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.0.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2022-10-29T08:08:30Z</updated>
<entry>
<title>x86/microcode/AMD: Apply the patch early on every logical thread</title>
<updated>2022-10-29T08:08:30Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2022-10-05T10:00:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3820554c59a37d955ce9fc877751b4c9ab166d25'/>
<id>urn:sha1:3820554c59a37d955ce9fc877751b4c9ab166d25</id>
<content type='text'>
commit e7ad18d1169c62e6c78c01ff693fd362d9d65278 upstream.

Currently, the patch application logic checks whether the revision
needs to be applied on each logical CPU (SMT thread). Therefore, on SMT
designs where the microcode engine is shared between the two threads,
the application happens only on one of them as that is enough to update
the shared microcode engine.

However, there are microcode patches which do per-thread modification,
see Link tag below.

Therefore, drop the revision check and try applying on each thread. This
is what the BIOS does too so this method is very much tested.

Btw, change only the early paths. On the late loading paths, there's no
point in doing per-thread modification because if is it some case like
in the bugzilla below - removing a CPUID flag - the kernel cannot go and
un-use features it has detected are there early. For that, one should
use early loading anyway.

  [ bp: Fixes does not contain the oldest commit which did check for
    equality but that is good enough. ]

Fixes: 8801b3fcb574 ("x86/microcode/AMD: Rework container parsing")
Reported-by:  Ștefan Talpalaru &lt;stefantalpalaru@yahoo.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Tested-by:  Ștefan Talpalaru &lt;stefantalpalaru@yahoo.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Link: https://bugzilla.kernel.org/show_bug.cgi?id=216211
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/microcode/AMD: Track patch allocation size explicitly</title>
<updated>2022-10-21T10:38:16Z</updated>
<author>
<name>Kees Cook</name>
</author>
<published>2022-09-22T03:10:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7dda7ac5f0b6bff12afb83f971659fa4d0849fe3'/>
<id>urn:sha1:7dda7ac5f0b6bff12afb83f971659fa4d0849fe3</id>
<content type='text'>
[ Upstream commit 712f210a457d9c32414df246a72781550bc23ef6 ]

In preparation for reducing the use of ksize(), record the actual
allocation size for later memcpy(). This avoids copying extra
(uninitialized!) bytes into the patch buffer when the requested
allocation size isn't exactly the size of a kmalloc bucket.
Additionally, fix potential future issues where runtime bounds checking
will notice that the buffer was allocated to a smaller value than
returned by ksize().

Fixes: 757885e94a22 ("x86, microcode, amd: Early microcode patch loading support for AMD")
Suggested-by: Daniel Micay &lt;danielmicay@gmail.com&gt;
Signed-off-by: Kees Cook &lt;keescook@chromium.org&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lore.kernel.org/lkml/CA+DvKQ+bp7Y7gmaVhacjv9uF6Ar-o4tet872h4Q8RPYPJjcJQA@mail.gmail.com/
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/microcode: Use the firmware_loader built-in API</title>
<updated>2021-10-22T12:13:50Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2021-10-21T15:58:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9d48960414c708f5d1327aa8b90664cf3467c480'/>
<id>urn:sha1:9d48960414c708f5d1327aa8b90664cf3467c480</id>
<content type='text'>
The microcode loader has been looping through __start_builtin_fw down to
__end_builtin_fw to look for possibly built-in firmware for microcode
updates.

Now that the firmware loader code has exported an API for looping
through the kernel's built-in firmware section, use it and drop the x86
implementation in favor.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Signed-off-by: Luis Chamberlain &lt;mcgrof@kernel.org&gt;
Link: https://lore.kernel.org/r/20211021155843.1969401-4-mcgrof@kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/microcode/amd: Remove unneeded break</title>
<updated>2020-10-26T11:18:22Z</updated>
<author>
<name>Tom Rix</name>
</author>
<published>2020-10-19T20:06:29Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=880396c86a1f3663c22b74fef34353f05a1263ec'/>
<id>urn:sha1:880396c86a1f3663c22b74fef34353f05a1263ec</id>
<content type='text'>
A break is not needed if it is preceded by a return.

Signed-off-by: Tom Rix &lt;trix@redhat.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20201019200629.17247-1-trix@redhat.com
</content>
</entry>
<entry>
<title>x86/microcode/amd: Fix two -Wunused-but-set-variable warnings</title>
<updated>2019-10-01T09:36:09Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2019-09-28T14:53:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2b730952066cd022d1f46e801f06ca6ca9878823'/>
<id>urn:sha1:2b730952066cd022d1f46e801f06ca6ca9878823</id>
<content type='text'>
The dummy variable is the high part of the microcode revision MSR which
is defined as reserved. Mark it unused so that W=1 builds don't trigger
the above warning.

No functional changes.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20190928162559.26294-1-bp@alien8.de
</content>
</entry>
<entry>
<title>Merge tag 'v5.2-rc4' into mauro</title>
<updated>2019-06-14T20:18:53Z</updated>
<author>
<name>Jonathan Corbet</name>
</author>
<published>2019-06-14T20:18:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8afecfb0ec961e37e61b2d19c4fa71617a9482de'/>
<id>urn:sha1:8afecfb0ec961e37e61b2d19c4fa71617a9482de</id>
<content type='text'>
We need to pick up post-rc1 changes to various document files so they don't
get lost in Mauro's massive RST conversion push.
</content>
</entry>
<entry>
<title>docs: fix broken documentation links</title>
<updated>2019-06-08T19:42:13Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
</author>
<published>2019-06-07T18:54:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cb1aaebea8d79860181559d7b5d482aea63db113'/>
<id>urn:sha1:cb1aaebea8d79860181559d7b5d482aea63db113</id>
<content type='text'>
Mostly due to x86 and acpi conversion, several documentation
links are still pointing to the old file. Fix them.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab+samsung@kernel.org&gt;
Reviewed-by: Wolfram Sang &lt;wsa@the-dreams.de&gt;
Reviewed-by: Sven Van Asbroeck &lt;TheSven73@gmail.com&gt;
Reviewed-by: Bhupesh Sharma &lt;bhsharma@redhat.com&gt;
Acked-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
</content>
</entry>
<entry>
<title>treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 353</title>
<updated>2019-06-05T15:37:09Z</updated>
<author>
<name>Thomas Gleixner</name>
</author>
<published>2019-05-31T08:09:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fc01b568f760ced13430851c82c297de1415aa18'/>
<id>urn:sha1:fc01b568f760ced13430851c82c297de1415aa18</id>
<content type='text'>
Based on 1 normalized pattern(s):

  licensed under the terms of the gnu general public license version 2
  see file copying for details

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 1 file(s).

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Reviewed-by: Armijn Hemel &lt;armijn@tjaldur.nl&gt;
Reviewed-by: Allison Randal &lt;allison@lohutok.net&gt;
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190531081035.403801661@linutronix.de
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>x86/microcode/amd: Don't falsely trick the late loading mechanism</title>
<updated>2019-01-31T15:54:32Z</updated>
<author>
<name>Thomas Lendacky</name>
</author>
<published>2019-01-31T14:33:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=912139cfbfa6a2bc1da052314d2c29338dae1f6a'/>
<id>urn:sha1:912139cfbfa6a2bc1da052314d2c29338dae1f6a</id>
<content type='text'>
The load_microcode_amd() function searches for microcode patches and
attempts to apply a microcode patch if it is of different level than the
currently installed level.

While the processor won't actually load a level that is less than
what is already installed, the logic wrongly returns UCODE_NEW thus
signaling to its caller reload_store() that a late loading should be
attempted.

If the file-system contains an older microcode revision than what is
currently running, such a late microcode reload can result in these
misleading messages:

  x86/CPU: CPU features have changed after loading microcode, but might not take effect.
  x86/CPU: Please consider either early loading through initrd/built-in or a potential BIOS update.

These messages were issued on a system where SME/SEV are not
enabled by the BIOS (MSR C001_0010[23] = 0b) because during boot,
early_detect_mem_encrypt() is called and cleared the SME and SEV
features in this case.

However, after the wrong late load attempt, get_cpu_cap() is called and
reloads the SME and SEV feature bits, resulting in the messages.

Update the microcode level check to not attempt microcode loading if the
current level is greater than(!) and not only equal to the current patch
level.

 [ bp: massage commit message. ]

Fixes: 2613f36ed965 ("x86/microcode: Attempt late loading only when new microcode is present")
Signed-off-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Ingo Molnar &lt;mingo@redhat.com&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: x86-ml &lt;x86@kernel.org&gt;
Link: https://lkml.kernel.org/r/154894518427.9406.8246222496874202773.stgit@tlendack-t1.amdoffice.net
</content>
</entry>
<entry>
<title>x86/microcode/AMD: Update copyright</title>
<updated>2018-11-19T09:55:12Z</updated>
<author>
<name>Borislav Petkov</name>
</author>
<published>2018-10-20T13:04:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2ffcbce39ea1e355eed8c6527308624f366f1c58'/>
<id>urn:sha1:2ffcbce39ea1e355eed8c6527308624f366f1c58</id>
<content type='text'>
Adjust copyright.

Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: x86@kernel.org
Link: https://lkml.kernel.org/r/20181107170218.7596-17-bp@alien8.de
</content>
</entry>
</feed>
