[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210308183058.GC12548@zn.tnic>
Date: Mon, 8 Mar 2021 19:30:58 +0100
From: Borislav Petkov <bp@...en8.de>
To: Juergen Gross <jgross@...e.com>
Cc: xen-devel@...ts.xenproject.org, x86@...nel.org,
linux-kernel@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Deep Shah <sdeep@...are.com>,
"VMware, Inc." <pv-drivers@...are.com>
Subject: Re: [PATCH v5 11/12] x86/paravirt: switch functions with custom code
to ALTERNATIVE
On Mon, Mar 08, 2021 at 01:28:43PM +0100, Juergen Gross wrote:
> diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
> index 36cd71fa097f..04b3067f31b5 100644
> --- a/arch/x86/include/asm/paravirt.h
> +++ b/arch/x86/include/asm/paravirt.h
> @@ -137,7 +137,8 @@ static inline void write_cr0(unsigned long x)
>
> static inline unsigned long read_cr2(void)
> {
> - return PVOP_CALLEE0(unsigned long, mmu.read_cr2);
> + return PVOP_ALT_CALLEE0(unsigned long, mmu.read_cr2,
> + "mov %%cr2, %%rax;", ~X86_FEATURE_XENPV);
Just some cursory poking first - indepth review later.
Do I see this correctly that the negated feature can be expressed with, to use
this example here:
ALTERNATIVE_TERNARY(mmu.read_cr2, X86_FEATURE_XENPV, "", "mov %%cr2, %%rax;");
?
And then you don't need to touch the patching code for ~feature handling
and the flags byte.
If you want it syntactically sugared, you can define a separate
ALTERNATIVE_NOT macro using ALTERNATIVE_TERNARY...
Hmmm.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists