[LEDE-DEV] [PATCH 1/2] x86: add amd microcode entries to grub config

Stijn Segers foss at volatilesystems.org
Tue Apr 24 13:00:05 PDT 2018


Op di, 24 apr 2018 om 9:14 , schreef Tomasz Maciej Nowak 
<tomek_n at o2.pl>:
> W dniu 24.04.2018 o 21:03, Stijn Segers pisze:
>>  Hi Tomasz,
>> 
>>  Op di, 24 apr 2018 om 2:56 , schreef Tomasz Maciej Nowak 
>> <tomek_n at o2.pl>:
>>>  Create initrd enries for x86 images, that'll load amd microcode as 
>>> early
>>>  as possible. Also remove the preinit script responsible for late 
>>> load of
>>>  microcode.
>>> 
>>>  Signed-off-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
>>>  ---
>>>   .../x86/base-files/lib/preinit/02_load_x86_ucode     | 12 
>>> ------------
>>>   target/linux/x86/image/grub-iso.cfg                  |  3 +++
>>>   target/linux/x86/image/grub.cfg                      |  3 +++
>>>   3 files changed, 6 insertions(+), 12 deletions(-)
>>>   delete mode 100644 
>>> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
>> 
>>  I'm not sure what's going wrong here, I'm on a clean master tree 
>> but your first patch does not apply:
>> 
>>  $ git am 1.patch
>>  Applying: x86: add amd microcode entries to grub config
>>  error: patch failed: 
>> target/linux/x86/base-files/lib/preinit/02_load_x86_ucode:1
>>  error: target/linux/x86/base-files/lib/preinit/02_load_x86_ucode: 
>> patch does not apply
>>  error: patch failed: target/linux/x86/image/grub-iso.cfg:10
>>  error: target/linux/x86/image/grub-iso.cfg: patch does not apply
>>  error: patch failed: target/linux/x86/image/grub.cfg:10
>>  error: target/linux/x86/image/grub.cfg: patch does not apply
>>  Patch failed at 0001 x86: add amd microcode entries to grub config
>>  $ ./scripts/getver.sh
>>  r6755-d089a5d773
>> 
> 
> Hi.
> 
> I did wrongly spell myself out instead of "This series needs to be 
> applied on top of 'intel-microcode: load as early as possible' 
> series." it should be: "This series needs to be applied after 
> 'intel-microcode: load as early as possible' series.". Sorry about it.

Nope - turns out I was too quick, my apologies :-(. I merely looked at 
your first mail that actually had a patch for AMD and not at the one 
preceding it (which stated I needed to apply the Intel series first). 
Applied cleanly. How do I check whether it's functional? I grepped 
dmesg for AMD or ucode, but nothing shows. Logread doesn't work at all 
(but I reckon that's unrelated).

Dmesg does say full retpoline support has been enabled, but unless I'm 
mistaken that was a compiler feature, not something that could be 
solved with microcode alone?

Cheers

Stijn



> 
>>  Second does apply cleanly.
>> 
>>  Cheers
>> 
>>  Stijn
>> 
>> 
>>> 
>>>  diff --git 
>>> a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode 
>>> b/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
>>>  deleted file mode 100644
>>>  index d3a23e24b2..0000000000
>>>  --- a/target/linux/x86/base-files/lib/preinit/02_load_x86_ucode
>>>  +++ /dev/null
>>>  @@ -1,12 +0,0 @@
>>>  -#!/bin/sh
>>>  -# Copyright (C) 2018 OpenWrt.org
>>>  -
>>>  -do_load_x86_ucode() {
>>>  -    if grep -q AuthenticAMD /proc/cpuinfo; then
>>>  -        if [ -e "/sys/devices/system/cpu/microcode/reload" ]; then
>>>  -            echo 1 > /sys/devices/system/cpu/microcode/reload
>>>  -        fi
>>>  -    fi
>>>  -}
>>>  -
>>>  -boot_hook_add preinit_main do_load_x86_ucode
>>>  diff --git a/target/linux/x86/image/grub-iso.cfg 
>>> b/target/linux/x86/image/grub-iso.cfg
>>>  index 30b587bd1c..5a2d67b7b3 100644
>>>  --- a/target/linux/x86/image/grub-iso.cfg
>>>  +++ b/target/linux/x86/image/grub-iso.cfg
>>>  @@ -10,4 +10,7 @@ menuentry "OpenWrt" {
>>>       if [ -e /boot/intel-ucode.img ]; then
>>>           initrd /boot/intel-ucode.img
>>>       fi
>>>  +    if [ -e /boot/amd-ucode.img ]; then
>>>  +        initrd /boot/amd-ucode.img
>>>  +    fi
>>>   }
>>>  diff --git a/target/linux/x86/image/grub.cfg 
>>> b/target/linux/x86/image/grub.cfg
>>>  index dde24b95ce..caf38ec2c4 100644
>>>  --- a/target/linux/x86/image/grub.cfg
>>>  +++ b/target/linux/x86/image/grub.cfg
>>>  @@ -10,6 +10,9 @@ menuentry "OpenWrt" {
>>>       if [ -e /boot/intel-ucode.img ]; then
>>>           initrd /boot/intel-ucode.img
>>>       fi
>>>  +    if [ -e /boot/amd-ucode.img ]; then
>>>  +        initrd /boot/amd-ucode.img
>>>  +    fi
>>>   }
>>>   menuentry "OpenWrt (failsafe)" {
>>>       linux /boot/vmlinuz failsafe=true @CMDLINE@ noinitrd
>>>  --
>>>  2.17.0
>>> 
>>> 
>>>  _______________________________________________
>>>  Lede-dev mailing list
>>>  Lede-dev at lists.infradead.org
>>>  http://lists.infradead.org/mailman/listinfo/lede-dev
>> 
> --
> TMN




More information about the Lede-dev mailing list