[PATCH v3 18/20] i386/cpu: Enable cet-ss & cet-ibt for supported CPU models

Zhao Liu posted 20 patches 3 months, 2 weeks ago
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Cornelia Huck <cohuck@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, Zhao Liu <zhao1.liu@intel.com>, Marcelo Tosatti <mtosatti@redhat.com>
There is a newer version of this series
[PATCH v3 18/20] i386/cpu: Enable cet-ss & cet-ibt for supported CPU models
Posted by Zhao Liu 3 months, 2 weeks ago
Add new versioned CPU models for Sapphire Rapids, Sierra Forest, Granite
Rapids and Clearwater Forest, to enable shadow stack and indirect branch
tracking.

Tested-by: Farrah Chen <farrah.chen@intel.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 target/i386/cpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 9a1001c47891..73026d5bce91 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -5161,6 +5161,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ },
                 }
             },
+            {
+                .version = 5,
+                .note = "with cet-ss and cet-ibt",
+                .props = (PropValue[]) {
+                    { "cet-ss", "on" },
+                    { "cet-ibt", "on" },
+                    { "vmx-exit-save-cet", "on" },
+                    { "vmx-entry-load-cet", "on" },
+                    { /* end of list */ },
+                }
+            },
             { /* end of list */ }
         }
     },
@@ -5323,6 +5334,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ },
                 }
             },
+            {
+                .version = 4,
+                .note = "with cet-ss and cet-ibt",
+                .props = (PropValue[]) {
+                    { "cet-ss", "on" },
+                    { "cet-ibt", "on" },
+                    { "vmx-exit-save-cet", "on" },
+                    { "vmx-entry-load-cet", "on" },
+                    { /* end of list */ },
+                }
+            },
             { /* end of list */ },
         },
     },
@@ -5477,6 +5499,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
                     { /* end of list */ },
                 }
             },
+            {
+                .version = 4,
+                .note = "with cet-ss and cet-ibt",
+                .props = (PropValue[]) {
+                    { "cet-ss", "on" },
+                    { "cet-ibt", "on" },
+                    { "vmx-exit-save-cet", "on" },
+                    { "vmx-entry-load-cet", "on" },
+                    { /* end of list */ },
+                }
+            },
             { /* end of list */ },
         },
     },
@@ -5612,6 +5645,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
         .model_id = "Intel Xeon Processor (ClearwaterForest)",
         .versions = (X86CPUVersionDefinition[]) {
             { .version = 1 },
+            {
+                .version = 2,
+                .note = "with cet-ss and cet-ibt",
+                .props = (PropValue[]) {
+                    { "cet-ss", "on" },
+                    { "cet-ibt", "on" },
+                    { "vmx-exit-save-cet", "on" },
+                    { "vmx-entry-load-cet", "on" },
+                    { /* end of list */ },
+                }
+            },
             { /* end of list */ },
         },
     },
-- 
2.34.1
Re: [PATCH v3 18/20] i386/cpu: Enable cet-ss & cet-ibt for supported CPU models
Posted by Xiaoyao Li 3 months, 2 weeks ago
On 10/24/2025 2:56 PM, Zhao Liu wrote:
> Add new versioned CPU models for Sapphire Rapids, Sierra Forest, Granite
> Rapids and Clearwater Forest, to enable shadow stack and indirect branch
> tracking.
> 
> Tested-by: Farrah Chen <farrah.chen@intel.com>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>

Reviewed-by: Xiaoyao Li <xiaoyao.li@intel.com>

> ---
>   target/i386/cpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 44 insertions(+)
> 
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 9a1001c47891..73026d5bce91 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -5161,6 +5161,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
>                       { /* end of list */ },
>                   }
>               },
> +            {
> +                .version = 5,
> +                .note = "with cet-ss and cet-ibt",
> +                .props = (PropValue[]) {
> +                    { "cet-ss", "on" },
> +                    { "cet-ibt", "on" },
> +                    { "vmx-exit-save-cet", "on" },
> +                    { "vmx-entry-load-cet", "on" },
> +                    { /* end of list */ },
> +                }
> +            },
>               { /* end of list */ }
>           }
>       },
> @@ -5323,6 +5334,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
>                       { /* end of list */ },
>                   }
>               },
> +            {
> +                .version = 4,
> +                .note = "with cet-ss and cet-ibt",
> +                .props = (PropValue[]) {
> +                    { "cet-ss", "on" },
> +                    { "cet-ibt", "on" },
> +                    { "vmx-exit-save-cet", "on" },
> +                    { "vmx-entry-load-cet", "on" },
> +                    { /* end of list */ },
> +                }
> +            },
>               { /* end of list */ },
>           },
>       },
> @@ -5477,6 +5499,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
>                       { /* end of list */ },
>                   }
>               },
> +            {
> +                .version = 4,
> +                .note = "with cet-ss and cet-ibt",
> +                .props = (PropValue[]) {
> +                    { "cet-ss", "on" },
> +                    { "cet-ibt", "on" },
> +                    { "vmx-exit-save-cet", "on" },
> +                    { "vmx-entry-load-cet", "on" },
> +                    { /* end of list */ },
> +                }
> +            },
>               { /* end of list */ },
>           },
>       },
> @@ -5612,6 +5645,17 @@ static const X86CPUDefinition builtin_x86_defs[] = {
>           .model_id = "Intel Xeon Processor (ClearwaterForest)",
>           .versions = (X86CPUVersionDefinition[]) {
>               { .version = 1 },
> +            {
> +                .version = 2,
> +                .note = "with cet-ss and cet-ibt",
> +                .props = (PropValue[]) {
> +                    { "cet-ss", "on" },
> +                    { "cet-ibt", "on" },
> +                    { "vmx-exit-save-cet", "on" },
> +                    { "vmx-entry-load-cet", "on" },
> +                    { /* end of list */ },
> +                }
> +            },
>               { /* end of list */ },
>           },
>       },