From nobody Fri Apr 26 18:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61521+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61521+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592576177454375.29266905189536; Fri, 19 Jun 2020 07:16:17 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id T7OpYY1788612xc2GpN4ud5D; Fri, 19 Jun 2020 07:16:16 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web10.7785.1592575995384894727 for ; Fri, 19 Jun 2020 07:13:16 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cjTTupgZz8Ytxvnx3QQmJFmcr/qAs7/Hjf2MfXNcvWQSlsyFniXANrM/d88B3Wm8CXUZxvpKOW5e0qDFF36AhKTBfBeQrUOLDPIzO9mEHyDfRhI2UsoMtCP60/dg8gJw+TLLPQOJmMU0SLJ3cjc6xp/XGTnnn9o9mc/opSbE5ENljIp0cXD1CvRmWb4x9p9srnfKsTBbU0HayXuSQGoIOONzk/E1CyZl/SMunYADqUibDBN26RmjX6mrspxcXrqvmzv3Xf3LbXZV+8lgPcOmY50dxYMuVK+QNlvDmIkhOUpkGitkl80qJomxO0FzGJyuwYa7b+eiBs42WXMCMLp5ww== 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=nL4sxRS9yl2hdNYZpGBFxugT7S+skPiMWcvcsZNaGVQ=; b=bw1efVDNQhliQaCii/Rm0g6kKX2bfTUXF091KGBLZcGEmOP9rUPXPriLRJqg9ztcaButynh1QbQtavG2MDJj+Q+lcSc+6qnFRJI3XLe1Mr1NOeuKGs+4zhhrVzZ5eqqg1v6l8c0kPZibR+QLO2H0lBGQdNyQ0QhGzxP8wl5u3aSDYOMGnhoD0WQKgpcfe/Gg7wc+u6MmtlgYFiiOSQApjX1ZZ1IQkIfF+9QJzEGwy2Bh59tMK/kWWxBupZdwSJaLsyJyQ1/WLZYTpDT2Y3W/nBwAIL5TR84VfK8jV0RmFTYen3NaCrrTgymFHci+rEZInXI3C8rDl/BHR3VLetQLQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Fri, 19 Jun 2020 14:13:15 +0000 X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e]) by SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e%7]) with mapi id 15.20.3109.021; Fri, 19 Jun 2020 14:13:15 +0000 From: "Kirkendall, Garrett" To: devel@edk2.groups.io Cc: Ray Ni Subject: [edk2-devel] [PATCH v4 1/3] PcAtChipsetPkg: PcAtChipsetPkg.dsc add UefiCpuLib LibraryClass Date: Fri, 19 Jun 2020 09:12:57 -0500 Message-Id: <20200619141259.8828-2-Garrett.Kirkendall@amd.com> In-Reply-To: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> References: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> X-ClientProxiedBy: DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) To SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from biosdev-01.amd.com (165.204.78.2) by DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Fri, 19 Jun 2020 14:13:14 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 87455a0e-4168-4898-128e-08d8145ae7e8 X-MS-TrafficTypeDiagnostic: SA0PR12MB4576: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1923; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: EHGwoXUi0N0uY4MkQOmVj7xSAYZ2b5d6esIEkAC02f912w0+irna2S/ZBFm6gAxz3c5e11dZztwqRqvN1vrJuzxjleBBwJUzXaV4OJ8plAJqPmafBg8vVJ4dGzN54M+Eu7sswNbkiyH05kTwDwnRJwfkJxNJZnhixw0SVt1Y1su9rkeaHbnNJOkwS/dIrI8zLAtAw72q+zPomZFzeC2h+hFBZiQq4ijd3QVU+xbWw+b6aAH2soHbS2K7GRRMQeFM4VfdAEhomHbImm6kkuybURI+7vY4NTbBSUoDBLxv+NsEMNLuSw7oamr9Sf9h9CMz X-MS-Exchange-AntiSpam-MessageData: ldW0z09PpiVgs9mDUfEJEjAFrlbPtoRWFs4Ff4co7slnRe+C9FabnFM3rmWCEmkoiqK0WvpxEri2y3EEIhW3TCkLd1c2sKBTivd7bP2kiHXBvd0kMmCzxlKqO1BuwfBdFMcbjhiOn5XgxT1GwwiUqsbVwmkCTLhptzxWDkYnh/rTqrSglU2cSfTGxxgo6Hc+sQagGPRFP+eIGx0z1TbuGP3AegPJ2dsvzCHMudAXs1sYqtb7rhRqwi0xj3TxLTPY1FlQmSCJncjQW4GERMdQGMpuPNVU/PdCa9L+3HqlyEbVn6EEmjT1jxtysImxmz1eHFbcMS+wbF+KWwS0HC3m1AL5oo4AQtfocaaG3PoNDpHai9fomuN0VjRklrtq9AAarTVwpNsimMKbG6ZS1j6Wbdg/CXXTsFagFWjKd4KguRSmjmQjsKW4BRZz+5QXBUlHtUttIbYyxHpCihf1sc5K8OZ9GmwbIoE4AqerdVel+gQ= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 87455a0e-4168-4898-128e-08d8145ae7e8 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2020 14:13:14.7780 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n1LAPsoflwLbQdO3MKYuDjNCiIyj7q5N4ISKeZBxhgRV875N/K1bjIk5bA+ZnljYzXMzfhiOHCadJJ4sh34yNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 Precedence: Bulk List-Unsubscribe: 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,garrett.kirkendall@amd.com X-Gm-Message-State: LC1LEUOz3lRLcsp6Ml7ZKzKSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592576176; bh=URoJyWZOWMOkesrr+qTXvCI5TeyLUaa/x9DY/Dh6PyA=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Ql0mavmF9N6bmb7SKn16MbQ3Zus632ZwIZNrH82q45TQxuYjBkXFqN68RIZxbiluVi0 T+tcAXJvs/Q2fZV9zGeVg7/WWAAowkgTcKjg5nE3yYG2MXf/KSU8ySc/IX/mMClaCAV/c XU5bCcpiq8DQb+tSFodgI7uv+THIOOUdveU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" In preparation for moving StandardSignatureIsAuthenticAMD to UefiCpuLib in UefiCpuPkg, PcAtChipset/PcAtChipsetPkg.dsc needs LibraryClass UefiCpuLib. LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf will need UefiCpuLib LibraryClass. Likely most "real" platforms will be using BaseX2XApicLib instance which already required UefiCpuLib. Cc: Ray Ni Signed-off-by: Garrett Kirkendall --- PcAtChipsetPkg/PcAtChipsetPkg.dsc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PcAtChipsetPkg/PcAtChipsetPkg.dsc b/PcAtChipsetPkg/PcAtChipset= Pkg.dsc index 01a3ee716a98..b61b7d1f528e 100644 --- a/PcAtChipsetPkg/PcAtChipsetPkg.dsc +++ b/PcAtChipsetPkg/PcAtChipsetPkg.dsc @@ -2,6 +2,7 @@ # PC/AT Chipset Package # # Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, AMD Incorporated. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -39,6 +40,7 @@ [LibraryClasses] ResetSystemLib|PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.inf IoApicLib|PcAtChipsetPkg/Library/BaseIoApicLib/BaseIoApicLib.inf LocalApicLib|UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf + UefiCpuLib|UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseRepor= tStatusCodeLibNull.inf HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf =20 --=20 2.27.0 -=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 (#61521): https://edk2.groups.io/g/devel/message/61521 Mute This Topic: https://groups.io/mt/74980316/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 18:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61522+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61522+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592575999255236.7877957042964; Fri, 19 Jun 2020 07:13:19 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id DLksYY1788612x2aMeNasu8U; Fri, 19 Jun 2020 07:13:17 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.77]) by mx.groups.io with SMTP id smtpd.web12.7776.1592575997187463589 for ; Fri, 19 Jun 2020 07:13:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k+HRJHApjuu3t07KBDcajqtYmO/+IL8dYdORHykC1GFPaE2IgNUoP6uCIFgRP65FYmYXs5oIaAAq07Xf6XkDVgGXP3a+wjCJkZ+FdD028mv421HCLC+YKroL6YXuAYujeaSZ2ny9aGs6J6iG+a9Ey0UlD5FaLl3E0sOzKqLG+CDhUswoEORad7JSDYS6bwyeww2ocR76zzgYhBOzwpzV+JlYMLBFqkIH6rPHYtQ9zSckIfRXUuKIlqzSqXrR04lPSW6xzcAeeXoe8Ck9axVQOmIERaiSe6jnlMc5bhYeuxj3ndLfQYc0DyZMjqDvN2QLK2UZYXGUgvGbuVqu2c6wdQ== 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=zUM81YlBi07HOtoSezUaDT+XKTXGL4kLfBpgX+sXwuA=; b=WYl0GQQJIHZVUl2Ox1QOCLkWE+Ypvb1w1trLL0d5R6vHFgfZuPR2XWgUNMdzhLd6m+i5TzgtmGy5gkQKsgglGp18gOxBYNuEydHDT2rS63oOcsAlZdZQ0XlpyJEnipjhcG40xiQ/128kMUlFVt7K8DAghBGSwFz590kDSR0EDYUIQrRPWxiJrqR2uqL4sifhhsOA9wgL/PXIXbHl+P8HZ35h8sNrNwr6q+h01375m3tLUi3+MIDzBPIkYy6zqwI6BnvDoTg7asxoywMQRU83ncfEqmU8RfOKyMZ3BndKPBbDWxtfyMeOe1sfWQlpzrMd68vXIWhyQARi9S2NwMVjnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Fri, 19 Jun 2020 14:13:15 +0000 X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e]) by SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e%7]) with mapi id 15.20.3109.021; Fri, 19 Jun 2020 14:13:15 +0000 From: "Kirkendall, Garrett" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek Subject: [edk2-devel] [PATCH v4 2/3] UefiCpuPkg: Move StandardSignatureIsAuthenticAMD to BaseUefiCpuLib Date: Fri, 19 Jun 2020 09:12:58 -0500 Message-Id: <20200619141259.8828-3-Garrett.Kirkendall@amd.com> In-Reply-To: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> References: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> X-ClientProxiedBy: DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) To SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from biosdev-01.amd.com (165.204.78.2) by DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Fri, 19 Jun 2020 14:13:14 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7dcee060-d4c2-4e8a-67cb-08d8145ae879 X-MS-TrafficTypeDiagnostic: SA0PR12MB4576: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: YtZZdsPudlqWHcFCSx4xkHk93YowTmUaTSGqSLfgt0UaVRMrXORxzKYVQdYaL5U+Hktpgh04/ybir7ec1ehMoTfQEE2cRIi79Ed+B7eHvLUlZcOl0OmV6mN+XZghVlELNY0EnGDnSeU8plQeJ1UNUgGiyQQVgDTzbqaDz5VcTQMN4FjYG3XzuuxOc37db8d3mjwixK7xnYNtJfCpWv8A+eiVReFBf2wo4oJ1EHcELzfeAuxhs4cSNFceg3nxbAKjCIH+9UoIdijy1NIdcsXSawzmJprJWvJEGQPvdz34t/KyjQpG+BvOFGh74q4Fnpe8VtYERcT+SsJI1vfBZ5A7hw== X-MS-Exchange-AntiSpam-MessageData: xfaMO+21lq/GqZCWlM46ZhaPxQh4dqjXkpJZHhVj04KvS79EAp1KWYvLB5j+DnadlNqYDDckKLdvVTZndBNZvntgiI0SFAY6jcTS+7cSeeloLgA+0sTDGpTkWsiQjmM0qfgsKFfu1Q9Ug+3hCgNVgw8cMGxqfeiuGB8FCgbgVNflgYxC351+w8yq5Egex8EvfqJdyTX2K6eLMwq7fL7stTr9R2yLFqqzxcwyqgDrbyCmmHVy1v9j+++Vx+zoWWgkKpDLfyYkR9i6hwsDBdCWqZUjiZD6u/rRPMKFRa2gu4aqixBz93IaDq62d141Y1ANef9bNjgdL7maWyjLsOZ5ioS+g9tE3T/Roa/Jn1bl4GEj+iPnvGy8QNK1gBVeJZo9SITSh2WSF+hW4vamvt7yqOzVYSECFknYQJUCGn+la8LImWISUCe/W8wSEz+sOC4/cxCjkudINqj7xxkx0IVmTd9E2VY1XrzCPd7CU5NQb8U= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dcee060-d4c2-4e8a-67cb-08d8145ae879 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2020 14:13:15.5056 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: asQXXVa+Ky8XtaHMpI81T4awgk3Yz9QbSHShmGTvOEssagg/JGqfpjpabkL5Dz0f+k4acusljcTSpVQa/0kg5A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 Precedence: Bulk List-Unsubscribe: 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,garrett.kirkendall@amd.com X-Gm-Message-State: RYmdMhzmC1jhFx5wz4x2M7WFx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592575997; bh=HV6WsTXZY/VVI7T0bXF5ppRxbVySLtecim8uVL1FQH8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=bhm7wjQeiRGpH7gChSrvYBuEQrtomC0rIrXuYjctBp35vog/f5xOtFxfijXWhwjfacs rqP5IqzIr9hJj2vWzWdqGazN4tNra1w4YlrHFC4iq2kPVHulwUEnQfNaZ1zB3lLld/PE3 t7oQ8NznSQHxs/SmuXqwVxMRCIS8qMBJMZ0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Refactor StandardSignatureIsAuthenticAMD into BaseUefiCpuLib from separate copies in BaseXApicLib, BaseXApicX2ApicLib, and MpInitLib. This allows for future use of StandarSignatureIsAuthinticAMD without creating more instances in other modules. This function allows IA32/X64 code to determine if it is running on an AMD brand processor. UefiCpuLib is already included directly or indirectly in all modified modules. Complete move is made in this change. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Garrett Kirkendall Reviewed-by: Laszlo Ersek Reviewed-by: Eric Dong --- UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf | 7 ++++ UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf | 2 ++ UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf | 2 ++ UefiCpuPkg/Include/Library/UefiCpuLib.h | 14 ++++++++ UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c | 38 ++++++++= ++++++++++++ UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 25 ++------= ----- UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 25 ++------= ----- UefiCpuPkg/Library/MpInitLib/MpLib.c | 23 --------= ---- 8 files changed, 67 insertions(+), 69 deletions(-) diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf b/UefiCpu= Pkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf index 006b7acbf14e..34d3a7bb4303 100644 --- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf @@ -4,6 +4,7 @@ # The library routines are UEFI specification compliant. # # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, AMD Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -29,6 +30,12 @@ [Sources.IA32] [Sources.X64] X64/InitializeFpu.nasm =20 +[Sources] + BaseUefiCpuLib.c + [Packages] MdePkg/MdePkg.dec UefiCpuPkg/UefiCpuPkg.dec + +[LibraryClasses] + BaseLib diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf b/UefiCpuPkg/= Library/BaseXApicLib/BaseXApicLib.inf index bdb2ff372677..561baa44b0e6 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.inf @@ -5,6 +5,7 @@ # where local APIC is disabled. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, AMD Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -37,6 +38,7 @@ [LibraryClasses] TimerLib IoLib PcdLib + UefiCpuLib =20 [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds ## SOMETIMES= _CONSUMES diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf b= /UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf index ac1e0a1c9896..1e2a4f8b790f 100644 --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf @@ -5,6 +5,7 @@ # where local APIC is disabled. # # Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2020, AMD Inc. All rights reserved.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -37,6 +38,7 @@ [LibraryClasses] TimerLib IoLib PcdLib + UefiCpuLib =20 [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuInitIpiDelayInMicroSeconds ## SOMETIMES= _CONSUMES diff --git a/UefiCpuPkg/Include/Library/UefiCpuLib.h b/UefiCpuPkg/Include/L= ibrary/UefiCpuLib.h index 82e53bab3a0f..5326e7246301 100644 --- a/UefiCpuPkg/Include/Library/UefiCpuLib.h +++ b/UefiCpuPkg/Include/Library/UefiCpuLib.h @@ -5,6 +5,7 @@ to be UEFI specification compliant. =20 Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2020, AMD Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -29,4 +30,17 @@ InitializeFloatingPointUnits ( VOID ); =20 +/** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ); + #endif diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c b/UefiCpuPk= g/Library/BaseUefiCpuLib/BaseUefiCpuLib.c new file mode 100644 index 000000000000..c2cc3ff9a709 --- /dev/null +++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.c @@ -0,0 +1,38 @@ +/** @file + This library defines some routines that are generic for IA32 family CPU. + + The library routines are UEFI specification compliant. + + Copyright (c) 2020, AMD Inc. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include +#include + +/** + Determine if the standard CPU signature is "AuthenticAMD". + + @retval TRUE The CPU signature matches. + @retval FALSE The CPU signature does not match. + +**/ +BOOLEAN +EFIAPI +StandardSignatureIsAuthenticAMD ( + VOID + ) +{ + UINT32 RegEbx; + UINT32 RegEcx; + UINT32 RegEdx; + + AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); + return (RegEbx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && + RegEcx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && + RegEdx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); +} diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c b/UefiCpuPkg/Li= brary/BaseXApicLib/BaseXApicLib.c index 33ea15ca2916..52bd90d33428 100644 --- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c @@ -4,7 +4,7 @@ This local APIC library instance supports xAPIC mode only. =20 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Inc. All rights reserved.
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -21,33 +21,12 @@ #include #include #include +#include =20 // // Library internal functions // =20 -/** - 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 =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - /** Determine if the CPU supports the Local APIC Base Address MSR. =20 diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c b/U= efiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c index d0f92b33dc8c..cdcbca046191 100644 --- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c +++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c @@ -5,7 +5,7 @@ which have xAPIC and x2APIC modes. =20 Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
- Copyright (c) 2017, AMD Inc. All rights reserved.
+ Copyright (c) 2017 - 2020, AMD Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -22,33 +22,12 @@ #include #include #include +#include =20 // // Library internal functions // =20 -/** - 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 =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - /** Determine if the CPU supports the Local APIC Base Address MSR. =20 diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpIn= itLib/MpLib.c index ab7a8ed6633a..9b0660a5d4ea 100644 --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c @@ -13,29 +13,6 @@ EFI_GUID mCpuInitMpLibHobGuid =3D CPU_INIT_MP_LIB_HOB_GUID; =20 =20 -/** - Determine if the standard CPU signature is "AuthenticAMD". - - @retval TRUE The CPU signature matches. - @retval FALSE The CPU signature does not match. - -**/ -STATIC -BOOLEAN -StandardSignatureIsAuthenticAMD ( - VOID - ) -{ - UINT32 RegEbx; - UINT32 RegEcx; - UINT32 RegEdx; - - AsmCpuid (CPUID_SIGNATURE, NULL, &RegEbx, &RegEcx, &RegEdx); - return (RegEbx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EBX && - RegEcx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_ECX && - RegEdx =3D=3D CPUID_SIGNATURE_AUTHENTIC_AMD_EDX); -} - /** The function will check if BSP Execute Disable is enabled. =20 --=20 2.27.0 -=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 (#61522): https://edk2.groups.io/g/devel/message/61522 Mute This Topic: https://groups.io/mt/74980317/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 18:33:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+61523+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+61523+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1592576002991537.852758497364; Fri, 19 Jun 2020 07:13:22 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JreMYY1788612xhBlWRZGHei; Fri, 19 Jun 2020 07:13:18 -0700 X-Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.7776.1592575997187463589 for ; Fri, 19 Jun 2020 07:13:17 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ksLXYV2eEz91ZPy/vEg8mBO5odJkbt70B+uhHd+dgHkUMlMIdnPy1MtQchapEy/BwHV68HOgxvTbpqUEl1m5LbcZfBqd0sMCxM8072s4a0eFE+ESi7RzGgJN+0YI/Qqq5XvtqjcFDL2efMFr/ANZsfgdKOEdZyxGEJ8No3Fxr5QyIpYbDYseS0zDrT/Wq2WNg6zgbaxbeOD7OssxImsqgkWsq144czL67cIndQKR9vwgQXexPz7iQvjjwqKwhK3+Y7pJKhgRdQrHfEinzNnmoa8R4Xhz8uC3+vAtbbMrJWhJghNNUVhOw+mW7muZvyKXWs1+6qr+VS21K3ugyd2cfg== 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=1NLHDuEFPzi/20dWgoH9c7qGh7aP86ISLepDCVRV4qA=; b=Si7xA1nWOsFn7eDC7EIq9X6dFIFMCkV0e54b0RQ978fUoEprVjdOVzOOUTUax/L9VG6yoeraTL71BfJ+aAC+UXC73fjAi8hlo/4c7q1Nrj3MAUKSyVAccjl08oPppmTWI+qTCsSGvEKU21RCeOaT39W6i24DcSOOHXrS3LnxSzSkuQWbZ14nBbvRSI+SO/kHbzly3Ob3XVKcArjAlnH13o0Sg4FELhJDGHVwb451tpmAnz/7RCvrvEHAADT+tKSQz0raugS03GqhHNi0mFjzCrBmRYALxkBrYCSdYnDc5mvj3uJze52SD2mHTf5rSahyuGj5c0JFX7ADF7KXfHso4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) by SA0PR12MB4576.namprd12.prod.outlook.com (2603:10b6:806:93::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22; Fri, 19 Jun 2020 14:13:16 +0000 X-Received: from SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e]) by SN1PR12MB2352.namprd12.prod.outlook.com ([fe80::156e:ce6d:a148:274e%7]) with mapi id 15.20.3109.021; Fri, 19 Jun 2020 14:13:16 +0000 From: "Kirkendall, Garrett" To: devel@edk2.groups.io Cc: Eric Dong , Ray Ni , Laszlo Ersek Subject: [edk2-devel] [PATCH v4 3/3] UefiCpuPkg: PiSmmCpuDxeSmm skip MSR_IA32_MISC_ENABLE manipulation on AMD Date: Fri, 19 Jun 2020 09:12:59 -0500 Message-Id: <20200619141259.8828-4-Garrett.Kirkendall@amd.com> In-Reply-To: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> References: <20200619141259.8828-1-Garrett.Kirkendall@amd.com> X-ClientProxiedBy: DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) To SN1PR12MB2352.namprd12.prod.outlook.com (2603:10b6:802:25::13) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-Received: from biosdev-01.amd.com (165.204.78.2) by DM5PR2201CA0022.namprd22.prod.outlook.com (2603:10b6:4:14::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3109.22 via Frontend Transport; Fri, 19 Jun 2020 14:13:15 +0000 X-Originating-IP: [165.204.78.2] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: c6f5d800-faa4-4650-5b1c-08d8145ae8f0 X-MS-TrafficTypeDiagnostic: SA0PR12MB4576: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: kog3pO/IURIB7r83VRJ75icJyLMnyn/PMTkLSLAWYDuovCuVviI9+Tc2ktCx7eF4wzNd+91IeFYi+Zz6E/iIOVWU36kGyo2hPigy9snVKQrCpoF1KpQYu/5mMtFQBzgtRcdrhwOACtJ2qnwy35xtFWtu2GbwlVmY8bOWaNb+bAuRmGVqNKvZYRo3RW4aEfjg0IWoS2TRM79w1V1MR5/etTaK5IfgGrI92pODPJuXNtH+z7xWABGEOXchk9s6fxW1CcPvYGK1rS8h9e9p02i70bjsOpIgNbbWq0iK2hZYeXOi+aNUaGMfI45DKMWscpxNoGi5sswpBwJCF5h6uIVM5A== X-MS-Exchange-AntiSpam-MessageData: d6w5ExWhBU7zEvEAIqbSbKP2apZ7wLDmb1ktLPlrLx2pCmKWpAOYieqUTGT9odFFv8tegvucFnYy+xtI16I341mC2VU4cZRznqBuntcNGaU78fOyeDaJ781CRTKpp0fqXQwFOgpVN1G3/F0krZQwEi3By0c0nbqjRAVXSDbDsqiImt3/bfjt/YsXT95y3xlwWHNAoMyxDNfwwYqwlWrku+mT68Hs0+cnhKhP6stxoIE9ytWigR0mM4UdavoeT4BnBcDNBA89NeAMt/Eco9APHchu4TfyxA2X+SuvkZARpZiTHxyMHCr4Bk4o9mBSpZvLPjJiTVdypjjsQDfr5yWu2Nh8rkN6oBX6R23KmDo21yzyzDFjtA9M6vj/ft/4yF0vT7lbn87wPr0O1A9lYuJAUmWOOg8yxzdbYsLdgm7SIQGHE67oD7B/353F7RDFpVvXJf0z0zvEroSBtUFxtcE5TivwpT40wFNKgvbUoBr+i34= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6f5d800-faa4-4650-5b1c-08d8145ae8f0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jun 2020 14:13:16.3451 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ny1LuqiHdpzTStXZN2AD/Nyid9o5HgLffyYgNQvxNlSgOTULuF+Qc2knLkFCxsT7io1twrLe5/HR3xBBrlSyRg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4576 Precedence: Bulk List-Unsubscribe: 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,garrett.kirkendall@amd.com X-Gm-Message-State: iOeQgFklzp4fjYJ1rZ4WAvyUx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1592575998; bh=gsynMLTkuE9gJvemYKkAaOA2touPMROYGX8bnuFmw4Y=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=Q371k5v/A4lGtpmkFxd++rmqmdJFAmjN1p60cI/IfXdTUI9jvziAnKSdL1q72OfFKu1 KvboHty5EuQhFYYkZcfKyfageWOxD7skNrJvs3ZY/3zNrMn0W9uLE3R5ahN2d9JF85Ojw xrdfJu/FOPMSEXlYwhW+/SQNa+HcY2seSI8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" AMD does not support MSR_IA32_MISC_ENABLE. Accessing that register causes and exception on AMD processors. If Execution Disable is supported, but if the processor is an AMD processor, skip manipulating MSR_IA32_MISC_ENABLE[34] XD Disable bit. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Signed-off-by: Garrett Kirkendall --- Notes: Tested on Intel hardware with Laszlo Ersek's help =20 (1) downloaded two Linux images from provided links. (2) Test using a 32-bit guest on an Intel host (standing in your edk2 t= ree, with the patches applied): =20 $ build -a IA32 -b DEBUG -p OvmfPkg/OvmfPkgIa32.dsc -t GCC5 -D SMM_REQU= IRE =20 $ qemu-system-i386 \ -cpu coreduo,-nx \ -machine q35,smm=3Don,accel=3Dkvm \ -m 4096 \ -smp 4 \ -global driver=3Dcfi.pflash01,property=3Dsecure,value=3Don \ -drive if=3Dpflash,format=3Draw,unit=3D0,readonly=3Don,file=3DBuild= /OvmfIa32/DEBUG_GCC5/FV/OVMF_CODE.fd \ -drive if=3Dpflash,format=3Draw,unit=3D1,snapshot=3Don,file=3DBuild= /OvmfIa32/DEBUG_GCC5/FV/OVMF_VARS.fd \ -drive id=3Dhdd,if=3Dnone,format=3Dqcow2,snapshot=3Don,file=3Dfedor= a-30-efi-systemd-i686.qcow2 \ -device virtio-scsi-pci,id=3Dscsi0 \ -device scsi-hd,drive=3Dhdd,bus=3Dscsi0.0,bootindex=3D1 =20 (Once you get a login prompt, feel free to interrupt QEMU with Ctrl-C.) =20 (3) Test using a 64-bit guest on an Intel host: =20 $ build -a IA32 -a X64 -b DEBUG -p OvmfPkg/OvmfPkgIa32X64.dsc -t GCC5 -= D SMM_REQUIRE =20 $ qemu-system-x86_64 \ -cpu host \ -machine q35,smm=3Don,accel=3Dkvm \ -m 4096 \ -smp 4 \ -global driver=3Dcfi.pflash01,property=3Dsecure,value=3Don \ -drive if=3Dpflash,format=3Draw,unit=3D0,readonly=3Don,file=3DBuild= /Ovmf3264/DEBUG_GCC5/FV/OVMF_CODE.fd \ -drive if=3Dpflash,format=3Draw,unit=3D1,snapshot=3Don,file=3DBuild= /Ovmf3264/DEBUG_GCC5/FV/OVMF_VARS.fd \ -drive id=3Dhdd,if=3Dnone,format=3Dqcow2,snapshot=3Don,file=3Dfedor= a-31-efi-grub2-x86_64.qcow2 \ -device virtio-scsi-pci,id=3Dscsi0 \ -device scsi-hd,drive=3Dhdd,bus=3Dscsi0.0,bootindex=3D1 =20 Tested on real AMD Hardware UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h | 3 +++ UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c | 9 ++++++++- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm | 19 +++++++++++++++++-- UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm | 20 ++++++++++++++++++-- 4 files changed, 46 insertions(+), 5 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h b/UefiCpuPkg/Pi= SmmCpuDxeSmm/SmmProfileInternal.h index 43f6935cf9dc..993360a8a8c1 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfileInternal.h @@ -2,6 +2,7 @@ SMM profile internal header file. =20 Copyright (c) 2012 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2020, AMD Incorporated. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -13,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include =20 #include "SmmProfileArch.h" @@ -99,6 +101,7 @@ extern SMM_S3_RESUME_STATE *mSmmS3ResumeState; extern UINTN gSmiExceptionHandlers[]; extern BOOLEAN mXdSupported; X86_ASSEMBLY_PATCH_LABEL gPatchXdSupported; +X86_ASSEMBLY_PATCH_LABEL gPatchMsrIa32MiscEnableSupported; extern UINTN *mPFEntryCount; extern UINT64 (*mLastPFEntryValue)[MAX_PF_ENTRY_COUNT]; extern UINT64 *(*mLastPFEntryPointer)[MAX_PF_ENTRY_COUN= T]; diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c b/UefiCpuPkg/PiSmmCpuDx= eSmm/SmmProfile.c index c47b5573e366..d7ed9ab7a770 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c @@ -2,7 +2,7 @@ Enable SMM profile. =20 Copyright (c) 2012 - 2019, Intel Corporation. All rights reserved.
-Copyright (c) 2017, AMD Incorporated. All rights reserved.
+Copyright (c) 2017 - 2020, AMD Incorporated. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -1015,6 +1015,13 @@ CheckFeatureSupported ( mXdSupported =3D FALSE; PatchInstructionX86 (gPatchXdSupported, mXdSupported, 1); } + + if (StandardSignatureIsAuthenticAMD ()) { + // + // AMD processors do not support MSR_IA32_MISC_ENABLE + // + PatchInstructionX86 (gPatchMsrIa32MiscEnableSupported, FALSE, 1); + } } =20 if (mBtsSupported) { diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm b/UefiCpuPkg/PiSm= mCpuDxeSmm/Ia32/SmiEntry.nasm index f96de9bdeb43..167f5e14dbd4 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmiEntry.nasm @@ -1,5 +1,6 @@ ;-------------------------------------------------------------------------= ----- ; ; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
+; Copyright (c) 2020, AMD Incorporated. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: @@ -59,6 +60,7 @@ global ASM_PFX(gPatchSmiStack) global ASM_PFX(gPatchSmbase) extern ASM_PFX(mXdSupported) global ASM_PFX(gPatchXdSupported) +global ASM_PFX(gPatchMsrIa32MiscEnableSupported) extern ASM_PFX(gSmiHandlerIdtr) =20 extern ASM_PFX(mCetSupported) @@ -153,17 +155,30 @@ ASM_PFX(gPatchSmiCr3): ASM_PFX(gPatchXdSupported): cmp al, 0 jz @SkipXd + +; If MSR_IA32_MISC_ENABLE is supported, clear XD Disable bit + mov al, strict byte 1 ; source operand may be patched +ASM_PFX(gPatchMsrIa32MiscEnableSupported): + cmp al, 1 + jz MsrIa32MiscEnableSupported + +; MSR_IA32_MISC_ENABLE not supported + xor edx, edx + push edx ; don't try to restore the XD Disa= ble bit just before RSM + jmp EnableNxe + ; ; Check XD disable bit ; +MsrIa32MiscEnableSupported: mov ecx, MSR_IA32_MISC_ENABLE rdmsr push edx ; save MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 ; MSR_IA32_MISC_ENABLE[34] - jz .5 + jz EnableNxe and dx, 0xFFFB ; clear XD Disable bit if it is set wrmsr -.5: +EnableNxe: mov ecx, MSR_EFER rdmsr or ax, MSR_EFER_XD ; enable NXE diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm b/UefiCpuPkg/PiSmm= CpuDxeSmm/X64/SmiEntry.nasm index 8bfba55b5d08..0e154e5db949 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm @@ -1,5 +1,6 @@ ;-------------------------------------------------------------------------= ----- ; ; Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.
+; Copyright (c) 2020, AMD Incorporated. All rights reserved.
; SPDX-License-Identifier: BSD-2-Clause-Patent ; ; Module Name: @@ -67,6 +68,7 @@ extern ASM_PFX(CpuSmmDebugExit) global ASM_PFX(gPatchSmbase) extern ASM_PFX(mXdSupported) global ASM_PFX(gPatchXdSupported) +global ASM_PFX(gPatchMsrIa32MiscEnableSupported) global ASM_PFX(gPatchSmiStack) global ASM_PFX(gPatchSmiCr3) global ASM_PFX(gPatch5LevelPagingNeeded) @@ -152,18 +154,32 @@ SkipEnable5LevelPaging: ASM_PFX(gPatchXdSupported): cmp al, 0 jz @SkipXd + +; If MSR_IA32_MISC_ENABLE is supported, clear XD Disable bit + mov al, strict byte 1 ; source operand may be patched +ASM_PFX(gPatchMsrIa32MiscEnableSupported): + cmp al, 1 + jz MsrIa32MiscEnableSupported + +; MSR_IA32_MISC_ENABLE not supported + sub esp, 4 + xor rdx, rdx + push rdx ; don't try to restore the XD Disa= ble bit just before RSM + jmp EnableNxe + ; ; Check XD disable bit ; +MsrIa32MiscEnableSupported: mov ecx, MSR_IA32_MISC_ENABLE rdmsr sub esp, 4 push rdx ; save MSR_IA32_MISC_ENABLE[63-32] test edx, BIT2 ; MSR_IA32_MISC_ENABLE[34] - jz .0 + jz EnableNxe and dx, 0xFFFB ; clear XD Disable bit if it is set wrmsr -.0: +EnableNxe: mov ecx, MSR_EFER rdmsr or ax, MSR_EFER_XD ; enable NXE --=20 2.27.0 -=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 (#61523): https://edk2.groups.io/g/devel/message/61523 Mute This Topic: https://groups.io/mt/74980319/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-