Skip to content
  • Borislav Petkov's avatar
    x86/microcode: Fix suspend to RAM with builtin microcode · 4b703305
    Borislav Petkov authored
    
    
    Usually, after we have found the proper microcode blob for the current
    machine, we stash it away for later use with save_microcode_in_initrd().
    
    However, with builtin microcode which doesn't come from the initrd, we
    don't call that function because CONFIG_BLK_DEV_INITRD=n and even if
    set, we don't have a valid initrd.
    
    In order to fix this, let's make save_microcode_in_initrd() an
    fs_initcall which runs before rootfs_initcall() as this was the time it
    was called previously through:
    
     rootfs_initcall(populate_rootfs)
     |-> free_initrd()
         |-> free_initrd_mem()
             |-> save_microcode_in_initrd()
    
    Also, we make it run independently from initrd functionality being
    present or not.
    
    And since it is called in the microcode loader only now, we can also
    make it static.
    
    Reported-and-tested-by: default avatarJim Bos <jim876@xs4all.nl>
    Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
    Cc: <stable@vger.kernel.org> # v4.6
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Brian Gerst <brgerst@gmail.com>
    Cc: Denys Vlasenko <dvlasenk@redhat.com>
    Cc: H. Peter Anvin <hpa@zytor.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: http://lkml.kernel.org/r/1465225850-7352-3-git-send-email-bp@alien8.de
    
    
    Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
    4b703305