Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1673397
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v7 31/36] x86/mm, kexec: Allow kexec to be used with SME |
| Date | 2017-06-23 11:00 +0200 |
| Message-ID | <tVsBB-8nM-35@gated-at.bofh.it> (permalink) |
| References | <tTjsJ-5VA-5@gated-at.bofh.it> <tVsBB-8nM-37@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Jun 16, 2017 at 01:55:45PM -0500, Tom Lendacky wrote:
> Provide support so that kexec can be used to boot a kernel when SME is
> enabled.
>
> Support is needed to allocate pages for kexec without encryption. This
> is needed in order to be able to reboot in the kernel in the same manner
> as originally booted.
>
> Additionally, when shutting down all of the CPUs we need to be sure to
> flush the caches and then halt. This is needed when booting from a state
> where SME was not active into a state where SME is active (or vice-versa).
> Without these steps, it is possible for cache lines to exist for the same
> physical location but tagged both with and without the encryption bit. This
> can cause random memory corruption when caches are flushed depending on
> which cacheline is written last.
>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> arch/x86/include/asm/init.h | 1 +
> arch/x86/include/asm/kexec.h | 8 ++++++++
> arch/x86/include/asm/pgtable_types.h | 1 +
> arch/x86/kernel/machine_kexec_64.c | 22 +++++++++++++++++++++-
> arch/x86/kernel/process.c | 17 +++++++++++++++--
> arch/x86/mm/ident_map.c | 12 ++++++++----
> include/linux/kexec.h | 14 ++++++++++++++
> kernel/kexec_core.c | 12 +++++++++++-
> 8 files changed, 79 insertions(+), 8 deletions(-)
...
> diff --git a/include/linux/kexec.h b/include/linux/kexec.h
> index c9481eb..5d17fd6 100644
> --- a/include/linux/kexec.h
> +++ b/include/linux/kexec.h
> @@ -334,6 +334,20 @@ static inline void *boot_phys_to_virt(unsigned long entry)
> return phys_to_virt(boot_phys_to_phys(entry));
> }
>
> +#ifndef arch_kexec_post_alloc_pages
> +static inline int arch_kexec_post_alloc_pages(void *vaddr, unsigned int pages,
> + gfp_t gfp)
> +{
> + return 0;
> +}
> +#endif
Just a nitpick:
static inline int arch_kexec_post_alloc_pages(void *vaddr, unsigned int pages, gfp_t gfp) { return 0; }
static inline void arch_kexec_pre_free_pages(void *vaddr, unsigned int pages) { }
Other than that:
Reviewed-by: Borislav Petkov <bp@suse.de>
--
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [PATCH v7 31/36] x86/mm, kexec: Allow kexec to be used with SME Borislav Petkov <bp@alien8.de> - 2017-06-23 11:00 +0200
csiph-web