Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1526446

Re: [RFC PATCH v3 11/20] x86: Add support for changing memory encryption attribute

From Borislav Petkov <bp@alien8.de>
Newsgroups linux.kernel
Subject Re: [RFC PATCH v3 11/20] x86: Add support for changing memory encryption attribute
Date 2016-11-21 09:30 +0100
Message-ID <sFS9c-7d8-3@gated-at.bofh.it> (permalink)
References <sBVfj-4HF-7@gated-at.bofh.it> <sEyYW-3Mb-43@gated-at.bofh.it> <sEyYW-3Mb-41@gated-at.bofh.it> <sFS9c-7d8-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Sat, Nov 19, 2016 at 12:48:27PM -0600, Tom Lendacky wrote:
> Should I move this functionality into the sme_set_mem_* functions or
> remove the sme_set_mem_* functions and use the set_memory_* functions
> directly.  The latter means calculating the number of pages, but makes
> it clear that this works on a page level while the former keeps
> everything the mem_encrypt.c file (and I can change that to take in a
> page count so that it is clear about the page boundary usage).

A user of that interface doesn't care, right?

All she wants to do is pass in an address and size and the code will
figure out everything. And I think address and size is the simplest two
args you can pass. numpages can be calculated from it. As you do in
sme_set_mem_*.

And you need to do it all in pageattr.c because it uses the cpa wankery
in there so you probably want to define

int set_memory_dec(unsigned long addr, size_t size)
int set_memory_enc(unsigned long addr, size_t size)

there which both simply call

__set_memory_enc_dec(unsigned long addr, size_t size, bool enc)

and it goes and figures out everything, builds the cpa_data and does the
mapping.

That looks very simple and clean to me.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [RFC PATCH v3 11/20] x86: Add support for changing memory  encryption attribute Borislav Petkov <bp@alien8.de> - 2016-11-17 18:50 +0100
  Re: [RFC PATCH v3 11/20] x86: Add support for changing memory  encryption attribute Borislav Petkov <bp@alien8.de> - 2016-11-21 09:30 +0100

csiph-web