Skip to content
  • Tom Lendacky's avatar
    x86/CPU/AMD: Clear RDRAND CPUID bit on AMD family 15h/16h · c49a0a80
    Tom Lendacky authored
    There have been reports of RDRAND issues after resuming from suspend on
    some AMD family 15h and family 16h systems. This issue stems from a BIOS
    not performing the proper steps during resume to ensure RDRAND continues
    to function properly.
    RDRAND support is indicated by CPUID Fn00000001_ECX[30]. This bit can be
    reset by clearing MSR C001_1004[62]. Any software that checks for RDRAND
    support using CPUID, including the kernel, will believe that RDRAND is
    not supported.
    Update the CPU initialization to clear the RDRAND CPUID bit for any family
    15h and 16h processor that supports RDRAND. If it is known that the family
    15h or family 16h system does not have an RDRAND resume issue or that the
    system will not be placed in suspend, the "rdrand=force" kernel parameter
    can be used to stop the clearing of the RDRAND CPUID bit.
    Additionally, update the suspend and resume path to save and restore the
    MSR C001_1004 value to ensure that the RDRAND CPUID setting remains in
    place after resuming from suspend.
    Note, that clearing the RDRAND CPUID bit does not prevent a processor
    that normally supports the RDRAND instruction from executing it. So any
    code that determined the support based on family and model won't #UD.
    Signed-off-by: default avatarTom Lendacky <>
    Signed-off-by: default avatarBorislav Petkov <>
    Cc: Andrew Cooper <>
    Cc: Andrew Morton <>
    Cc: Chen Yu <>
    Cc: "H. Peter Anvin" <>
    Cc: Ingo Molnar <>
    Cc: Jonathan Corbet <>
    Cc: Josh Poimboeuf <>
    Cc: Juergen Gross <>
    Cc: Kees Cook <>
    Cc: "" <>
    Cc: "" <>
    Cc: Nathan Chancellor <>
    Cc: Paolo Bonzini <>
    Cc: Pavel Machek <>
    Cc: "Rafael J. Wysocki" <>
    Cc: <>
    Cc: Thomas Gleixner <>
    Cc: "" <>