[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e35bd204-a8d5-f88b-c042-c9eca792493a@amd.com>
Date: Tue, 30 Jan 2018 16:40:16 -0600
From: Tom Lendacky <thomas.lendacky@....com>
To: "Kirill A. Shutemov" <kirill@...temov.name>
Cc: "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
Thomas Gleixner <tglx@...utronix.de>,
"H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Borislav Petkov <bp@...e.de>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCHv3 1/3] x86/mm/encrypt: Move page table helpers into
separate translation unit
On 1/30/2018 4:28 PM, Kirill A. Shutemov wrote:
> On Tue, Jan 30, 2018 at 04:26:03PM -0600, Tom Lendacky wrote:
>> 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@...ux.intel.com>
>>
>> Just one minor comment at the end. With that change:
>>
>> Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
>>
>>> ---
>>> 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.
>
> Why? Will we need it beyond arch/x86/mm/ in the future?
I just think it would be best to keep all the memory encryption stuff
together.
Thanks,
Tom
>
Powered by blists - more mailing lists