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

This patch adds PKU on Skylake-Server CPU model.

Changelog:
v2
	Remove OSPKE which is not needed. Add 
	Skylake-Server-*-cpu.pku=off entries on
	PC_COMPAT_3_0 to keep PKU disabled on 
	pc-*-3.0 and older.

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

 include/hw/i386/pc.h | 10 +++++++++-
 target/i386/cpu.c    |  4 ++++
 2 files changed, 13 insertions(+), 1 deletion(-)

-- 
2.17.1

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

* [Qemu-devel] [PATCH v2 1/1] i386: Add PKU on Skylake-Server CPU model
  2018-10-29  8:39 [Qemu-devel] [PATCH v2 0/1] Add PKU on Skylake-Server CPU model Tao Xu
@ 2018-10-29  8:39 ` Tao Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Tao Xu @ 2018-10-29  8:39 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. So PKU is supposed
to be in Skylake-Server CPU model. And PKU's CPUID has been
exposed to QEMU. But PKU can't be find in Skylake-Server CPU
model in the code. So this patch will fix this issue in
Skylake-Server CPU model.

Signed-off-by: Tao Xu <tao3.xu@intel.com>
---
 include/hw/i386/pc.h | 10 +++++++++-
 target/i386/cpu.c    |  4 ++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index dfe6746692..136fe497b6 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -300,7 +300,15 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
         .driver   = TYPE_X86_CPU,\
         .property = "x-hv-synic-kvm-only",\
         .value    = "on",\
-    }
+    },{\
+        .driver   = "Skylake-Server" "-" TYPE_X86_CPU,\
+        .property = "pku",\
+        .value    = "off",\
+    },{\
+        .driver   = "Skylake-Server-IBRS" "-" TYPE_X86_CPU,\
+        .property = "pku",\
+        .value    = "off",\
+    },
 
 #define PC_COMPAT_2_12 \
     HW_COMPAT_2_12 \
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 1469a1be01..6fb7bee0f2 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,
         /* 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,
         /* 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] 2+ messages in thread

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-29  8:39 [Qemu-devel] [PATCH v2 0/1] Add PKU on Skylake-Server CPU model Tao Xu
2018-10-29  8:39 ` [Qemu-devel] [PATCH v2 1/1] i386: " 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.