qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hendrik Wuethrich <whendrik@google.com>
To: qemu-devel@nongnu.org, eduardo@habkost.net,
	richard.henderson@linaro.org,  marcel.apfelbaum@gmail.com,
	mst@redhat.com, pbonzini@redhat.com
Cc: peternewman@google.com, "‪Hendrik Wüthrich" <whendrik@google.com>
Subject: [PATCH v1 7/9] Add RDT feature flags.
Date: Fri, 19 Jul 2024 16:29:27 +0000	[thread overview]
Message-ID: <20240719162929.1197154-8-whendrik@google.com> (raw)
In-Reply-To: <20240719162929.1197154-1-whendrik@google.com>

From: ‪Hendrik Wüthrich <whendrik@google.com>

Add RDT features to feature word / TCG.

Signed-off-by: Hendrik Wüthrich <whendrik@google.com>
---
 target/i386/cpu.c | 30 ++++++++++++++++++++++++++++--
 target/i386/cpu.h |  2 ++
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index c61981bf82..1cf5e5d5ff 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -864,7 +864,8 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
           CPUID_7_0_EBX_CLFLUSHOPT |            \
           CPUID_7_0_EBX_CLWB | CPUID_7_0_EBX_MPX | CPUID_7_0_EBX_FSGSBASE | \
           CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_RDSEED | \
-          CPUID_7_0_EBX_SHA_NI | CPUID_7_0_EBX_KERNEL_FEATURES)
+          CPUID_7_0_EBX_SHA_NI | CPUID_7_0_EBX_KERNEL_FEATURES | \
+          CPUID_7_0_EBX_PQM | CPUID_7_0_EBX_PQE)
           /* missing:
           CPUID_7_0_EBX_HLE
           CPUID_7_0_EBX_INVPCID, CPUID_7_0_EBX_RTM */
@@ -900,6 +901,7 @@ void x86_cpu_vendor_words2str(char *dst, uint32_t vendor1,
 #define TCG_SGX_12_0_EAX_FEATURES 0
 #define TCG_SGX_12_0_EBX_FEATURES 0
 #define TCG_SGX_12_1_EAX_FEATURES 0
+#define TCG_RDT_15_0_EDX_FEATURES CPUID_15_0_EDX_L3
 
 #if defined CONFIG_USER_ONLY
 #define CPUID_8000_0008_EBX_KERNEL_FEATURES (CPUID_8000_0008_EBX_IBPB | \
@@ -1057,7 +1059,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "fsgsbase", "tsc-adjust", "sgx", "bmi1",
             "hle", "avx2", NULL, "smep",
             "bmi2", "erms", "invpcid", "rtm",
-            NULL, NULL, "mpx", NULL,
+            "rdt-m", NULL, "mpx", "rdt-a",
             "avx512f", "avx512dq", "rdseed", "adx",
             "smap", "avx512ifma", "pcommit", "clflushopt",
             "clwb", "intel-pt", "avx512pf", "avx512er",
@@ -1607,6 +1609,30 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .tcg_features = TCG_SGX_12_1_EAX_FEATURES,
     },
+
+    [FEAT_RDT_10_0_EBX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            NULL, "l3-cat", "l2-cat", "mba"
+        },
+        .cpuid = {
+            .eax = 0x10,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EBX,
+        }
+    },
+    [FEAT_RDT_15_0_EDX] = {
+        .type = CPUID_FEATURE_WORD,
+        .feat_names = {
+            [1] = "l3-cmt"
+        },
+        .cpuid = {
+            .eax = 0xf,
+            .needs_ecx = true, .ecx = 0,
+            .reg = R_EDX,
+        },
+        .tcg_features = TCG_RDT_15_0_EDX_FEATURES,
+    },
 };
 
 typedef struct FeatureMask {
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 12a4b989af..bf2f3c07a7 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -673,7 +673,9 @@ typedef enum FeatureWord {
     FEAT_XSAVE_XSS_HI,     /* CPUID[EAX=0xd,ECX=1].EDX */
     FEAT_7_1_EDX,       /* CPUID[EAX=7,ECX=1].EDX */
     FEAT_7_2_EDX,       /* CPUID[EAX=7,ECX=2].EDX */
+    FEAT_RDT_15_0_EBX,  /* CPUID[EAX=0xf,ECX=0].EBX (RDT CMT/MBM) */
     FEAT_RDT_15_0_EDX,  /* CPUID[EAX=0xf,ECX=0].EDX (RDT CMT/MBM) */
+    FEAT_RDT_10_0_EBX,  /* CPUID[EAX=0x10,ECX=0].EBX (RDT CAT/MBA) */
     FEATURE_WORDS,
 } FeatureWord;
 
-- 
2.45.2.1089.g2a221341d9-goog



  parent reply	other threads:[~2024-07-19 17:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-19 16:29 [PATCH v1 0/9] target:386/ Emulate Intel RDT features needed to mount ResCtrl in Linux Hendrik Wuethrich
2024-07-19 16:29 ` [PATCH v1 1/9] Add Intel RDT device to config Hendrik Wuethrich
2024-07-26 10:24   ` Jonathan Cameron via
2024-09-04 14:14     ` Hendrik Wüthrich
2024-07-19 16:29 ` [PATCH v1 2/9] Add state for RDT device Hendrik Wuethrich
2024-07-26 10:33   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 3/9] Add init and realize funciontality " Hendrik Wuethrich
2024-07-26 10:41   ` Jonathan Cameron via
2024-07-26 10:42   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 4/9] Add RDT functionality Hendrik Wuethrich
2024-07-26 10:51   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 5/9] Add RDT device interface through MSRs Hendrik Wuethrich
2024-07-26 10:57   ` Jonathan Cameron via
2024-07-19 16:29 ` [PATCH v1 6/9] Add CPUID enumeration for RDT Hendrik Wuethrich
2024-07-26 12:09   ` Jonathan Cameron via
2024-07-19 16:29 ` Hendrik Wuethrich [this message]
2024-07-19 16:29 ` [PATCH v1 8/9] Adjust CPUID level for RDT features Hendrik Wuethrich
2024-07-19 16:29 ` [PATCH v1 9/9] Adjust level for RDT on full_cpuid_auto_level Hendrik Wuethrich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240719162929.1197154-8-whendrik@google.com \
    --to=whendrik@google.com \
    --cc=eduardo@habkost.net \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peternewman@google.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).