* [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
@ 2023-07-17 4:19 Manali Shukla
2023-07-17 13:17 ` Tom Lendacky
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Manali Shukla @ 2023-07-17 4:19 UTC (permalink / raw)
To: kvm; +Cc: pbonzini, seanjc, thomas.lendacky
Correct the spec_ctrl field in the VMCB save area based on the AMD
Programmer's manual.
Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
in VMCB save area.
The Public Processor Programming reference for Genoa, shows SPEC_CTRL
as 64b register, but the AMD Programmer's Manual lists SPEC_CTRL as
32b register. This discrepancy will be cleaned up in next revision of
the AMD Programmer's Manual.
Since remaining bits above bit 7 are reserved bits in SPEC_CTRL MSR
and thus, not being used, the spec_ctrl added as u32 in the VMCB save
area is currently not an issue.
Fixes: 3dd2775b74c9 ("KVM: SVM: Create a separate mapping for the SEV-ES save area")
Suggested-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Manali Shukla <manali.shukla@amd.com>
---
arch/x86/include/asm/svm.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
index e7c7379d6ac7..dee9fa91120b 100644
--- a/arch/x86/include/asm/svm.h
+++ b/arch/x86/include/asm/svm.h
@@ -345,7 +345,7 @@ struct vmcb_save_area {
u64 last_excp_from;
u64 last_excp_to;
u8 reserved_0x298[72];
- u32 spec_ctrl; /* Guest version of SPEC_CTRL at 0x2E0 */
+ u64 spec_ctrl; /* Guest version of SPEC_CTRL at 0x2E0 */
} __packed;
/* Save area definition for SEV-ES and SEV-SNP guests */
@@ -512,7 +512,7 @@ struct ghcb {
} __packed;
-#define EXPECTED_VMCB_SAVE_AREA_SIZE 740
+#define EXPECTED_VMCB_SAVE_AREA_SIZE 744
#define EXPECTED_GHCB_SAVE_AREA_SIZE 1032
#define EXPECTED_SEV_ES_SAVE_AREA_SIZE 1648
#define EXPECTED_VMCB_CONTROL_AREA_SIZE 1024
--
2.34.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
2023-07-17 4:19 [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area Manali Shukla
@ 2023-07-17 13:17 ` Tom Lendacky
2023-07-17 15:01 ` Sean Christopherson
2023-07-26 15:17 ` Sean Christopherson
2023-08-18 0:12 ` Sean Christopherson
2 siblings, 1 reply; 6+ messages in thread
From: Tom Lendacky @ 2023-07-17 13:17 UTC (permalink / raw)
To: Manali Shukla, kvm; +Cc: pbonzini, seanjc
On 7/16/23 23:19, Manali Shukla wrote:
> Correct the spec_ctrl field in the VMCB save area based on the AMD
> Programmer's manual.
>
> Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
> area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
> in VMCB save area.
>
> The Public Processor Programming reference for Genoa, shows SPEC_CTRL
> as 64b register, but the AMD Programmer's Manual lists SPEC_CTRL as
> 32b register. This discrepancy will be cleaned up in next revision of
> the AMD Programmer's Manual.
>
> Since remaining bits above bit 7 are reserved bits in SPEC_CTRL MSR
> and thus, not being used, the spec_ctrl added as u32 in the VMCB save
> area is currently not an issue.
>
> Fixes: 3dd2775b74c9 ("KVM: SVM: Create a separate mapping for the SEV-ES save area")
The more appropriate Fixes: tag should the be commit that originally
introduced the spec_ctrl field:
d00b99c514b3 ("KVM: SVM: Add support for Virtual SPEC_CTRL")
Although because of 3dd2775b74c9, backports to before that might take some
manual work.
Thanks,
Tom
> Suggested-by: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
> ---
> arch/x86/include/asm/svm.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h
> index e7c7379d6ac7..dee9fa91120b 100644
> --- a/arch/x86/include/asm/svm.h
> +++ b/arch/x86/include/asm/svm.h
> @@ -345,7 +345,7 @@ struct vmcb_save_area {
> u64 last_excp_from;
> u64 last_excp_to;
> u8 reserved_0x298[72];
> - u32 spec_ctrl; /* Guest version of SPEC_CTRL at 0x2E0 */
> + u64 spec_ctrl; /* Guest version of SPEC_CTRL at 0x2E0 */
> } __packed;
>
> /* Save area definition for SEV-ES and SEV-SNP guests */
> @@ -512,7 +512,7 @@ struct ghcb {
> } __packed;
>
>
> -#define EXPECTED_VMCB_SAVE_AREA_SIZE 740
> +#define EXPECTED_VMCB_SAVE_AREA_SIZE 744
> #define EXPECTED_GHCB_SAVE_AREA_SIZE 1032
> #define EXPECTED_SEV_ES_SAVE_AREA_SIZE 1648
> #define EXPECTED_VMCB_CONTROL_AREA_SIZE 1024
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
2023-07-17 13:17 ` Tom Lendacky
@ 2023-07-17 15:01 ` Sean Christopherson
2023-07-22 5:13 ` Manali Shukla
0 siblings, 1 reply; 6+ messages in thread
From: Sean Christopherson @ 2023-07-17 15:01 UTC (permalink / raw)
To: Tom Lendacky; +Cc: Manali Shukla, kvm, pbonzini
On Mon, Jul 17, 2023, Tom Lendacky wrote:
> On 7/16/23 23:19, Manali Shukla wrote:
> > Correct the spec_ctrl field in the VMCB save area based on the AMD
> > Programmer's manual.
> >
> > Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
Nit, either just "spec_ctrl" or "the spec_ctrl field", specific MSRs and fields
are essentially proper nouns when used as nouns and not adjectives.
> > area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
> > in VMCB save area.
> >
> > The Public Processor Programming reference for Genoa, shows SPEC_CTRL
> > as 64b register, but the AMD Programmer's Manual lists SPEC_CTRL as
Nit, write out 64-bit (and 32-bit) so that there's zero ambiguity (I paused for
a few seconds to make sure I was reading it correctly). 64b is perfectly valid,
but nowhere near as common in the kernel, e.g.
$ git log | grep -E "\s64b\s" | wc -l
160
$ git log | grep -E "\s64-bit\s" | wc -l
8334
> > 32b register. This discrepancy will be cleaned up in next revision of
> > the AMD Programmer's Manual.
> >
> > Since remaining bits above bit 7 are reserved bits in SPEC_CTRL MSR
> > and thus, not being used, the spec_ctrl added as u32 in the VMCB save
Same comment about "the spec_ctrl" here.
> > area is currently not an issue.
> >
> > Fixes: 3dd2775b74c9 ("KVM: SVM: Create a separate mapping for the SEV-ES save area")
>
> The more appropriate Fixes: tag should the be commit that originally
> introduced the spec_ctrl field:
>
> d00b99c514b3 ("KVM: SVM: Add support for Virtual SPEC_CTRL")
>
> Although because of 3dd2775b74c9, backports to before that might take some
> manual work.
And
Cc: stable@vger.kernel.org
to make sure this gets backported.
No need for a v2, I can fixup all the nits when applying.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
2023-07-17 15:01 ` Sean Christopherson
@ 2023-07-22 5:13 ` Manali Shukla
0 siblings, 0 replies; 6+ messages in thread
From: Manali Shukla @ 2023-07-22 5:13 UTC (permalink / raw)
To: Sean Christopherson, Tom Lendacky; +Cc: kvm, pbonzini
On 7/17/2023 8:31 PM, Sean Christopherson wrote:
> On Mon, Jul 17, 2023, Tom Lendacky wrote:
>> On 7/16/23 23:19, Manali Shukla wrote:
>>> Correct the spec_ctrl field in the VMCB save area based on the AMD
>>> Programmer's manual.
>>>
>>> Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
>
> Nit, either just "spec_ctrl" or "the spec_ctrl field", specific MSRs and fields
> are essentially proper nouns when used as nouns and not adjectives.
>
>>> area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
>>> in VMCB save area.
>>>
>>> The Public Processor Programming reference for Genoa, shows SPEC_CTRL
>>> as 64b register, but the AMD Programmer's Manual lists SPEC_CTRL as
>
> Nit, write out 64-bit (and 32-bit) so that there's zero ambiguity (I paused for
> a few seconds to make sure I was reading it correctly). 64b is perfectly valid,
> but nowhere near as common in the kernel, e.g.
>
> $ git log | grep -E "\s64b\s" | wc -l
> 160
> $ git log | grep -E "\s64-bit\s" | wc -l
> 8334
>
>>> 32b register. This discrepancy will be cleaned up in next revision of
>>> the AMD Programmer's Manual.
>>>
>>> Since remaining bits above bit 7 are reserved bits in SPEC_CTRL MSR
>>> and thus, not being used, the spec_ctrl added as u32 in the VMCB save
>
> Same comment about "the spec_ctrl" here.
>
>>> area is currently not an issue.
>>>
>>> Fixes: 3dd2775b74c9 ("KVM: SVM: Create a separate mapping for the SEV-ES save area")
>>
>> The more appropriate Fixes: tag should the be commit that originally
>> introduced the spec_ctrl field:
>>
>> d00b99c514b3 ("KVM: SVM: Add support for Virtual SPEC_CTRL")
>>
>> Although because of 3dd2775b74c9, backports to before that might take some
>> manual work.
>
> And
>
> Cc: stable@vger.kernel.org
>
> to make sure this gets backported.
>
> No need for a v2, I can fixup all the nits when applying.
Thank you for reviewing.
- Manali
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
2023-07-17 4:19 [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area Manali Shukla
2023-07-17 13:17 ` Tom Lendacky
@ 2023-07-26 15:17 ` Sean Christopherson
2023-08-18 0:12 ` Sean Christopherson
2 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2023-07-26 15:17 UTC (permalink / raw)
To: Sean Christopherson, kvm, Manali Shukla; +Cc: pbonzini, thomas.lendacky
On Mon, 17 Jul 2023 04:19:03 +0000, Manali Shukla wrote:
> Correct the spec_ctrl field in the VMCB save area based on the AMD
> Programmer's manual.
>
> Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
> area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
> in VMCB save area.
>
> [...]
Applied to kvm-x86 fixes, thanks!
[1/1] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
https://github.com/kvm-x86/linux/commit/f1f10c4a1e9b
--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
2023-07-17 4:19 [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area Manali Shukla
2023-07-17 13:17 ` Tom Lendacky
2023-07-26 15:17 ` Sean Christopherson
@ 2023-08-18 0:12 ` Sean Christopherson
2 siblings, 0 replies; 6+ messages in thread
From: Sean Christopherson @ 2023-08-18 0:12 UTC (permalink / raw)
To: Sean Christopherson, kvm, Manali Shukla; +Cc: pbonzini, thomas.lendacky
On Mon, 17 Jul 2023 04:19:03 +0000, Manali Shukla wrote:
> Correct the spec_ctrl field in the VMCB save area based on the AMD
> Programmer's manual.
>
> Originally, the spec_ctrl was listed as u32 with 4 bytes of reserved
> area. The AMD Programmer's Manual now lists the spec_ctrl as 8 bytes
> in VMCB save area.
>
> [...]
I changed course and applied this to kvm-x86 svm, i.e. it will land in 6.6
instead of 6.5. I forgot/neglected to send an earlier pull request for this,
and at this point squeezing this into 6.5 seems unnecessary.
[1/1] KVM: SVM: correct the size of spec_ctrl field in VMCB save area
https://github.com/kvm-x86/linux/commit/f67063414c0e
--
https://github.com/kvm-x86/linux/tree/next
https://github.com/kvm-x86/linux/tree/fixes
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-08-18 0:14 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 4:19 [PATCH] KVM: SVM: correct the size of spec_ctrl field in VMCB save area Manali Shukla
2023-07-17 13:17 ` Tom Lendacky
2023-07-17 15:01 ` Sean Christopherson
2023-07-22 5:13 ` Manali Shukla
2023-07-26 15:17 ` Sean Christopherson
2023-08-18 0:12 ` Sean Christopherson
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).