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.web09.10980.1617710635695978265 for ; Tue, 06 Apr 2021 05:03:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=K3opPSRh; 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=1617710634; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RPMBWdZ7p519wOMEGUnG1Vvq9ORUfRYzeRXW1DPor+Y=; b=K3opPSRhPcfOC9CEa5SVdlnFuEtZ361QYJMFKYyhOMR40kH07Lrsc9GCTj59hLJzRQxNlw rWa4VbFGQY0d+RrfYO2/+kGkcka8VEXqdrphhDPkrCbYK5hJpURsGwnFUKlv+VoQhSd/Np CG7Nt9SOqn3uBN+HSXtJsdjyj4TDxNI= 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-512-VMr6Wnp1M42yUZzIMrgMfw-1; Tue, 06 Apr 2021 08:03:51 -0400 X-MC-Unique: VMr6Wnp1M42yUZzIMrgMfw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0D642190B2AC; Tue, 6 Apr 2021 12:03:22 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-115-134.ams2.redhat.com [10.36.115.134]) by smtp.corp.redhat.com (Postfix) with ESMTP id 690B219C45; Tue, 6 Apr 2021 12:03:21 +0000 (UTC) Subject: Re: [edk2-devel] [PATCH 0/4] UefiCpuPkg: Add MicrocodeLib for loading microcode To: devel@edk2.groups.io, ray.ni@intel.com References: <20210402055807.858-1-ray.ni@intel.com> From: "Laszlo Ersek" Message-ID: Date: Tue, 6 Apr 2021 14:03:20 +0200 MIME-Version: 1.0 In-Reply-To: <20210402055807.858-1-ray.ni@intel.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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 Hi Ray, On 04/02/21 07:58, Ni, Ray wrote: > The patch set creates a new MicrocodeLib for loading microcode. > Then updates all platforms to include this lib in DSC. > Then updates the MpInitLib to consume this lib. > > Edk2-platforms change will be sent out in a separate patch set. > > > Ray Ni (4): > UefiCpuPkg: Add MicrocodeLib for loading microcode > OvmfPkg: Add MicrocodeLib in DSC files. > UefiPayloadPkg/UefiPayloadPkg.dsc: Consume MicrocodeLib > UefiCpuPkg/MpInitLib: Consume MicrocodeLib to remove duplicated code > > OvmfPkg/AmdSev/AmdSevX64.dsc | 1 + > OvmfPkg/Bhyve/BhyveX64.dsc | 1 + > OvmfPkg/OvmfPkgIa32.dsc | 1 + > OvmfPkg/OvmfPkgIa32X64.dsc | 1 + > OvmfPkg/OvmfPkgX64.dsc | 1 + > OvmfPkg/OvmfXen.dsc | 1 + > UefiCpuPkg/Include/Library/MicrocodeLib.h | 120 +++++ > .../Library/MicrocodeLib/MicrocodeLib.c | 322 ++++++++++++ > .../Library/MicrocodeLib/MicrocodeLib.inf | 32 ++ > UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 1 + > UefiCpuPkg/Library/MpInitLib/Microcode.c | 484 ++++-------------- > UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 + > UefiCpuPkg/Library/MpInitLib/PeiMpInitLib.inf | 1 + > UefiCpuPkg/UefiCpuPkg.dec | 5 +- > UefiCpuPkg/UefiCpuPkg.dsc | 1 + > UefiPayloadPkg/UefiPayloadPkg.dsc | 1 + > 16 files changed, 582 insertions(+), 392 deletions(-) > create mode 100644 UefiCpuPkg/Include/Library/MicrocodeLib.h > create mode 100644 UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.c > create mode 100644 UefiCpuPkg/Library/MicrocodeLib/MicrocodeLib.inf > (1) I think we should use a new TianoCore feature request BZ for this feature, and the commit messages should link it. (I understand the library only factors out existent logic, but still.) (2) As I understand it, a platform can provide microcode in three ways: - via the "microcode patch" GUIDed HOB (PEI and DXE phases both), - via the "shadow microcode" PPI (PEI phase only), - via the PcdCpuMicrocodePatch* PCDs (PEI and DXE phases both). If a platform uses none of these methods (for example, OVMF does not), then I think it would benefit from a Null instance of the new MicrocodeLib class. Would you consider introducing a Null instance too, and using that one in the OVMF DSC files? Thanks, Laszlo