On Sat, Sep 16, 2017 at 07:34:14AM -0500, Brijesh Singh wrote: > From: Tom Lendacky <thomas.lendacky@xxxxxxx> > > Secure Encrypted Virtualization (SEV) does not support string I/O, so > unroll the string I/O operation into a loop operating on one element at > a time. > > Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx> > Cc: Ingo Molnar <mingo@xxxxxxxxxx> > Cc: "H. Peter Anvin" <hpa@xxxxxxxxx> > Cc: Borislav Petkov <bp@xxxxxxx> > Cc: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Cc: David Laight <David.Laight@xxxxxxxxxx> > Cc: Arnd Bergmann <arnd@xxxxxxxx> > Cc: x86@xxxxxxxxxx > Cc: linux-kernel@xxxxxxxxxxxxxxx > Signed-off-by: Tom Lendacky <thomas.lendacky@xxxxxxx> > Signed-off-by: Brijesh Singh <brijesh.singh@xxxxxxx> > --- > arch/x86/include/asm/io.h | 42 ++++++++++++++++++++++++++++++++++++++---- > arch/x86/mm/mem_encrypt.c | 8 ++++++++ > 2 files changed, 46 insertions(+), 4 deletions(-) > > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h > index c40a95c33bb8..07c28ee398d9 100644 > --- a/arch/x86/include/asm/io.h > +++ b/arch/x86/include/asm/io.h > @@ -265,6 +265,20 @@ static inline void slow_down_io(void) > > #endif > > +#ifdef CONFIG_AMD_MEM_ENCRYPT > + > +extern struct static_key_false __sev; > +static inline bool __sev_active(void) > +{ > + return static_branch_unlikely(&__sev); > +} I'm still not happy about the two's sev_active() and __sev_active() naming. Perhaps the __ variant should be called sev_key_active() or ... Blergh, my naming sux. In any case, it would be cool to be more obvious from the naming which variant uses the static key and which is the slow one. I'm also thinking of maybe having a single sev_active() which uses the static key but that is perhaps an overkill on slow paths... Hrrmmm. In any case, looking at gcc output, the unrolled variant gets put out-of-line, as expected. -- Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --