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.web12.8594.1602755361652130758 for ; Thu, 15 Oct 2020 02:49:21 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GHafEb9l; 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=1602755360; 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=IRoYn4gb2SFOaKzKheJpeWq8mgPWllQKrAQTruEhSZE=; b=GHafEb9lg5NDVTLqZYjeUKRnTiuvZQzrJjIxerQUuTj3U0oPkPjs4RR9l27331lZzACL92 LVyTVPc9Cl+dxJZNKhAki6j9ey4nnfRTetT9UYCa/yHD/jVcbkplzk9z/l9NYtB1YG+Hl8 e0YuJP3amKKLYrP4WBeO/WMzuUPRl8A= 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-339-MTESwydWPea7HMHGpLD1jg-1; Thu, 15 Oct 2020 05:49:16 -0400 X-MC-Unique: MTESwydWPea7HMHGpLD1jg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6A2C464148; Thu, 15 Oct 2020 09:49:15 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-113-119.ams2.redhat.com [10.36.113.119]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB57B5C1BD; Thu, 15 Oct 2020 09:49:13 +0000 (UTC) Subject: Re: [PATCH 9/9] UefiCpuPkg/MpInitLib: For SEV-ES guest set stack based on processor number To: Tom Lendacky , devel@edk2.groups.io Cc: Brijesh Singh , Eric Dong , Ray Ni , Rahul Kumar References: From: "Laszlo Ersek" Message-ID: Date: Thu, 15 Oct 2020 11:49:12 +0200 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 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/10/20 18:07, Tom Lendacky wrote: > From: Tom Lendacky > > Set the SEV-ES reset stack address for an AP based on the processor number > instead of the APIC ID in case the APIC IDs are not zero-based and densely > packed/enumerated. This will ensure an AP reset stack address does not get > set outside of the AP reset stack memory allocation. > > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Cc: Rahul Kumar > Signed-off-by: Tom Lendacky > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index 07426274f639..71922141b70b 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -680,11 +680,16 @@ MpInitLibSevEsAPReset ( > IN CPU_MP_DATA *CpuMpData > ) > { > + EFI_STATUS Status; > + UINTN ProcessorNumber; > UINT16 Code16, Code32; > AP_RESET *APResetFn; > UINTN BufferStart; > UINTN StackStart; > > + Status = GetProcessorNumber (CpuMpData, &ProcessorNumber); > + ASSERT_EFI_ERROR (Status); > + > Code16 = GetProtectedMode16CS (); > Code32 = GetProtectedMode32CS (); > > @@ -696,7 +701,7 @@ MpInitLibSevEsAPReset ( > > BufferStart = CpuMpData->MpCpuExchangeInfo->BufferStart; > StackStart = CpuMpData->SevEsAPResetStackStart - > - (AP_RESET_STACK_SIZE * GetApicId ()); > + (AP_RESET_STACK_SIZE * ProcessorNumber); > > // > // This call never returns. > trivial request: please insert a comma in the subject line, after "For SEV-ES guest". (The new subject length should still be accepted by "PatchCheck.py".) Thanks Laszlo