Re: [PATCH V10 08/44] Documentation/pkeys: Add initial PKS documentation

From: Ira Weiny
Date: Tue May 10 2022 - 13:18:47 EST


On Mon, May 09, 2022 at 03:03:48PM -0700, Kees Cook wrote:
> On Tue, Apr 19, 2022 at 10:06:13AM -0700, ira.weiny@xxxxxxxxx wrote:
> > From: Ira Weiny <ira.weiny@xxxxxxxxx>
> >
> > Add initial overview and configuration information about PKS.
> >
> > Cc: "Moger, Babu" <Babu.Moger@xxxxxxx>
> > Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
> >
> > ---
> > Changes for V9
> > Feedback from Dave Hansen
> > Remove overview and move relevant text to the main pkey
> > overview which covers both user ans kernel keys.
> > Add an example of using Kconfig
> > Move MSR details to later patches
> > ---
> > Documentation/core-api/protection-keys.rst | 43 ++++++++++++++++++++--
> > 1 file changed, 39 insertions(+), 4 deletions(-)
> >
> > diff --git a/Documentation/core-api/protection-keys.rst b/Documentation/core-api/protection-keys.rst
> > index bf28ac0401f3..13eedb0119e1 100644
> > --- a/Documentation/core-api/protection-keys.rst
> > +++ b/Documentation/core-api/protection-keys.rst
> > @@ -13,6 +13,11 @@ Pkeys Userspace (PKU) is a feature which can be found on:
> > * Intel client CPUs, Tiger Lake (11th Gen Core) and later
> > * Future AMD CPUs
> >
> > +Protection Keys Supervisor (PKS) is a feature which can be found on:
> > + * Sapphire Rapids (and later) "Scalable Processor" Server CPUs
> > + * Future non-server Intel parts.
> > + * qemu: https://www.qemu.org/2021/04/30/qemu-6-0-0/
>
> It looks like QEMU has pass-through support, but not emulation?

I'm not an expert on qemu but I believe the support is emulated with TCG.

"TCG can emulate the PKS feature (protection keys for supervisor pages)."
-- https://wiki.qemu.org/ChangeLog/6.0

> It'd be
> really nice to have this feature emulated so it would be possible to
> test the code. (Or I need to find a machine that supports this...)

Both Rick and I have been able to run with the following options to qemu:

qemu-system-x86_64 ... -machine accel=tcg -cpu qemu64,+pks ...

Ira