From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.78]) by mx.groups.io with SMTP id smtpd.web11.4307.1596829496600690780 for ; Fri, 07 Aug 2020 12:44:56 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=qp3Bv0tl; spf=none, err=SPF record not found (domain: amd.com, ip: 40.107.93.78, mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nXszT6CO26rbDvugwufLF+FitnYFFhFmUNatna3h9PWG2eIn8A8l91dynheLC8CBhL1HvEIbBAZaiBNz2vT/4yqz1lut8uz+t/+iuYnAtP+6RvwolrCjr2Izwvz8e8d3xRc9/zaM0tI0udWgDoCNmGH92xw3OowfNdgBNaApHI5h1qaPY2iZD6za+gs59m1A1XkjfgWYxQmL+sfBNXMO7JyDlflfjEjImG2enm3SkXM8nERFWLqQR/AjSONLPTY3lghfAm0B37YlR9YjIsngd/SPFO7kUItQ06FyjFPAB1SKJ9SMnS9S/V0rLJQvi+eNSLeeOdVq8Zf+1qTNXWtAig== 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=3E0ymlPSxNH6aH1t6SQyGEJdjjI6yseFWWKhpBgBa7E=; b=iVkszRdbZWAuaG+isRvh9/bagJKi9ZPIPZkpOED1VaDqInvF3dOGhFSh+2oVF1buuDfmi7UA+JwEkjXEyc1u/xoWSngC4OGXw2OOtncmi9Tx+w9QMeXiqB3woDqsVHZaJoZ1untDSx8uQN0O6HLTqGGOUM90IRl/YBvFW8a94JkThSkHIrW5dwQRoN90Wqitv//xv43Zj11fTIWIB3eecxFEe0Qji8mSBHy4KnFhtzTnAnwC+FyhOdISrM3g4CuDCR/2IGF53E6AUEaJOI54kFfjMwf3QMwfZp1BJwTQDOI6xJYybFQsmg5WLs84ZEOrMwIe3hZXREDRRtL15Z0Afw== 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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3E0ymlPSxNH6aH1t6SQyGEJdjjI6yseFWWKhpBgBa7E=; b=qp3Bv0tlF7Sdku1Q3jBUqTyBVWDf8b8+DYF45ffO29nQUSSHQNwrroxg6WhUV+tj3yZEbPJpvcM6XRVS3LNKaU0+Pji4POsMiNGIzY9SU0Fmd7V4qQZHwDjxW4rBKW4y62+TytQGROk/+nXkRhds08/8QcLgcKBFcNuXQBInuqk= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=amd.com; Received: from CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) by CY4PR12MB1541.namprd12.prod.outlook.com (2603:10b6:910:7::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18; Fri, 7 Aug 2020 19:44:54 +0000 Received: from CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b]) by CY4PR12MB1352.namprd12.prod.outlook.com ([fe80::9181:78bf:bf0:702b%5]) with mapi id 15.20.3239.024; Fri, 7 Aug 2020 19:44:54 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io CC: Brijesh Singh , Ard Biesheuvel , Eric Dong , Jordan Justen , Laszlo Ersek , Liming Gao , Michael D Kinney , Ray Ni Subject: [PATCH v14 38/46] OvmfPkg/Sec: Enable cache early to speed up booting Date: Fri, 7 Aug 2020 14:39:23 -0500 Message-ID: <7a15fb273bb19a9cb0ddfef46aad5d91d6d84042.1596829170.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: DM5PR19CA0018.namprd19.prod.outlook.com (2603:10b6:3:151::28) To CY4PR12MB1352.namprd12.prod.outlook.com (2603:10b6:903:3a::13) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from tlendack-t1.amd.com (165.204.77.1) by DM5PR19CA0018.namprd19.prod.outlook.com (2603:10b6:3:151::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.18 via Frontend Transport; Fri, 7 Aug 2020 19:44:53 +0000 X-Mailer: git-send-email 2.27.0 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 0af24061-6dda-4edc-b1c3-08d83b0a5b74 X-MS-TrafficTypeDiagnostic: CY4PR12MB1541: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IzjxNYcC/4ZHCZzz5EkeXmDGGXwnc/bwl/Xk+6ym3KeYZvq8T9XVaAJgFRj/i6x1nXC8UWq794ix2eD0J00yr08eATHFq17YN1eSUPv1DZwAeTX1GIX579TIjGSPHtjKeGRf3LJRf6hmM8q3InnL7gL+ET6bFwc+UnvSUPlU4wOgj2XEtewSMqNF9IUJ2zwXWivdukpobGL/Tbcb9fajfP/nSbWBFA9N12pZ7q33XLwlmQB7UTY8v0dJQYZMHXD4qjFiF98kkYxC0kPr8ObjWPOKzPPW/mr4TKmmzQSnpPCDmunZ4ryjt2RN/nRxVAJlpUcosB4ZoeUfe1hFSZw89B9FkFZ8ck5SoAp0GLCAG8JT1QP6/OXg8kFCdLfLg4/h4xWs3vpkKQki3EFvhtCPqyS2thu4TP2yoW+/OvRQSeUXwxlG7LwB8VGZtFoG+kGHyo7sQfJxANnxXGJaqDM2Gg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR12MB1352.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(136003)(39860400002)(346002)(366004)(376002)(52116002)(7696005)(6486002)(8676002)(83380400001)(186003)(2616005)(16526019)(26005)(36756003)(2906002)(8936002)(956004)(6916009)(4326008)(86362001)(6666004)(54906003)(478600001)(5660300002)(316002)(966005)(66556008)(66476007)(66946007)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: yyzXl5qijsnsOAH0oiTFNwCRM1Tj3mxqPR8ykVad/CX4R/qmSHisjzUia4k5R6avyQKOyWHZ9uT5acY5FhzoDSjvcmcxteBT9Zi77SSrgW4pPFUfx2xcn8l+zyqVCwH91VBq1yZjeCd/FOYA/Ok+VqjVx9rmSF/OiZFNU4Kz64OdLB9MBtyGqmPB9TJ406HGh8CufVgySE6bSkFPPgunWmWyKy9MdvmzjMIejALIWKeBimdz4p8HL/OY+ckkF32Dc3+GQyZ0wV5URP/JjDttFmEX2KRa9/yzMduxmJB8dojrLnpnYtaEqXxbcA21Q5XXWM31pO/h6Kx3rFEhe9mlv3Zsls0CunT8zcoBjvefOIS9bWWh4cJEolvoo9zd+pnwoBoyDYA1n6XYdAOD1U3Eh8I6IC93As2Hw3EPdQUgvAqqtH6WiiHrU22hEPI7BDIms+ZpeIPsEPRcjQs2L6OpgFnaAcd9OtRzlLPZskgJmtvoLbx6CwaNjYGgXunMIURvFDDPUnc0jMmmCH/vTH2Gm+OV6IpOTRnGa1siyECT6CWbypJCoAM78T5apL0LNn/jwJNQj8tC6DpE4ix0FbXJOFDrWcarvlM/Rq8sl+JLTdiLKsQp5odcDHLAinsquFiP2ia2sxoVJo728XykAItsAQ== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0af24061-6dda-4edc-b1c3-08d83b0a5b74 X-MS-Exchange-CrossTenant-AuthSource: CY4PR12MB1352.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2020 19:44:54.4940 (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: R/36PbQdDbnCQT7UhnmG4P6R99rjC5JfpZ7GAJkNpRIpY8WprNmNEZULVX6uQYGNFPSNnH4U7uv2FgMLNlTvdw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1541 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable From: Tom Lendacky BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2198 Currently, the OVMF code relies on the hypervisor to enable the cache support on the processor in order to improve the boot speed. However, with SEV-ES, the hypervisor is not allowed to change the CR0 register to enable caching. Update the OVMF Sec support to enable caching in order to improve the boot speed when running as an SEV-ES guest. Cc: Jordan Justen Cc: Laszlo Ersek Cc: Ard Biesheuvel Reviewed-by: Laszlo Ersek Signed-off-by: Tom Lendacky --- OvmfPkg/Sec/SecMain.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OvmfPkg/Sec/SecMain.c b/OvmfPkg/Sec/SecMain.c index c2a35463dce4..271a06348ed8 100644 --- a/OvmfPkg/Sec/SecMain.c +++ b/OvmfPkg/Sec/SecMain.c @@ -905,6 +905,13 @@ SecCoreStartupWithStack ( // For non SEV-ES guests, just load the IDTR. // AsmWriteIdtr (&IdtDescriptor); + } else { + // + // Under SEV-ES, the hypervisor can't modify CR0 and so can't enable + // caching in order to speed up the boot. Enable caching early for + // an SEV-ES guest. + // + AsmEnableCache (); } =20 DEBUG ((DEBUG_INFO, --=20 2.27.0