[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190410212501.jglzib2qcygjnmxc@linutronix.de>
Date: Wed, 10 Apr 2019 23:25:02 +0200
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>,
linux-kernel@...r.kernel.org, x86@...nel.org,
Andy Lutomirski <luto@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
kvm@...r.kernel.org, "Jason A. Donenfeld" <Jason@...c4.com>,
Rik van Riel <riel@...riel.com>,
Dave Hansen <dave.hansen@...el.com>
Subject: Re: [PATCH 12/27] x86/pkru: Provide .*_pkru_ins() functions
On 2019-04-10 18:52:41 [+0200], Borislav Petkov wrote:
> On Wed, Apr 10, 2019 at 06:36:15PM +0200, Borislav Petkov wrote:
> > Well, this is going in the wrong direction. The proper thing to do would
> > be to have:
> >
> > rdpkru()
> > wrpkru()
> >
> > which only do the inline asm with the respective opcodes. Just like
> > rdtsc(), clflush(), etc.
>
> IOW, like this:
>
> ---
> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
> index 2779ace16d23..e2948ce1376c 100644
> --- a/arch/x86/include/asm/pgtable.h
> +++ b/arch/x86/include/asm/pgtable.h
> @@ -127,14 +127,14 @@ static inline int pte_dirty(pte_t pte)
> static inline u32 read_pkru(void)
> {
> if (boot_cpu_has(X86_FEATURE_OSPKE))
> - return __read_pkru();
> + return rdpkru();
> return 0;
> }
>
> static inline void write_pkru(u32 pkru)
> {
> if (boot_cpu_has(X86_FEATURE_OSPKE))
> - __write_pkru(pkru);
> + wrpkru(pkru);
I think if this is a simple
's@...rite_pkru_ins@...kru@g'
's@...ead_pkru_ins@...kru@g'
then it should work just fine and match what Dave asked for.
> }
>
> static inline int pte_young(pte_t pte)
Sebastian
Powered by blists - more mailing lists