From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 050C1941BC2 for ; Wed, 22 Nov 2023 17:03:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=rslmYFKA/4PF9s63E6eq3j2+YtsYnxo68jd3rMeNN7Y=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1700672598; v=1; b=nt6bOmGAVsrma0yvU0zOpxruBQY5Q85IkIPQfDn/Zs2QDCH3o4qVIQPgXT58lRuID82Hu4Ba ny/clrwLOwm6TCuiW+XccEezXxDxS2tX93axWWBohUHyXujgvxAC6EIOqEPJVIwWVxsbG9lkgfb pmByijUdrw4um8GkeiyxWOdQ= X-Received: by 127.0.0.2 with SMTP id RlBwYY7687511xDAG6mGIMkL; Wed, 22 Nov 2023 09:03:18 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.24941.1700672597949544315 for ; Wed, 22 Nov 2023 09:03:18 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-172-IiSEe8IxNPC4Spf5Hanb9w-1; Wed, 22 Nov 2023 12:03:14 -0500 X-MC-Unique: IiSEe8IxNPC4Spf5Hanb9w-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6DE43811E8D; Wed, 22 Nov 2023 17:03:13 +0000 (UTC) X-Received: from [10.39.193.187] (unknown [10.39.193.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6030E2166B26; Wed, 22 Nov 2023 17:03:12 +0000 (UTC) Message-ID: Date: Wed, 22 Nov 2023 18:03:11 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [Patch V2 2/3] UefiCpuPkg/MpInitLib: Detect microcode and store MTRR when CpuCount > 1 To: devel@edk2.groups.io, yuanhao.xie@intel.com Cc: Ray Ni , Eric Dong , Rahul Kumar , Tom Lendacky References: <20231121073956.2741-1-yuanhao.xie@intel.com> <20231121073956.2741-3-yuanhao.xie@intel.com> From: "Laszlo Ersek" In-Reply-To: <20231121073956.2741-3-yuanhao.xie@intel.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: FsLbyqx2IxZYRcfMPinZpskPx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=nt6bOmGA; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io On 11/21/23 08:39, Yuanhao Xie wrote: > Detect and apply Microcode on BSP, store BSP's MTRR setting only when > CpuCount > 1. >=20 > The purpose of this patch is to enhance the review process. > The separation in this patch is aimed at facilitating a more > straightforward review, with the ultimate goal of eliminating the > microcode loading functionality for the second time Mp initialization >=20 > Cc: Ray Ni > Cc: Eric Dong > Cc: Rahul Kumar > Cc: Tom Lendacky > Cc: Laszlo Ersek > Signed-off-by: Yuanhao Xie > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/Mp= InitLib/MpLib.c > index e8ffb99874..bb5d4188f0 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -2236,19 +2236,19 @@ MpInitLibInitialize ( > ShadowMicrocodeUpdatePatch (CpuMpData); > } > =20 > - // > - // Detect and apply Microcode on BSP > - // > - MicrocodeDetect (CpuMpData, CpuMpData->BspNumber); > - // > - // Store BSP's MTRR setting > - // > - MtrrGetAllMtrrs (&CpuMpData->MtrrTable); > - > // > // Wakeup APs to do some AP initialize sync (Microcode & MTRR) > // > if (CpuMpData->CpuCount > 1) { > + // > + // Detect and apply Microcode on BSP > + // > + MicrocodeDetect (CpuMpData, CpuMpData->BspNumber); > + // > + // Store BSP's MTRR setting > + // > + MtrrGetAllMtrrs (&CpuMpData->MtrrTable); > + > if (MpHandOff !=3D NULL) { > // > // Only needs to use this flag for DXE phase to update the wake up I can't very well gauge the effect that this patch has on MicrocodeDetect(). MicrocodeDetect() is a function that is not obvious to me. However, microcode detection is disabled on OVMF, both via HOB and via PCD (zero region size). So, I have nothing against *restricting* microcode detection "further". Regarding MtrrTable: it seems that this field is only consumed in ApMtrrSync() and ApInitializeSync(). I suppose those functions never run when CpuMpData->CpuCount is 1. Thus restricting MtrrGetAllMtrrs() should be fine as well. Reviewed-by: Laszlo Ersek -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111618): https://edk2.groups.io/g/devel/message/111618 Mute This Topic: https://groups.io/mt/102724547/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-