From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web12.670.1583190509745452410 for ; Mon, 02 Mar 2020 15:08:30 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=Rzb6rdRS; spf=none, err=SPF record not found (domain: amd.com, ip: , mailfrom: thomas.lendacky@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M3Lyf0pKVzcAUUbX8Lll2kdUHkvWER+rQ/v52A+yYf6feOhUgKApuz45zUNo529C7AJ+PEeWJ/zFn2+HYPw0i2QH5Nu8g8eukkmTrghxMzjYIM4Cd6nSNTakktxbNNMoeDZy8ilXSdL4Vhl+3Xfml4x9zxWj/PeVfrv7Z0i/5z2ji0YlhgdcmXZr+9aBQQ2/FD2u+TFDHzSnlS4MozxWO0B202+Lfav8mObZCnLA0tBmdCSQydk5E4D/TdAEcZ9JMSC1N8Fv92zQE48RiSUk7Yvj/PHpzvK3+1btLZbG6PeB/9bAQ6tb0Yex9hDxzpF1AsVhSw96sfxRSk3siCXZJA== 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=fvyVcbfYiLfGGFd5Zr49AebX7e60I30oi9uoo3lhfcI=; b=gMMBi1QaVB4hSnwktpWCkTev3I40Mjw0yMNG+8FPkwGv+Cqp3XXtUxZmnkV75gtHsez3UVTVSciedbD1kF79Fg6WSCYSA5qY23DVzrgB15qrAhuwgkWNRlo3s+a/2DbMcZWf1VWxHokmsa0wK2rteQIRgYmLCUeZxuBDhKUL4g9DwTooQ2Zy6JadlNsyK9VzKsmN8VUdU7xV7vHRPyNLdnrhIwOLMmgiEe/6PRGUUOCvkml0RDeW/exEjo4TZLGYu6btD6mROmNqS79xOluCZY5nZoEEBMzsJ2fRGQDkBdpm63q1Srr4Pw7LLO9mwg4Y8NES5/sSiLRXWkbvpVfQyw== 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=fvyVcbfYiLfGGFd5Zr49AebX7e60I30oi9uoo3lhfcI=; b=Rzb6rdRS0WZvURnQWS381Q/NxGjWNbcns8WC1R1mwvGdGuI8/VwFd7Ei+m27qLld1vYFlrjyTeg10WVpFV8+n0vgbOX5P5cC4ku5dJVjJeQIkBs/Q53eCostbegJN1DmMwkdL5o++EsIDOirwuf1S14+sS7R7/TxygGRdf0/s/s= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) by DM6PR12MB4201.namprd12.prod.outlook.com (2603:10b6:5:216::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.18; Mon, 2 Mar 2020 23:08:28 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::f0f9:a88f:f840:2733%7]) with mapi id 15.20.2772.019; Mon, 2 Mar 2020 23:08:28 +0000 From: "Lendacky, Thomas" To: devel@edk2.groups.io Cc: Jordan Justen , Laszlo Ersek , Ard Biesheuvel , Michael D Kinney , Liming Gao , Eric Dong , Ray Ni , Brijesh Singh Subject: [PATCH v5 35/42] OvmfPkg/Sec: Enable cache early to speed up booting Date: Mon, 2 Mar 2020 17:07:06 -0600 Message-Id: <3c4a6ccf94aa45d477e3d6a4c881298f22a803ca.1583190432.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: DM5PR2001CA0013.namprd20.prod.outlook.com (2603:10b6:4:16::23) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) 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 DM5PR2001CA0013.namprd20.prod.outlook.com (2603:10b6:4:16::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2772.16 via Frontend Transport; Mon, 2 Mar 2020 23:08:00 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [165.204.77.1] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e8c95ae0-6405-448e-ed92-08d7befe8df4 X-MS-TrafficTypeDiagnostic: DM6PR12MB4201:|DM6PR12MB4201: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 033054F29A X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(376002)(366004)(136003)(346002)(396003)(39860400002)(199004)(189003)(66946007)(8936002)(54906003)(316002)(81156014)(81166006)(6486002)(6916009)(66556008)(8676002)(4326008)(66476007)(52116002)(7696005)(2616005)(5660300002)(2906002)(36756003)(186003)(966005)(86362001)(478600001)(16526019)(26005)(956004);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB4201;H:DM6PR12MB3163.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H5E6InogwJPGJZD0XKpJ37NpU8WQ1FsDjSIjiQk0pX0EpnDyRcyFz31TfSPhgCIt2cC3aK7Hn3BHTATeFlgTCUa4fHBqJMgoLaMg25yZBwp3JI3rhnIK13JlqH6LpojNBNJQOJM5A5KyoAF6yrYSjqeByD9B11Fcu+2yj2dj5aWFiMfhug0kiQ4pG1PD0j25r+v9H4mHLneAcTtamFQZWSkyPJ3J4FlsudUZcR1BFPf8teLWOfkVWM89lstnUITdiLV9f4SXy0iUNL+uwjYjDbOxh9M8XBknfvZx6imHqN8FBKKVIC35xIBdBRZJiJ2ylsBs5Bc6h/HGtbfOIqpcrR4CpVkFCGoxe+TncqDSzpQ7zstLC+EDv7J0AVFuW5r8kFgX4QD0l6UZ68eJjhGE74gwq0Frn6ir7XCchPUL7+VWAHsEL4Cpz4HVnRl9HyuxL9SYLxDm/EfVj7fQot2fS/UmqofvKrr6A6QSWA0yNU5NNGSzhFpVwGB0z1Q8hDHsvhKfjjKM5Rc2GMFWC7Jdlg== X-MS-Exchange-AntiSpam-MessageData: QoCbfqMtdV0HO5/e7L3bCHzliT6OshUSDTl8y2WeDy90FeDHNpVK+3vt581DD0ziIiaNMKy8fb2s0yntd380sLfBvRdVliPYZXNv2ZrxW14tbKjeSA3Yp6J4s67CZ1es07sqoldxhYSO4VWvbLy47A== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e8c95ae0-6405-448e-ed92-08d7befe8df4 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2020 23:08:01.1292 (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: m05WkXhIbsi2cVx95M4a8ckExbQPgMJ+0Gqxnb2FflrXiGRXggILKkdPiVOtF6+pnOrrpaffKnJ+pcn36cISvQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4201 Content-Type: text/plain BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2198 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 577596a949f9..2aeb24d8e3ee 100644 --- a/OvmfPkg/Sec/SecMain.c +++ b/OvmfPkg/Sec/SecMain.c @@ -875,6 +875,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 (); } DEBUG ((EFI_D_INFO, -- 2.17.1