From: Luis Chamberlain <mcgrof@kernel.org>
To: Jari Ruusu <jari.ruusu@gmail.com>
Cc: Borislav Petkov <bp@alien8.de>, Fenghua Yu <fenghua.yu@intel.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
johannes.berg@intel.com, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: Fix built-in early-load Intel microcode alignment
Date: Mon, 13 Jan 2020 15:47:39 +0000 [thread overview]
Message-ID: <20200113154739.GB11244@42.do-not-panic.com> (raw)
In-Reply-To: <CACMCwJK-2DHZDA_F5Z3wsEUEKJSc3uOwwPD4HRoYGW7A+kA75w@mail.gmail.com>
On Sun, Jan 12, 2020 at 03:00:53PM +0200, Jari Ruusu wrote:
> Intel Software Developer's Manual, volume 3, chapter 9.11.6 says:
> "Note that the microcode update must be aligned on a 16-byte
> boundary and the size of the microcode update must be 1-KByte
> granular"
>
> When early-load Intel microcode is loaded from initramfs,
> userspace tool 'iucode_tool' has already 16-byte aligned those
> microcode bits in that initramfs image. Image that was created
> something like this:
>
> iucode_tool --write-earlyfw=FOO.cpio microcode-files...
>
> However, when early-load Intel microcode is loaded from built-in
> firmware BLOB using CONFIG_EXTRA_FIRMWARE= kernel config option,
> that 16-byte alignment is not guaranteed.
Thanks for the patch!
So what happens with you use the built-in firmware loader for
the Intel microcode at this time? I am surprised this issue
wasn't reported earlier, so thanks for picking it up, but to
be complete such a change requires a bit more information.
What exactly happens now?
> Fix this by forcing all built-in firmware BLOBs to 16-byte
> alignment.
That's a huge stretch, see below.
> Signed-off-by: Jari Ruusu <jari.ruusu@gmail.com>
>
> --- a/drivers/base/firmware_loader/builtin/Makefile
> +++ b/drivers/base/firmware_loader/builtin/Makefile
> @@ -17,7 +17,7 @@
> filechk_fwbin = \
> echo "/* Generated by $(src)/Makefile */" ;\
> echo " .section .rodata" ;\
> - echo " .p2align $(ASM_ALIGN)" ;\
> + echo " .p2align 4" ;\
You are forcing 16 byte alignment to *all* built-in firmware, and some
architectures may have a different requirement. If things used to work
with ASM_ALIGN which is a construct only used for this code, but your
change fixes it with Intel microcode loading -- it however *may* break
things for other built-in firmware used. In particular if you note above
it used to align things to 2^3 so 8 bytes if on CONFIG_64BIT, otherwise
things get aligned to 2^2 so 4 bytes.
So I'd like to determine first if we really need this. Then if so,
either add a new global config option, and worst comes to worst
figure out a way to do it per driver. I don't think we'd need it
per driver.
If set as a global new config option, we can use the same logic and
allow an architecture override if the user / architecture kconfig
configures it such:
config ARCH_DEFAULT_FIRMWARE_ALIGNMENT
string "Default architecture firmware aligmnent"
"4" if 64BIT
"3" if !64BIT
config FIRMWARE_BUILTIN_ALIGN
string "Built in firmware aligment requirement"
default ARCH_DEFAULT_FIRMWARE_ALIGNMENT if !ARCH_CUSTOM_FIRMWARE_ALIGNMENT
default ARCH_CUSTOM_FIRMWARE_ALIGNMENT_VAL if ARCH_CUSTOM_FIRMWARE_ALIGNMENT
Some good description goes here
Or something like that.
Luis
next prev parent reply other threads:[~2020-01-13 15:47 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-12 13:00 Fix built-in early-load Intel microcode alignment Jari Ruusu
2020-01-12 13:03 ` Jari Ruusu
2020-01-12 14:02 ` Greg KH
2020-01-13 6:30 ` Jari Ruusu
2020-01-13 6:42 ` Greg KH
2020-01-13 15:47 ` Luis Chamberlain [this message]
2020-01-13 19:44 ` Linus Torvalds
2020-01-15 2:27 ` Luis Chamberlain
2020-01-18 20:10 ` Bjorn Andersson
2020-01-13 19:58 ` Jari Ruusu
2020-01-13 20:08 ` Borislav Petkov
2020-01-13 20:30 ` Jari Ruusu
2020-01-13 20:46 ` Borislav Petkov
2020-01-15 2:15 ` Luis Chamberlain
2020-01-15 18:46 ` Jari Ruusu
2020-01-15 18:58 ` Luis Chamberlain
2020-01-15 19:41 ` Linus Torvalds
2020-01-15 19:00 ` Andy Lutomirski
2020-01-15 19:15 ` Jari Ruusu
2020-01-15 19:49 ` Linus Torvalds
2020-01-16 6:55 ` Jari Ruusu
2020-01-16 19:16 ` Raj, Ashok
2020-01-17 9:47 ` Jari Ruusu
2020-02-03 20:10 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200113154739.GB11244@42.do-not-panic.com \
--to=mcgrof@kernel.org \
--cc=bp@alien8.de \
--cc=fenghua.yu@intel.com \
--cc=jari.ruusu@gmail.com \
--cc=johannes.berg@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).