mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 00:56:44 +07:00
46d010e04a
Add support to check if memory encryption is active in the kernel and that it has been enabled on the AP. If memory encryption is active in the kernel but has not been enabled on the AP, then set the memory encryption bit (bit 23) of MSR_K8_SYSCFG to enable memory encryption on that AP and allow the AP to continue start up. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Borislav Petkov <bp@suse.de> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Borislav Petkov <bp@alien8.de> Cc: Brijesh Singh <brijesh.singh@amd.com> Cc: Dave Young <dyoung@redhat.com> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Jonathan Corbet <corbet@lwn.net> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Larry Woodman <lwoodman@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Matt Fleming <matt@codeblueprint.co.uk> Cc: Michael S. Tsirkin <mst@redhat.com> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Radim Krčmář <rkrcmar@redhat.com> Cc: Rik van Riel <riel@redhat.com> Cc: Toshimitsu Kani <toshi.kani@hpe.com> Cc: kasan-dev@googlegroups.com Cc: kvm@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-efi@vger.kernel.org Cc: linux-mm@kvack.org Link: http://lkml.kernel.org/r/37e29b99c395910f56ca9f8ecf7b0439b28827c8.1500319216.git.thomas.lendacky@amd.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
85 lines
1.7 KiB
C
85 lines
1.7 KiB
C
#ifndef _ARCH_X86_REALMODE_H
|
|
#define _ARCH_X86_REALMODE_H
|
|
|
|
/*
|
|
* Flag bit definitions for use with the flags field of the trampoline header
|
|
* in the CONFIG_X86_64 variant.
|
|
*/
|
|
#define TH_FLAGS_SME_ACTIVE_BIT 0
|
|
#define TH_FLAGS_SME_ACTIVE BIT(TH_FLAGS_SME_ACTIVE_BIT)
|
|
|
|
#ifndef __ASSEMBLY__
|
|
|
|
#include <linux/types.h>
|
|
#include <asm/io.h>
|
|
|
|
/* This must match data at realmode.S */
|
|
struct real_mode_header {
|
|
u32 text_start;
|
|
u32 ro_end;
|
|
/* SMP trampoline */
|
|
u32 trampoline_start;
|
|
u32 trampoline_status;
|
|
u32 trampoline_header;
|
|
#ifdef CONFIG_X86_64
|
|
u32 trampoline_pgd;
|
|
#endif
|
|
/* ACPI S3 wakeup */
|
|
#ifdef CONFIG_ACPI_SLEEP
|
|
u32 wakeup_start;
|
|
u32 wakeup_header;
|
|
#endif
|
|
/* APM/BIOS reboot */
|
|
u32 machine_real_restart_asm;
|
|
#ifdef CONFIG_X86_64
|
|
u32 machine_real_restart_seg;
|
|
#endif
|
|
};
|
|
|
|
/* This must match data at trampoline_32/64.S */
|
|
struct trampoline_header {
|
|
#ifdef CONFIG_X86_32
|
|
u32 start;
|
|
u16 gdt_pad;
|
|
u16 gdt_limit;
|
|
u32 gdt_base;
|
|
#else
|
|
u64 start;
|
|
u64 efer;
|
|
u32 cr4;
|
|
u32 flags;
|
|
#endif
|
|
};
|
|
|
|
extern struct real_mode_header *real_mode_header;
|
|
extern unsigned char real_mode_blob_end[];
|
|
|
|
extern unsigned long initial_code;
|
|
extern unsigned long initial_gs;
|
|
extern unsigned long initial_stack;
|
|
|
|
extern unsigned char real_mode_blob[];
|
|
extern unsigned char real_mode_relocs[];
|
|
|
|
#ifdef CONFIG_X86_32
|
|
extern unsigned char startup_32_smp[];
|
|
extern unsigned char boot_gdt[];
|
|
#else
|
|
extern unsigned char secondary_startup_64[];
|
|
#endif
|
|
|
|
static inline size_t real_mode_size_needed(void)
|
|
{
|
|
if (real_mode_header)
|
|
return 0; /* already allocated. */
|
|
|
|
return ALIGN(real_mode_blob_end - real_mode_blob, PAGE_SIZE);
|
|
}
|
|
|
|
void set_real_mode_mem(phys_addr_t mem, size_t size);
|
|
void reserve_real_mode(void);
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
#endif /* _ARCH_X86_REALMODE_H */
|