From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.groups.io with SMTP id smtpd.web10.1065.1609786983045114617 for ; Mon, 04 Jan 2021 11:03:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=F9SveApn; spf=pass (domain: redhat.com, ip: 63.128.21.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1609786982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Giew9hDJNEglbDyak9lebFMAWrcsJ3Kw3Gy1eicklAU=; b=F9SveApnk+Y4jji9WNMQw1CSQdLL2RuXYpal1vvQYYloOOZjsXdwwUJxDZ2tdkdJAa3+wI asJX2haPllUnB+mLCk2IMn93VMp2s3sO8OF2zWCqpBl5g/lwu70zA9H5yQq3r3RElDVOa3 82mEvmiI2PVobYJdkAsHf2MmvQDYgjY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-102-Bb7mo4hXOFKeBtHNeOWCbA-1; Mon, 04 Jan 2021 14:02:39 -0500 X-MC-Unique: Bb7mo4hXOFKeBtHNeOWCbA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 389D8612A3; Mon, 4 Jan 2021 19:02:38 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-80.ams2.redhat.com [10.36.113.80]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA6B95D9D2; Mon, 4 Jan 2021 19:02:36 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 02/12] OvmfPkg/Sec: Move SEV-ES SEC workarea definition to common header file To: devel@edk2.groups.io, thomas.lendacky@amd.com Cc: Brijesh Singh , James Bottomley , Jordan Justen , Ard Biesheuvel References: From: "Laszlo Ersek" Message-ID: Date: Mon, 4 Jan 2021 20:02:35 +0100 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=lersek@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 12/15/20 21:51, Lendacky, Thomas wrote: > From: Tom Lendacky > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3108 > > In order to allow for the SEV-ES workarea to be used for other purposes > and by other files, move the definition into the BaseMemEncryptSevLib > header file, MemEncryptSevLib.h. > > Cc: Jordan Justen > Cc: Laszlo Ersek > Cc: Ard Biesheuvel > Cc: Brijesh Singh > Signed-off-by: Tom Lendacky > --- > OvmfPkg/Include/Library/MemEncryptSevLib.h | 16 +++++++++++++++- > OvmfPkg/Sec/SecMain.c | 6 ++---- > 2 files changed, 17 insertions(+), 5 deletions(-) Reviewed-by: Laszlo Ersek Thanks Laszlo > diff --git a/OvmfPkg/Include/Library/MemEncryptSevLib.h b/OvmfPkg/Include/Library/MemEncryptSevLib.h > index fc70b0114354..a6d82dac7fac 100644 > --- a/OvmfPkg/Include/Library/MemEncryptSevLib.h > +++ b/OvmfPkg/Include/Library/MemEncryptSevLib.h > @@ -2,7 +2,7 @@ > > Define Secure Encrypted Virtualization (SEV) base library helper function > > - Copyright (c) 2017, AMD Incorporated. All rights reserved.
> + Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -13,6 +13,20 @@ > > #include > > +// > +// Internal structure for holding SEV-ES information needed during SEC phase > +// and valid only during SEC phase and early PEI during platform > +// initialization. > +// > +// This structure is also used by assembler files: > +// OvmfPkg/ResetVector/ResetVector.nasmb > +// OvmfPkg/ResetVector/Ia32/PageTables64.asm > +// any changes must stay in sync with its usage. > +// > +typedef struct _SEC_SEV_ES_WORK_AREA { > + UINT8 SevEsEnabled; > +} SEC_SEV_ES_WORK_AREA; > + > /** > Returns a boolean to indicate whether SEV-ES is enabled. > > diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c > index 63aca7020727..9db67e17b2aa 100644 > --- a/OvmfPkg/Sec/SecMain.c > +++ b/OvmfPkg/Sec/SecMain.c > @@ -3,6 +3,7 @@ > > Copyright (c) 2008 - 2015, Intel Corporation. All rights reserved.
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> + Copyright (c) 2020, Advanced Micro Devices, Inc. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -25,6 +26,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -37,10 +39,6 @@ typedef struct _SEC_IDT_TABLE { > IA32_IDT_GATE_DESCRIPTOR IdtTable[SEC_IDT_ENTRY_COUNT]; > } SEC_IDT_TABLE; > > -typedef struct _SEC_SEV_ES_WORK_AREA { > - UINT8 SevEsEnabled; > -} SEC_SEV_ES_WORK_AREA; > - > VOID > EFIAPI > SecStartupPhase2 ( >