9ae3a8
From 7fa8107debfd4c659b77a8ba12b96144dfbdc113 Mon Sep 17 00:00:00 2001
9ae3a8
From: "plai@redhat.com" <plai@redhat.com>
9ae3a8
Date: Mon, 4 Feb 2019 17:29:44 +0100
9ae3a8
Subject: [PATCH 1/3] x86/cpu: Enable CLDEMOTE(Demote Cache Line) cpu feature
9ae3a8
9ae3a8
RH-Author: plai@redhat.com
9ae3a8
Message-id: <1549301384-19698-1-git-send-email-plai@redhat.com>
9ae3a8
Patchwork-id: 84205
9ae3a8
O-Subject: [RHEL7.7 qemu-kvm PATCH BZ 1537773 RESEND] x86/cpu: Enable CLDEMOTE(Demote Cache Line) cpu feature
9ae3a8
Bugzilla: 1537773
9ae3a8
RH-Acked-by: Bandan Das <bsd@redhat.com>
9ae3a8
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
From: Jingqi Liu <jingqi.liu@intel.com>
9ae3a8
9ae3a8
The CLDEMOTE instruction hints to hardware that the cache line that
9ae3a8
contains the linear address should be moved("demoted") from
9ae3a8
the cache(s) closest to the processor core to a level more distant
9ae3a8
from the processor core. This may accelerate subsequent accesses
9ae3a8
to the line by other cores in the same coherence domain,
9ae3a8
especially if the line was written by the core that demotes the line.
9ae3a8
9ae3a8
Intel Snow Ridge has added new cpu feature, CLDEMOTE.
9ae3a8
The new cpu feature needs to be exposed to guest VM.
9ae3a8
9ae3a8
The bit definition:
9ae3a8
CPUID.(EAX=7,ECX=0):ECX[bit 25] CLDEMOTE
9ae3a8
9ae3a8
The release document ref below link:
9ae3a8
https://software.intel.com/sites/default/files/managed/c5/15/\
9ae3a8
architecture-instruction-set-extensions-programming-reference.pdf
9ae3a8
9ae3a8
Signed-off-by: Jingqi Liu <jingqi.liu@intel.com>
9ae3a8
Message-Id: <1525406253-54846-1-git-send-email-jingqi.liu@intel.com>
9ae3a8
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
9ae3a8
(cherry picked from commit 0da0fb062841d0dcd8ba47e4a989d2e952cdf0ff)
9ae3a8
Signed-off-by: Paul Lai <plai@redhat.com>
9ae3a8
9ae3a8
Resolved Conflicts:
9ae3a8
        target/i386/cpu.c [doesn't exist]
9ae3a8
                changes made to target-i386/cpu.c
9ae3a8
        target/i386/cpu.h [doesn't exist]
9ae3a8
                changes made to target-i386/cpu.h
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 target-i386/cpu.c | 2 +-
9ae3a8
 target-i386/cpu.h | 1 +
9ae3a8
 2 files changed, 2 insertions(+), 1 deletion(-)
9ae3a8
9ae3a8
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
9ae3a8
index a36483e..c9603df 100644
9ae3a8
--- a/target-i386/cpu.c
9ae3a8
+++ b/target-i386/cpu.c
9ae3a8
@@ -162,7 +162,7 @@ static const char *cpuid_7_0_ecx_feature_name[] = {
9ae3a8
     "avx512bitalg", NULL, "avx512-vpopcntdq", NULL,
9ae3a8
     NULL, NULL, NULL, NULL,
9ae3a8
     NULL, NULL, "rdpid", NULL,
9ae3a8
-    NULL, NULL, NULL, NULL,
9ae3a8
+    NULL, "cldemote", NULL, NULL,
9ae3a8
     NULL, NULL, NULL, NULL,
9ae3a8
 };
9ae3a8
 
9ae3a8
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
9ae3a8
index 73437f1..5d47ab8 100644
9ae3a8
--- a/target-i386/cpu.h
9ae3a8
+++ b/target-i386/cpu.h
9ae3a8
@@ -593,6 +593,7 @@ typedef uint32_t FeatureWordArray[FEATURE_WORDS];
9ae3a8
 #define CPUID_7_0_ECX_AVX512BITALG (1U << 12)
9ae3a8
 #define CPUID_7_0_ECX_AVX512_VPOPCNTDQ (1U << 14) /* POPCNT for vectors of DW/QW */
9ae3a8
 #define CPUID_7_0_ECX_RDPID    (1U << 22)
9ae3a8
+#define CPUID_7_0_ECX_CLDEMOTE (1U << 25)  /* CLDEMOTE Instruction */
9ae3a8
 
9ae3a8
 #define CPUID_7_0_EDX_AVX512_4VNNIW (1U << 2) /* AVX512 Neural Network Instructions */
9ae3a8
 #define CPUID_7_0_EDX_AVX512_4FMAPS (1U << 3) /* AVX512 Multiply Accumulation Single Precision */
9ae3a8
-- 
9ae3a8
1.8.3.1
9ae3a8