On 1/24/2018 10:36 AM, Kirill A. Shutemov wrote: > There are bunch of functions in mem_encrypt.c that operate on the > identity mapping, which means they want virtual addresses to be equal to > physical one, without PAGE_OFFSET shift. > > We also need to avoid paravirtualizaion call there. > > Getting this done is tricky. We cannot use usual page table helpers. > It forces us to open-code a lot of things. It makes code ugly and hard > to modify. > > We can get it work with the page table helpers, but it requires few > preprocessor tricks. These tricks may have side effects for the rest of > the file. > > Let's isolate such functions into own translation unit. > > Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx> Just one minor comment at the end. With that change: Reviewed-by: Tom Lendacky <thomas.lendacky@xxxxxxx> > --- > arch/x86/mm/Makefile | 14 +- > arch/x86/mm/mem_encrypt.c | 578 +---------------------------------- > arch/x86/mm/mem_encrypt_identity.c | 596 +++++++++++++++++++++++++++++++++++++ > arch/x86/mm/mm_internal.h | 1 + > 4 files changed, 607 insertions(+), 582 deletions(-) > create mode 100644 arch/x86/mm/mem_encrypt_identity.c > ... > diff --git a/arch/x86/mm/mm_internal.h b/arch/x86/mm/mm_internal.h > index 4e1f6e1b8159..7b4fc4386d90 100644 > --- a/arch/x86/mm/mm_internal.h > +++ b/arch/x86/mm/mm_internal.h > @@ -19,4 +19,5 @@ extern int after_bootmem; > > void update_cache_mode_entry(unsigned entry, enum page_cache_mode cache); > > +extern bool sev_enabled __section(.data); Lets move this into arch/x86/include/asm/mem_encrypt.h and then add #include <linux/mem_encrypt.h> to mem_encrypt_identity.c. Thanks, Tom > #endif /* __X86_MM_INTERNAL_H */ > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>