All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/1] Add PKU/OSPKE on Skylake-Server CPU model
@ 2018-10-17  9:30 Tao Xu
  2018-10-17  9:30 ` [Qemu-devel] [PATCH 1/1] i386: " Tao Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Tao Xu @ 2018-10-17  9:30 UTC (permalink / raw)
  To: ehabkost; +Cc: pbonzini, rth, jingqi.liu, robert.hu, qemu-devel, Tao Xu

This patch adds PKU/OSPKE on Skylake-Server CPU model

Tao Xu (1):
  i386: Add PKU/OSPKE on Skylake-Server CPU model

 target/i386/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.17.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-17  9:30 [Qemu-devel] [PATCH 0/1] Add PKU/OSPKE on Skylake-Server CPU model Tao Xu
@ 2018-10-17  9:30 ` Tao Xu
  2018-10-17 10:48   ` Paolo Bonzini
  0 siblings, 1 reply; 7+ messages in thread
From: Tao Xu @ 2018-10-17  9:30 UTC (permalink / raw)
  To: ehabkost; +Cc: pbonzini, rth, jingqi.liu, robert.hu, qemu-devel, Tao Xu

As the release document ref below link (page 13):
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

PKU is supported in Skylake Server (Only Server) and later, and 
on Intel(R) Xeon(R) Processor Scalable Family. OSPKE is to reads 
the value of PKRU (Instruction of PKU) into EAX and clears EDX.
So PKU/OSPKE are supposed to be in Skylake-Server CPU model. 
And PKU/OSPKE 's CPUID has been exposed to QEMU. But PKU/OSPKE
can't be find in Skylake-Server CPU model in the code. 
So this patch will fix PKU/OSPKE this issue in Skylake-Server 
CPU model.  

Signed-off-by: Tao Xu <tao3.xu@intel.com>
---
 target/i386/cpu.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index f24295e6e4..6ecd28c8a2 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -2322,6 +2322,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ |
             CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
             CPUID_7_0_EBX_AVX512VL | CPUID_7_0_EBX_CLFLUSHOPT,
+        .features[FEAT_7_0_ECX] =
+            CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE,
         /* Missing: XSAVES (not supported by some Linux versions,
          * including v4.1 to v4.12).
          * KVM doesn't yet expose any XSAVES state save component,
@@ -2372,6 +2374,8 @@ static X86CPUDefinition builtin_x86_defs[] = {
             CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ |
             CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD |
             CPUID_7_0_EBX_AVX512VL,
+        .features[FEAT_7_0_ECX] =
+            CPUID_7_0_ECX_PKU | CPUID_7_0_ECX_OSPKE,
         /* Missing: XSAVES (not supported by some Linux versions,
          * including v4.1 to v4.12).
          * KVM doesn't yet expose any XSAVES state save component,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-17  9:30 ` [Qemu-devel] [PATCH 1/1] i386: " Tao Xu
@ 2018-10-17 10:48   ` Paolo Bonzini
  2018-10-25 13:28     ` Eduardo Habkost
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Bonzini @ 2018-10-17 10:48 UTC (permalink / raw)
  To: Tao Xu, ehabkost; +Cc: rth, jingqi.liu, robert.hu, qemu-devel

On 17/10/2018 11:30, Tao Xu wrote:
> As the release document ref below link (page 13):
> https://software.intel.com/sites/default/files/managed/c5/15/\
> architecture-instruction-set-extensions-programming-reference.pdf
> 
> PKU is supported in Skylake Server (Only Server) and later, and 
> on Intel(R) Xeon(R) Processor Scalable Family. OSPKE is to reads 
> the value of PKRU (Instruction of PKU) into EAX and clears EDX.
> So PKU/OSPKE are supposed to be in Skylake-Server CPU model. 
> And PKU/OSPKE 's CPUID has been exposed to QEMU. But PKU/OSPKE
> can't be find in Skylake-Server CPU model in the code. 
> So this patch will fix PKU/OSPKE this issue in Skylake-Server 
> CPU model.  

OSPKE is not needed, since it is added automatically based on CR4 (and
is not set on boot).

Also, the guru of CPU model compatibility is Eduardo, so I'll wait for
him to chime in anyway.

Paolo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-17 10:48   ` Paolo Bonzini
@ 2018-10-25 13:28     ` Eduardo Habkost
  2018-10-26  5:53       ` Tao Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2018-10-25 13:28 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Tao Xu, rth, jingqi.liu, robert.hu, qemu-devel

On Wed, Oct 17, 2018 at 12:48:58PM +0200, Paolo Bonzini wrote:
> On 17/10/2018 11:30, Tao Xu wrote:
> > As the release document ref below link (page 13):
> > https://software.intel.com/sites/default/files/managed/c5/15/\
> > architecture-instruction-set-extensions-programming-reference.pdf
> > 
> > PKU is supported in Skylake Server (Only Server) and later, and 
> > on Intel(R) Xeon(R) Processor Scalable Family. OSPKE is to reads 
> > the value of PKRU (Instruction of PKU) into EAX and clears EDX.
> > So PKU/OSPKE are supposed to be in Skylake-Server CPU model. 
> > And PKU/OSPKE 's CPUID has been exposed to QEMU. But PKU/OSPKE
> > can't be find in Skylake-Server CPU model in the code. 
> > So this patch will fix PKU/OSPKE this issue in Skylake-Server 
> > CPU model.  
> 
> OSPKE is not needed, since it is added automatically based on CR4 (and
> is not set on boot).

Correct.

> 
> Also, the guru of CPU model compatibility is Eduardo, so I'll wait for
> him to chime in anyway.

Sorry for taking so long to reply.  This can be safely done only
if every host that is able to run Skylake-Server today is
guaranteed to support PKU.  Is that the case?

You'll also need Skylake-Server-*-cpu.pku=off entries on
PC_COMPAT_3_0 to keep PKU disabled on pc-*-3.0 and older.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-25 13:28     ` Eduardo Habkost
@ 2018-10-26  5:53       ` Tao Xu
  2018-10-26  8:22         ` Eduardo Habkost
  0 siblings, 1 reply; 7+ messages in thread
From: Tao Xu @ 2018-10-26  5:53 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, rth, jingqi.liu, robert.hu, qemu-devel

On 10/25/18 9:28 PM, Eduardo Habkost wrote:
> On Wed, Oct 17, 2018 at 12:48:58PM +0200, Paolo Bonzini wrote:
>> On 17/10/2018 11:30, Tao Xu wrote:
>>> As the release document ref below link (page 13):
>>> https://software.intel.com/sites/default/files/managed/c5/15/\
>>> architecture-instruction-set-extensions-programming-reference.pdf
>>>
>>> PKU is supported in Skylake Server (Only Server) and later, and
>>> on Intel(R) Xeon(R) Processor Scalable Family. OSPKE is to reads
>>> the value of PKRU (Instruction of PKU) into EAX and clears EDX.
>>> So PKU/OSPKE are supposed to be in Skylake-Server CPU model.
>>> And PKU/OSPKE 's CPUID has been exposed to QEMU. But PKU/OSPKE
>>> can't be find in Skylake-Server CPU model in the code.
>>> So this patch will fix PKU/OSPKE this issue in Skylake-Server
>>> CPU model.
>> OSPKE is not needed, since it is added automatically based on CR4 (and
>> is not set on boot).
> Correct.
>
>> Also, the guru of CPU model compatibility is Eduardo, so I'll wait for
>> him to chime in anyway.
> Sorry for taking so long to reply.  This can be safely done only
> if every host that is able to run Skylake-Server today is
> guaranteed to support PKU.  Is that the case?
>
> You'll also need Skylake-Server-*-cpu.pku=off entries on
> PC_COMPAT_3_0 to keep PKU disabled on pc-*-3.0 and older.
>
Thank you Eduardo,


But I can't find PC_COMPAT_3_0 in  include/hw/i386/pc.h. Will it exist on

QEMU 3.1 and will I add "pku=off" after QEMU 3.1  release?


Best Regard

Tao Xu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-26  5:53       ` Tao Xu
@ 2018-10-26  8:22         ` Eduardo Habkost
  2018-10-29  6:40           ` Tao Xu
  0 siblings, 1 reply; 7+ messages in thread
From: Eduardo Habkost @ 2018-10-26  8:22 UTC (permalink / raw)
  To: Tao Xu; +Cc: Paolo Bonzini, rth, jingqi.liu, robert.hu, qemu-devel

On Fri, Oct 26, 2018 at 01:53:10PM +0800, Tao Xu wrote:
> On 10/25/18 9:28 PM, Eduardo Habkost wrote:
> > On Wed, Oct 17, 2018 at 12:48:58PM +0200, Paolo Bonzini wrote:
> > > On 17/10/2018 11:30, Tao Xu wrote:
> > > > As the release document ref below link (page 13):
> > > > https://software.intel.com/sites/default/files/managed/c5/15/\
> > > > architecture-instruction-set-extensions-programming-reference.pdf
> > > > 
> > > > PKU is supported in Skylake Server (Only Server) and later, and
> > > > on Intel(R) Xeon(R) Processor Scalable Family. OSPKE is to reads
> > > > the value of PKRU (Instruction of PKU) into EAX and clears EDX.
> > > > So PKU/OSPKE are supposed to be in Skylake-Server CPU model.
> > > > And PKU/OSPKE 's CPUID has been exposed to QEMU. But PKU/OSPKE
> > > > can't be find in Skylake-Server CPU model in the code.
> > > > So this patch will fix PKU/OSPKE this issue in Skylake-Server
> > > > CPU model.
> > > OSPKE is not needed, since it is added automatically based on CR4 (and
> > > is not set on boot).
> > Correct.
> > 
> > > Also, the guru of CPU model compatibility is Eduardo, so I'll wait for
> > > him to chime in anyway.
> > Sorry for taking so long to reply.  This can be safely done only
> > if every host that is able to run Skylake-Server today is
> > guaranteed to support PKU.  Is that the case?
> > 
> > You'll also need Skylake-Server-*-cpu.pku=off entries on
> > PC_COMPAT_3_0 to keep PKU disabled on pc-*-3.0 and older.
> > 
> Thank you Eduardo,
> 
> 
> But I can't find PC_COMPAT_3_0 in  include/hw/i386/pc.h. Will it exist on
> 
> QEMU 3.1 and will I add "pku=off" after QEMU 3.1  release?

PC_COMPAT_3_0 was added to qemu.git master a few weeks ago, by
commit 9b4cf107b09d18ac30f46fd1c4de8585ccba030c.

-- 
Eduardo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 1/1] i386: Add PKU/OSPKE on Skylake-Server CPU model
  2018-10-26  8:22         ` Eduardo Habkost
@ 2018-10-29  6:40           ` Tao Xu
  0 siblings, 0 replies; 7+ messages in thread
From: Tao Xu @ 2018-10-29  6:40 UTC (permalink / raw)
  To: Eduardo Habkost; +Cc: Paolo Bonzini, rth, jingqi.liu, robert.hu, qemu-devel


On 10/26/18 4:22 PM, Eduardo Habkost wrote:
> On Fri, Oct 26, 2018 at 01:53:10PM +0800, Tao Xu wrote:
>> On 10/25/18 9:28 PM, Eduardo Habkost wrote:
>>
>>> Sorry for taking so long to reply.  This can be safely done only
>>> if every host that is able to run Skylake-Server today is
>>> guaranteed to support PKU.  Is that the case?

Yes, as the release document ref below link (page 13):
https://software.intel.com/sites/default/files/managed/c5/15/\
architecture-instruction-set-extensions-programming-reference.pdf

PKU is supported in Skylake Server (Only Server) and later.
So, every host that is able to run Skylake-Server today is to
to support PKU.

>>>
>>> You'll also need Skylake-Server-*-cpu.pku=off entries on
>>> PC_COMPAT_3_0 to keep PKU disabled on pc-*-3.0 and older.
>>>
>> Thank you Eduardo,
>>
>>
>> But I can't find PC_COMPAT_3_0 in  include/hw/i386/pc.h. Will it exist on
>>
>> QEMU 3.1 and will I add "pku=off" after QEMU 3.1  release?
> PC_COMPAT_3_0 was added to qemu.git master a few weeks ago, by
> commit 9b4cf107b09d18ac30f46fd1c4de8585ccba030c.
>
Thank you. I'll add this on the next version of this patch.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-10-29  6:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-17  9:30 [Qemu-devel] [PATCH 0/1] Add PKU/OSPKE on Skylake-Server CPU model Tao Xu
2018-10-17  9:30 ` [Qemu-devel] [PATCH 1/1] i386: " Tao Xu
2018-10-17 10:48   ` Paolo Bonzini
2018-10-25 13:28     ` Eduardo Habkost
2018-10-26  5:53       ` Tao Xu
2018-10-26  8:22         ` Eduardo Habkost
2018-10-29  6:40           ` Tao Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.