diff mbox series

[07/13] KVM: SVM: Extend VMCB area for virtualized IBS registers

Message ID 20230904095347.14994-8-manali.shukla@amd.com (mailing list archive)
State New, archived
Headers show
Series Implement support for IBS virtualization | expand

Commit Message

Manali Shukla Sept. 4, 2023, 9:53 a.m. UTC
From: Santosh Shukla <santosh.shukla@amd.com>

VMCB state save is extended to hold guest values of the fetch and op
IBS registers.

Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
Signed-off-by: Manali Shukla <manali.shukla@amd.com>
---
 arch/x86/include/asm/svm.h | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

Comments

Chao Gao Sept. 12, 2023, 2:50 a.m. UTC | #1
On Mon, Sep 04, 2023 at 09:53:41AM +0000, Manali Shukla wrote:
>From: Santosh Shukla <santosh.shukla@amd.com>
>
>VMCB state save is extended to hold guest values of the fetch and op
>IBS registers.
>
>Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
>Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>---
> arch/x86/include/asm/svm.h | 16 +++++++++++++++-
> 1 file changed, 15 insertions(+), 1 deletion(-)
>
>diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
>index dee9fa91120b..4096d2f68770 100644
>--- a/arch/x86/include/asm/svm.h
>+++ b/arch/x86/include/asm/svm.h
>@@ -346,6 +346,19 @@ struct vmcb_save_area {
> 	u64 last_excp_to;
> 	u8 reserved_0x298[72];
> 	u64 spec_ctrl;		/* Guest version of SPEC_CTRL at 0x2E0 */
>+	u8 reserved_0x2e8[904];
>+	u8 lbr_stack_from_to[256];
>+	u64 lbr_select;

Shouldn't these lbr fields be added by a separate patch/series?

>+	u64 ibs_fetch_ctl;
>+	u64 ibs_fetch_linear_addr;
>+	u64 ibs_op_ctl;
>+	u64 ibs_op_rip;
>+	u64 ibs_op_data;
>+	u64 ibs_op_data2;
>+	u64 ibs_op_data3;
>+	u64 ibs_dc_linear_addr;
>+	u64 ibs_br_target;
>+	u64 ibs_fetch_extd_ctl;
> } __packed;
> 
> /* Save area definition for SEV-ES and SEV-SNP guests */
>@@ -512,7 +525,7 @@ struct ghcb {
> } __packed;
> 
> 
>-#define EXPECTED_VMCB_SAVE_AREA_SIZE		744
>+#define EXPECTED_VMCB_SAVE_AREA_SIZE		1992
> #define EXPECTED_GHCB_SAVE_AREA_SIZE		1032
> #define EXPECTED_SEV_ES_SAVE_AREA_SIZE		1648
> #define EXPECTED_VMCB_CONTROL_AREA_SIZE		1024
>@@ -537,6 +550,7 @@ static inline void __unused_size_checks(void)
> 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x180);
> 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x248);
> 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x298);
>+	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x2e8);
> 
> 	BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xc8);
> 	BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xcc);
>-- 
>2.34.1
>
diff mbox series

Patch

diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
index dee9fa91120b..4096d2f68770 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -346,6 +346,19 @@  struct vmcb_save_area {
 	u64 last_excp_to;
 	u8 reserved_0x298[72];
 	u64 spec_ctrl;		/* Guest version of SPEC_CTRL at 0x2E0 */
+	u8 reserved_0x2e8[904];
+	u8 lbr_stack_from_to[256];
+	u64 lbr_select;
+	u64 ibs_fetch_ctl;
+	u64 ibs_fetch_linear_addr;
+	u64 ibs_op_ctl;
+	u64 ibs_op_rip;
+	u64 ibs_op_data;
+	u64 ibs_op_data2;
+	u64 ibs_op_data3;
+	u64 ibs_dc_linear_addr;
+	u64 ibs_br_target;
+	u64 ibs_fetch_extd_ctl;
 } __packed;
 
 /* Save area definition for SEV-ES and SEV-SNP guests */
@@ -512,7 +525,7 @@  struct ghcb {
 } __packed;
 
 
-#define EXPECTED_VMCB_SAVE_AREA_SIZE		744
+#define EXPECTED_VMCB_SAVE_AREA_SIZE		1992
 #define EXPECTED_GHCB_SAVE_AREA_SIZE		1032
 #define EXPECTED_SEV_ES_SAVE_AREA_SIZE		1648
 #define EXPECTED_VMCB_CONTROL_AREA_SIZE		1024
@@ -537,6 +550,7 @@  static inline void __unused_size_checks(void)
 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x180);
 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x248);
 	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x298);
+	BUILD_BUG_RESERVED_OFFSET(vmcb_save_area, 0x2e8);
 
 	BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xc8);
 	BUILD_BUG_RESERVED_OFFSET(sev_es_save_area, 0xcc);