From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.groups.io with SMTP id smtpd.web11.2756.1604547015544774456 for ; Wed, 04 Nov 2020 19:30:15 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QeG3jWPc; spf=pass (domain: redhat.com, ip: 216.205.24.124, mailfrom: lersek@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1604547014; 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=3a3WSKfLicOI53A/CRfLAzBrTHu6WYLv3LPCMTyMau4=; b=QeG3jWPcUw/jbGfrmKV94n33QOG0AoqwI4L6xFEVNIvC+z//T+DtIwBHykRxmdcyA41W84 JF2peKPFNAcp9mUJZjTIAjd25O0yhBmu1QeO47U6GJr4D04F2jkH26OnExGPqXgN/J9d3t K/K8La1gJeJLrYz2K6cxmbWNfsI/n8c= 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-171-ZOczq0WYPwSIzjQTHO_eyg-1; Wed, 04 Nov 2020 22:30:01 -0500 X-MC-Unique: ZOczq0WYPwSIzjQTHO_eyg-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 20A391007464; Thu, 5 Nov 2020 03:29:59 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-112-163.ams2.redhat.com [10.36.112.163]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52C015D98F; Thu, 5 Nov 2020 03:29:56 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH v3 00/11] SEV-ES guest support fixes and cleanup To: devel@edk2.groups.io, thomas.lendacky@amd.com Cc: Brijesh Singh , Ard Biesheuvel , Eric Dong , Liming Gao , Jordan Justen , Michael D Kinney , Rahul Kumar , Zhiguang Liu , Ray Ni References: From: "Laszlo Ersek" Message-ID: <41dd8877-4954-e32d-0398-b4f0525bc2de@redhat.com> Date: Thu, 5 Nov 2020 04:29:55 +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 10/29/20 15:17, Lendacky, Thomas wrote: > From: Tom Lendacky > > This patch series provides some fixes, updates and cleanup to the SEV-ES > guest support: > > - Update the calculation of the qword offset of fields within the GHCB > by removing the hardcoding of the offsets and using the OFFSET_OF () > and sizeof () functions to calculate the values. Remove unused values > and add values that will be used in later patches. > > - Set the SwExitCode, SwExitInfo1, SwExitInfo2 and SwScratch valid bits > in the GHCB ValidBitmap area when these fields are for a VMGEXIT. This > is done by adding two new interfaces to the VmgExitLib library to set > and test the bits of the GHCB ValidBitmap. This reduces code duplication > and keeps access to the ValidBitmap field within the VmgExitLib library. > > - Update the Qemu flash drive services support to add SEV-ES support for > erasing blocks. > > - Disable interrupts when using the GHCB. > > - Use the processor number for setting the AP stack pointer instead of the > APIC ID by calling GetProcessorNumber(). > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3008 > > --- > > These patches are based on commit: > 6ad819c1abe3 ("FmpDevicePkg/FmpDeviceLib: Add Last Attempt Status to Check/Set API") > > Cc: Ard Biesheuvel > Cc: Eric Dong > Cc: Laszlo Ersek > Cc: Liming Gao > Cc: Jordan Justen > Cc: Michael D Kinney > Cc: Rahul Kumar > Cc: Zhiguang Liu > Cc: Ray Ni > Cc: Tom Lendacky > Cc: Brijesh Singh > > Changes since v2: > - Don't rename the GHCB_REGISTER enum type. > > Changes since v1: > - For the GHCB savearea changes, create a new reserved area name instead > of "renumbering" the reserved areas. > - Rework the ValidBitmap set/test support to be part of the VmgExitLib > library. Create two new interfaces for setting and testing bits in the > GHCB ValidBitmap field and adjust all existing code and the new code in > this series to use these interfaces for the ValidBitmap updates/checks. > - Don't disable interrupts for just the Qemu flash services support, but > rather, cover all users of the GHCB by disabling interrupts in VmgInit() > and restoring them in VmgDone(). This requires changes to those > interaces. > > Tom Lendacky (11): > MdePkg: Clean up GHCB field offsets and save area > UefiCpuPkg/VmgExitLib: Add interfaces to set/read GHCB ValidBitmap > bits > OvmfPkg/VmgExitLib: Implement new VmgExitLib interfaces > OvmfPkg/VmgExitLib: Set the SW exit fields when performing VMGEXIT > OvmfPkg/VmgExitLib: Set the SwScratch valid bit for IOIO events > OvmfPkg/VmgExitLib: Set the SwScratch valid bit for MMIO events > UefiCpuPkg/MpInitLib: Set the SW exit fields when performing VMGEXIT > OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Set the SwScratch valid bit > OvmfPkg/QemuFlashFvbServicesRuntimeDxe: Fix erase blocks for SEV-ES > UefiCpuPkg, OvmfPkg: Disable interrupts when using the GHCB > UefiCpuPkg/MpInitLib: For SEV-ES guest, set stack based on processor > number > > MdePkg/Include/Register/Amd/Ghcb.h | 40 +++--- > UefiCpuPkg/Include/Library/VmgExitLib.h | 51 +++++++- > OvmfPkg/Library/VmgExitLib/VmgExitLib.c | 84 ++++++++++++- > OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c | 129 ++++++-------------- > OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlash.c | 4 +- > OvmfPkg/QemuFlashFvbServicesRuntimeDxe/QemuFlashDxe.c | 6 +- > UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 5 +- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 14 ++- > UefiCpuPkg/Library/VmgExitLibNull/VmgExitLibNull.c | 60 +++++++-- > UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm | 6 + > 10 files changed, 258 insertions(+), 141 deletions(-) > I've submitted PR#1086 , but CI seems slower than usual today, and I really need some sleep, so I won't wait for CI. Tom, if the PR succeeds, please close TianoCore#3008, noting the commit range, and please also follow up in this thread with the commit range. Thanks! Laszlo