From nobody Thu Nov 6 08:29:08 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1540802583501410.83880488734246; Mon, 29 Oct 2018 01:43:03 -0700 (PDT) Received: from localhost ([::1]:44155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH38Y-0002WQ-F4 for importer@patchew.org; Mon, 29 Oct 2018 04:43:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gH374-0001oS-PI for qemu-devel@nongnu.org; Mon, 29 Oct 2018 04:41:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gH36t-0003ho-83 for qemu-devel@nongnu.org; Mon, 29 Oct 2018 04:41:24 -0400 Received: from mga17.intel.com ([192.55.52.151]:36704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gH36r-0003gq-OD for qemu-devel@nongnu.org; Mon, 29 Oct 2018 04:41:18 -0400 Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2018 01:41:16 -0700 Received: from vmmtaopc.sh.intel.com ([10.239.13.112]) by orsmga006.jf.intel.com with ESMTP; 29 Oct 2018 01:41:15 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,439,1534834800"; d="scan'208";a="86389953" From: Tao Xu To: ehabkost@redhat.com Date: Mon, 29 Oct 2018 16:39:53 +0800 Message-Id: <5014b57f834dcfa8fd3781504d98dcf063d54fde.1540801392.git.tao3.xu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.151 Subject: [Qemu-devel] [PATCH v2 1/1] i386: Add PKU on Skylake-Server CPU model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jingqi.liu@intel.com, Tao Xu , qemu-devel@nongnu.org, robert.hu@intel.com, pbonzini@redhat.com, rth@twiddle.net Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 =3D TYPE_X86_CPU,\ .property =3D "x-hv-synic-kvm-only",\ .value =3D "on",\ - } + },{\ + .driver =3D "Skylake-Server" "-" TYPE_X86_CPU,\ + .property =3D "pku",\ + .value =3D "off",\ + },{\ + .driver =3D "Skylake-Server-IBRS" "-" TYPE_X86_CPU,\ + .property =3D "pku",\ + .value =3D "off",\ + }, =20 #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[] =3D { 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] =3D + 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[] =3D { 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] =3D + 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, --=20 2.17.1