All of lore.kernel.org
 help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: <pbonzini@redhat.com>, <richard.henderson@linaro.org>
Cc: <weijiang.yang@intel.com>, <philmd@linaro.org>,
	<dwmw@amazon.co.uk>, <paul@xen.org>, <joao.m.martins@oracle.com>,
	<qemu-devel@nongnu.org>, <mtosatti@redhat.com>,
	<kvm@vger.kernel.org>, <mst@redhat.com>,
	<marcel.apfelbaum@gmail.com>, <yang.zhong@intel.com>,
	<jing2.liu@intel.com>, <vkuznets@redhat.com>,
	<michael.roth@amd.com>, <wei.huang2@amd.com>,
	<berrange@redhat.com>, <babu.moger@amd.com>, <bdas@redhat.com>
Subject: [PATCH v4 6/7] target/i386: Add VNMI and automatic IBRS feature bits
Date: Thu, 4 May 2023 15:53:11 -0500	[thread overview]
Message-ID: <20230504205313.225073-7-babu.moger@amd.com> (raw)
In-Reply-To: <20230504205313.225073-1-babu.moger@amd.com>

Add the following featute bits.

vnmi: Virtual NMI (VNMI) allows the hypervisor to inject the NMI into the
      guest without using Event Injection mechanism meaning not required to
      track the guest NMI and intercepting the IRET.
      The presence of this feature is indicated via the CPUID function
      0x8000000A_EDX[25].


automatic-ibrs :
      The AMD Zen4 core supports a new feature called Automatic IBRS.
      It is a "set-and-forget" feature that means that, unlike e.g.,
      s/w-toggled SPEC_CTRL.IBRS, h/w manages its IBRS mitigation
      resources automatically across CPL transitions.
      The presence of this feature is indicated via the CPUID function
      0x80000021_EAX[8].

The documention for the features are available in the links below.
a. Processor Programming Reference (PPR) for AMD Family 19h Model 01h,
   Revision B1 Processors
b. AMD64 Architecture Programmer’s Manual Volumes 1–5 Publication No. Revision
   40332 4.05 Date October 2022

Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
Signed-off-by: Kim Phillips <kim.phillips@amd.com>
Signed-off-by: Babu Moger <babu.moger@amd.com>
Link: https://www.amd.com/system/files/TechDocs/55898_B1_pub_0.50.zip
Link: https://www.amd.com/system/files/TechDocs/40332_4.05.pdf
---
 target/i386/cpu.c | 4 ++--
 target/i386/cpu.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 0a6fb2fc82..d50ace84bf 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -806,7 +806,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
             "pfthreshold", "avic", NULL, "v-vmsave-vmload",
             "vgif", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
-            NULL, NULL, NULL, NULL,
+            NULL, "vnmi", NULL, NULL,
             "svme-addr-chk", NULL, NULL, NULL,
         },
         .cpuid = { .eax = 0x8000000A, .reg = R_EDX, },
@@ -925,7 +925,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         .feat_names = {
             "no-nested-data-bp", NULL, "lfence-always-serializing", NULL,
             NULL, NULL, "null-sel-clr-base", NULL,
-            NULL, NULL, NULL, NULL,
+            "auto-ibrs", NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
             NULL, NULL, NULL, NULL,
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index 7cf811d8fe..f6575f1f01 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -773,6 +773,7 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
 #define CPUID_SVM_AVIC            (1U << 13)
 #define CPUID_SVM_V_VMSAVE_VMLOAD (1U << 15)
 #define CPUID_SVM_VGIF            (1U << 16)
+#define CPUID_SVM_VNMI            (1U << 25)
 #define CPUID_SVM_SVME_ADDR_CHK   (1U << 28)
 
 /* Support RDFSBASE/RDGSBASE/WRFSBASE/WRGSBASE */
@@ -946,6 +947,8 @@ uint64_t x86_cpu_get_supported_feature_word(FeatureWord w,
 #define CPUID_8000_0021_EAX_LFENCE_ALWAYS_SERIALIZING    (1U << 2)
 /* Null Selector Clears Base */
 #define CPUID_8000_0021_EAX_NULL_SEL_CLR_BASE    (1U << 6)
+/* Automatic IBRS */
+#define CPUID_8000_0021_EAX_AUTO_IBRS   (1U << 8)
 
 #define CPUID_XSAVE_XSAVEOPT   (1U << 0)
 #define CPUID_XSAVE_XSAVEC     (1U << 1)
-- 
2.34.1


  parent reply	other threads:[~2023-05-04 20:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-04 20:53 [PATCH v4 0/7] Add EPYC-Genoa model and update previous EPYC Models Babu Moger
2023-05-04 20:53 ` [PATCH v4 1/7] target/i386: allow versioned CPUs to specify new cache_info Babu Moger
2023-05-04 20:53 ` [PATCH v4 2/7] target/i386: Add new EPYC CPU versions with updated cache_info Babu Moger
2023-05-04 20:53   ` Babu Moger
2023-05-04 20:53 ` [PATCH v4 3/7] target/i386: Add a couple of feature bits in 8000_0008_EBX Babu Moger
2023-05-04 20:53   ` Babu Moger
2023-05-04 20:53 ` [PATCH v4 4/7] target/i386: Add feature bits for CPUID_Fn80000021_EAX Babu Moger
2023-05-05  8:29   ` Paolo Bonzini
2023-05-04 20:53 ` [PATCH v4 5/7] target/i386: Add missing feature bits in EPYC-Milan model Babu Moger
2023-05-04 20:53 ` Babu Moger [this message]
2023-05-04 20:53 ` [PATCH v4 7/7] target/i386: Add EPYC-Genoa model to support Zen 4 processor series Babu Moger
2023-05-05  8:31 ` [PATCH v4 0/7] Add EPYC-Genoa model and update previous EPYC Models Paolo Bonzini
2023-05-05 17:15   ` Moger, Babu

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=20230504205313.225073-7-babu.moger@amd.com \
    --to=babu.moger@amd.com \
    --cc=bdas@redhat.com \
    --cc=berrange@redhat.com \
    --cc=dwmw@amazon.co.uk \
    --cc=jing2.liu@intel.com \
    --cc=joao.m.martins@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=michael.roth@amd.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=vkuznets@redhat.com \
    --cc=wei.huang2@amd.com \
    --cc=weijiang.yang@intel.com \
    --cc=yang.zhong@intel.com \
    /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 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.