From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from m4a0072g.houston.softwaregrp.com (m4a0072g.houston.softwaregrp.com [15.124.2.130]) by mx.groups.io with SMTP id smtpd.web11.5767.1587111424940353106 for ; Fri, 17 Apr 2020 01:17:13 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: suse.com, ip: 15.124.2.130, mailfrom: glin@suse.com) Received: FROM m4a0072g.houston.softwaregrp.com (15.120.17.147) BY m4a0072g.houston.softwaregrp.com WITH ESMTP; Fri, 17 Apr 2020 08:15:29 +0000 Received: from M4W0334.microfocus.com (2002:f78:1192::f78:1192) by M4W0335.microfocus.com (2002:f78:1193::f78:1193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Fri, 17 Apr 2020 08:14:59 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (15.124.8.12) by M4W0334.microfocus.com (15.120.17.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10 via Frontend Transport; Fri, 17 Apr 2020 08:14:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KM9KuPkrUt0IsXqVyQvm3JByWQZ2bndWj3qZloI3H8+6bwmAR7pD+b5BqfDZKgPm4/7DFPGMXX5Cz/f2GD6FJy+OW3tWMbdUE8AYuBevZ2r/+062J1f/EeWx7zhm7zbZ2zME/aA0yOpRfc9f7sdb9z80d+yUKvLdEF8A9wnRBQE57zdR2jyyVmbcPcFl5BwiNnI+KVbwthc63W+g8IK4OrARr2HTCQrJMcs0arW/X0PVHT4djnriLCZU1t4onT7+lEdaRvv49fo9JCkhg3CTKMd7NscKzbMeeYErwqehaHXahsKlFy9nMh+T719ar0l/GWA/jdOxlOcw801opHgiBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=U+zK9RIR4ccVsUu6Xj4PIy8MtE9ZuD9R5OhQSJVLnno=; b=aNjrWm0OJfDqtvQSux+mU0gPxoATJCrxWCn9vy+daezgPekN93QzeQbRZpg0kNTdIYnUzrwfCVR/gnV/0b/puuFy0ePorCow+NZ/8V/q+wiE3X6fLayeIptzGv90VyxPH0ul079tqrAQNEeIQjWqeJwPZWj6XEGPXMpzZ9JPPoejJ21/Rcls+eK/tKH2Gz8H89fv58rVdelnjIKjVoy/RpZURpJzIcNJROxDgnyD4QPtfHwtoowDqO7BhhNWkpEmllyx9UZhL9IcpVVgLfYmxrez4s7OsOlKAZo1c0bUTPluy7LGKsip/noyDy7maw+pCV6PgnTmNmwBlVJoGKsSZw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=GLin@suse.com; Received: from DM6PR18MB3258.namprd18.prod.outlook.com (2603:10b6:5:1cd::31) by DM6PR18MB2682.namprd18.prod.outlook.com (2603:10b6:5:18c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2900.25; Fri, 17 Apr 2020 08:14:58 +0000 Received: from DM6PR18MB3258.namprd18.prod.outlook.com ([fe80::5cdb:be43:a2bf:ca25]) by DM6PR18MB3258.namprd18.prod.outlook.com ([fe80::5cdb:be43:a2bf:ca25%6]) with mapi id 15.20.2921.027; Fri, 17 Apr 2020 08:14:58 +0000 Date: Fri, 17 Apr 2020 16:14:47 +0800 From: "Gary Lin" To: , CC: Eric Dong , Ray Ni , Laszlo Ersek Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Skip reading PlatformId on AMD processors. Message-ID: <20200417081447.GC26140@GaryWorkstation> References: <1582988745-1189-1-git-send-email-leo.duran@amd.com> <1582988745-1189-2-git-send-email-leo.duran@amd.com> In-Reply-To: <1582988745-1189-2-git-send-email-leo.duran@amd.com> X-ClientProxiedBy: LO2P265CA0328.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::28) To DM6PR18MB3258.namprd18.prod.outlook.com (2603:10b6:5:1cd::31) Return-Path: GLin@suse.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from GaryWorkstation (60.251.47.115) by LO2P265CA0328.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a4::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.25 via Frontend Transport; Fri, 17 Apr 2020 08:14:55 +0000 X-Originating-IP: [60.251.47.115] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 27fe96de-870c-46d0-44ff-08d7e2a76b2f X-MS-TrafficTypeDiagnostic: DM6PR18MB2682: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 0376ECF4DD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR18MB3258.namprd18.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(10019020)(6029001)(4636009)(39860400002)(396003)(346002)(136003)(366004)(376002)(5660300002)(6666004)(33656002)(956004)(52116002)(55236004)(2906002)(55016002)(8676002)(26005)(33716001)(9686003)(478600001)(4326008)(81156014)(1076003)(186003)(8936002)(19627235002)(6496006)(966005)(16526019)(54906003)(66946007)(316002)(86362001)(66556008)(66476007);DIR:OUT;SFP:1102; Received-SPF: None (protection.outlook.com: suse.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /gIiOnJdoenXfmusu38Kb5iXkNEZSzA0OGztln2UA1brpOkkpE0MbQicQYHQK2EIawCGZjlFFJ1Lqh348gh4G5mqpzgLRjnSRjY24opVi4WDEF42crXxnZhahDagwLvZgwkKKPBXaKv/z0SlJtdwKAX6HU50CGX5qD2+RQx6lKEPyktPhI2MTEHJIoDKR81nvY8McQXRtfTli+LyjlzeAKihVhX6bUBkYfpOqz41CzG2aBlSOqkoxGR6Su2e4kvX3PqBJspqJJMarTeKaHvmve+yaKH4ZCf8NCCDjvLVQ+smY4J/F1i0MtiUeYsS2t2I/jwynYloOSVsJ02oX/PO1lX/HWFZA7mM/U6Tu3hcoguVaFLW9wBhDmZzbCN8466fX9aalUFc9ytSwY8NsliCDMHdaILb7tJU39slV1zpxFxsk86Z3HLtA+JSx8MBLvU6HqWR7Z16M6H3jNKbpIeLGUAF8QyKdQfLxOSpGRuwHwyaBM1DKUlOIGruOHPebUbqkiEGTMTvWeurtQcifNDT0Q== X-MS-Exchange-AntiSpam-MessageData: NfUOLfA/8x1RSqUF8SA/XkdpI7I3BZXpNj8WzFtcFO1AVHxieEiTSza7+7jYK7Kt7lZJdfbW+x6MQY843CJfQ5E0MHVCv3qtnn2Z2kksHaJC1DnmCSm57ELRHtGLBY+sM+3LXgfL3Qy4WvsPy9f+uQ== X-MS-Exchange-CrossTenant-Network-Message-Id: 27fe96de-870c-46d0-44ff-08d7e2a76b2f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2020 08:14:58.4238 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 856b813c-16e5-49a5-85ec-6f081e13b527 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oRuoN5JlZ6qWJ5DPfouSbMEEKuBerwk53rSRL+zhWkoi5ovZcgm9Ka50T12BFtKs X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR18MB2682 X-OriginatorOrg: suse.com Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline On Sat, Feb 29, 2020 at 09:05:45AM -0600, Leo Duran wrote: > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2556 > > This patch uses CPUID signature check to skip reading the PlatformId MSR, > which is not implemented on AMD processors. > > The PlatformId is used for loading microcode patches, which is also not > supported and AMD-based platforms. To mitigate the PlatformId dependency, > PcdCpuMicrocodePatchAddress and PcdCpuMicrodePatchRegionSize must be set > to 0 (default value), in order to bypass microcode loading code paths. > I got an error report about the executable bit of MpLib.h while packaging ovmf. It turned out that this patch accidentally changed the file mode. It would be nice if the mode can be corrected. Thanks, Gary Lin > Cc: Eric Dong > Cc: Ray Ni > Cc: Laszlo Ersek > Signed-off-by: Leo Duran > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 34 ++++++++++++++++++++++++++++++++-- > UefiCpuPkg/Library/MpInitLib/MpLib.h | 3 +++ > 2 files changed, 35 insertions(+), 2 deletions(-) > mode change 100644 => 100755 UefiCpuPkg/Library/MpInitLib/MpLib.h > > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index d0fbc17..d2200c3 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -2,6 +2,8 @@ > CPU MP Initialize Library common functions. > > Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, AMD Inc. All rights reserved.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -10,6 +12,29 @@ > > EFI_GUID mCpuInitMpLibHobGuid = CPU_INIT_MP_LIB_HOB_GUID; > > + > +/** > + Determine if the standard CPU signature is "AuthenticAMD". > + > + @retval TRUE The CPU signature matches. > + @retval FALSE The CPU signature does not match. > + > +**/ > +BOOLEAN > +StandardSignatureIsAuthenticAMD ( > + VOID > + ) > +{ > + UINT32 RegEbx; > + UINT32 RegEcx; > + UINT32 RegEdx; > + > + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); > + return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && > + RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && > + RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); > +} > + > /** > The function will check if BSP Execute Disable is enabled. > > @@ -564,8 +589,13 @@ InitializeApData ( > CpuMpData->CpuData[ProcessorNumber].Waiting = FALSE; > CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : FALSE; > > - PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID); > - CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8) PlatformIdMsr.Bits.PlatformId; > + // > + // NOTE: PlatformId is not relevant on AMD platforms. > + // > + if (!StandardSignatureIsAuthenticAMD ()) { > + PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID); > + CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8)PlatformIdMsr.Bits.PlatformId; > + } > > AsmCpuid ( > CPUID_VERSION_INFO, > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h b/UefiCpuPkg/Library/MpInitLib/MpLib.h > old mode 100644 > new mode 100755 ^^^^^^ mode change > index 455cb3f..0c89f8a > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.h > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h > @@ -2,6 +2,8 @@ > Common header file for MP Initialize Library. > > Copyright (c) 2016 - 2020, Intel Corporation. All rights reserved.
> + Copyright (c) 2020, AMD Inc. All rights reserved.
> + > SPDX-License-Identifier: BSD-2-Clause-Patent > > **/ > @@ -12,6 +14,7 @@ > #include > > #include > +#include > #include > #include > #include > -- > 2.7.4 > > > >