Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-16 Thread Andrew Cooper
On 16/01/2023 3:04 pm, Jan Beulich wrote: > On 16.01.2023 15:57, Andrew Cooper wrote: >> On 16/01/2023 2:17 pm, Jan Beulich wrote: >>> On 16.01.2023 14:00, Andrew Cooper wrote: --- a/xen/arch/x86/acpi/power.c +++ b/xen/arch/x86/acpi/power.c @@ -299,6 +299,13 @@ static int

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-16 Thread Jan Beulich
On 16.01.2023 15:57, Andrew Cooper wrote: > On 16/01/2023 2:17 pm, Jan Beulich wrote: >> On 16.01.2023 14:00, Andrew Cooper wrote: >>> --- a/xen/arch/x86/acpi/power.c >>> +++ b/xen/arch/x86/acpi/power.c >>> @@ -299,6 +299,13 @@ static int enter_state(u32 state) >>>   >>>

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-16 Thread Andrew Cooper
On 16/01/2023 2:17 pm, Jan Beulich wrote: > On 16.01.2023 14:00, Andrew Cooper wrote: >> On 12/01/2023 4:51 pm, Andrew Cooper wrote: >>> On 12/01/2023 1:10 pm, Jan Beulich wrote: On 10.01.2023 18:18, Andrew Cooper wrote: > --- a/xen/arch/x86/setup.c > +++ b/xen/arch/x86/setup.c >

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-16 Thread Jan Beulich
On 16.01.2023 14:00, Andrew Cooper wrote: > On 12/01/2023 4:51 pm, Andrew Cooper wrote: >> On 12/01/2023 1:10 pm, Jan Beulich wrote: >>> On 10.01.2023 18:18, Andrew Cooper wrote: --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -54,6 +54,7 @@ #include #include

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-16 Thread Andrew Cooper
On 12/01/2023 4:51 pm, Andrew Cooper wrote: > On 12/01/2023 1:10 pm, Jan Beulich wrote: >> On 10.01.2023 18:18, Andrew Cooper wrote: >>> --- a/xen/arch/x86/setup.c >>> +++ b/xen/arch/x86/setup.c >>> @@ -54,6 +54,7 @@ >>> #include >>> #include >>> #include >>> +#include >>> #include >>>

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-12 Thread Andrew Cooper
On 12/01/2023 1:10 pm, Jan Beulich wrote: > On 10.01.2023 18:18, Andrew Cooper wrote: >> +static inline void wrpkrs(uint32_t pkrs) >> +{ >> +uint32_t *this_pkrs = _cpu(pkrs); >> + >> +if ( *this_pkrs != pkrs ) >> +{ >> +*this_pkrs = pkrs; >> + >> +wrmsr_ns(MSR_PKRS,

Re: [PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-12 Thread Jan Beulich
On 10.01.2023 18:18, Andrew Cooper wrote: > +static inline void wrpkrs(uint32_t pkrs) > +{ > +uint32_t *this_pkrs = _cpu(pkrs); > + > +if ( *this_pkrs != pkrs ) > +{ > +*this_pkrs = pkrs; > + > +wrmsr_ns(MSR_PKRS, pkrs, 0); > +} > +} > + > +static inline void

[PATCH v2 5/8] x86/hvm: Context switch MSR_PKRS

2023-01-10 Thread Andrew Cooper
Under PKS, MSR_PKRS is available and based on the CPUID policy alone, and usable independently of CR4.PKS. See the large comment in prot-key.h for details of the context switching arrangement. Use WRMSRNS right away, as we don't care about serialsing properties for context switching this MSR.