public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lendacky, Thomas" <thomas.lendacky@amd.com>
To: Michael Roth <michael.roth@amd.com>, devel@edk2.groups.io
Cc: ray.ni@intel.com, Pavan Kumar Paluri <papaluri@amd.com>
Subject: Re: [PATCH 3/4] OvmfPkg/CcExitLib: Fix SEV-SNP XSave area size calculation
Date: Wed, 21 Dec 2022 10:52:58 -0600	[thread overview]
Message-ID: <6fa55df0-417e-c9cb-f61c-ddd4da12ec1a@amd.com> (raw)
In-Reply-To: <20221221160651.182143-4-michael.roth@amd.com>

On 12/21/22 10:06, Michael Roth wrote:
> CPUID leaf 0xD sub-leafs 0x0 and 0x1 contain cumulative sizes for the
> enabled XSave areas. Those sizes are calculated by tallying up all the
> other sub-leafs that contain per-area size information for XSave areas
> that are currently enabled in XCr0/XSS. The current check has the logic
> inverted. Fix that.
> 
> This doesn't seem to cause problems currently, but could in the future
> if OVMF made more extensive use of XSave areas. It was noticed while
> implementing SNP-related tests for KVM Unit Tests, which re-uses the
> OVMF #VC handler in some cases.
> 
> Reported-by: Pavan Kumar Paluri <papaluri@amd.com>
> Cc: Pavan Kumar Paluri <papaluri@amd.com>
> Signed-off-by: Michael Roth <michael.roth@amd.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>   OvmfPkg/Library/CcExitLib/CcExitVcHandler.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
> index 985e547977..cd117d5a31 100644
> --- a/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
> +++ b/OvmfPkg/Library/CcExitLib/CcExitVcHandler.c
> @@ -1678,9 +1678,7 @@ GetCpuidXSaveSize (
>     for (Idx = 0; Idx < CpuidInfo->Count; Idx++) {
>       SEV_SNP_CPUID_FUNCTION  *CpuidFn = &CpuidInfo->function[Idx];
>   
> -    if (!((CpuidFn->EaxIn == 0xD) &&
> -          ((CpuidFn->EcxIn == 0) || (CpuidFn->EcxIn == 1))))
> -    {
> +    if (!((CpuidFn->EaxIn == 0xD) && (CpuidFn->EcxIn > 1))) {
>         continue;
>       }
>   

  reply	other threads:[~2022-12-21 16:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-21 16:06 [PATCH 0/4] Fixes for SEV-SNP CC blob and CPUID table handling Roth, Michael
2022-12-21 16:06 ` [PATCH 1/4] OvmfPkg/AmdSevDxe: Allocate SEV-SNP CC blob as EfiACPIReclaimMemory Roth, Michael
2022-12-21 16:48   ` Lendacky, Thomas
2022-12-21 21:26   ` Dov Murik
2023-01-06  9:18   ` [edk2-devel] " Yao, Jiewen
2023-01-06 20:25     ` Dov Murik
2023-01-07  2:01       ` Yao, Jiewen
2023-01-07 16:52         ` Ard Biesheuvel
2023-01-12 10:15           ` Yao, Jiewen
2022-12-21 16:06 ` [PATCH 2/4] OvmfPkg/AmdSevDxe: Update ConfidentialComputing blob struct definition Roth, Michael
2023-01-06  9:14   ` [edk2-devel] " Yao, Jiewen
2022-12-21 16:06 ` [PATCH 3/4] OvmfPkg/CcExitLib: Fix SEV-SNP XSave area size calculation Roth, Michael
2022-12-21 16:52   ` Lendacky, Thomas [this message]
2023-01-06  8:53   ` [edk2-devel] " Yao, Jiewen
2022-12-21 16:06 ` [PATCH 4/4] OvmfPkg/CcExitLib: Use documented XSave area base size for SEV-SNP Roth, Michael
2022-12-21 16:59   ` Lendacky, Thomas
2023-01-06  8:53   ` [edk2-devel] " Yao, Jiewen
2022-12-21 17:41 ` [PATCH 0/4] Fixes for SEV-SNP CC blob and CPUID table handling Roth, Michael
2023-01-18  3:57   ` Yao, Jiewen

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-list 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=6fa55df0-417e-c9cb-f61c-ddd4da12ec1a@amd.com \
    --to=devel@edk2.groups.io \
    /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