From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web11.1675.1580857385855360254 for ; Tue, 04 Feb 2020 15:03:07 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@amdcloud.onmicrosoft.com header.s=selector2-amdcloud-onmicrosoft-com header.b=gDxA5upl; 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=KaJAIw8lVZqVxa0OuavW0tpJy8fKeh5oH0PK9Ow5RALUUf+LOiYS57hpUlkbV8a0+Yo11I7TS3yvQ5ER4dGbOH4yNzcbh5dPBFiL/D9zdSLu29IPjC/vBHinkb8yRcY0WPiut7/7lFMuNhE6m0SZQGrU+Mw2tXOqiztHGQf76txKdLAKfvPaUR4Msi40NCIScX841IZjWL5nFOLKKn7HwRsOuF6Yd5qNes7Jx11+D0PWZmcJhBt4nQNDdrMI0ra+HYsvosuskaQVVdW3/15eqXHVpXHU9LYj1Sok/ek765prc99lXrd4FyQEOVJuWi8LGzI6Z7fHWJzGQkPHccfq0g== 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=EBqaAOzUqEYIHgr995Cv+o63QK54PuMQpSh10UwIK94=; b=WxOCwwkn1OOuYACbRjyvmoXbjzvVziTQnvlCLdytp/V/SuoKoY61GD+Wpusr9iNoN1LrcQ4ZiZUzoHp/bXguDfxl18NR16vZzlwMktv6NbCHMQrfWkYvAvIp5RI37a9NbKjrd2mBk9kyyIPsPYoOQkI6/nARktPLGXPDcnriCgYcGchoX+U0hjpDtsX82avT1SSXVkrOpRb+CLwYDVPKxSg+6qUOKpFesUCx9z5caq91kMz8VaWb8hAHATFDypz+n05YjO7n1YC/e6UPy2sVoE9cxlfBa9yKElddDC4S7rFJzhgNPycv5w82mxS/lQANATc2z+A0Z6VYrZSZKn7Zbw== 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=EBqaAOzUqEYIHgr995Cv+o63QK54PuMQpSh10UwIK94=; b=gDxA5uplSKa+yjq2Ro3MzTWxaHSqWEFBNAUMT/PpUQU4h4JE/jnSswZXrnk66ZeE1IHLyyQMlWk/FqZa3Jo2G02L4UuhlFujeoFozvkJTGCNCiVyTVY0yCofiLSfzYRM3ieQOClvSDJTv3b0Rl8b+Gt38VijZOF0JwjVkJJYibA= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Thomas.Lendacky@amd.com; Received: from DM6PR12MB3163.namprd12.prod.outlook.com (20.179.71.154) by DM6PR12MB3930.namprd12.prod.outlook.com (10.255.174.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.29; Tue, 4 Feb 2020 23:03:06 +0000 Received: from DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270]) by DM6PR12MB3163.namprd12.prod.outlook.com ([fe80::a0cd:463:f444:c270%7]) with mapi id 15.20.2707.020; Tue, 4 Feb 2020 23:03:05 +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 v4 33/40] OvmfPkg/Sec: Enable cache early to speed up booting Date: Tue, 4 Feb 2020 17:01:37 -0600 Message-Id: <7b601b8cf0abc1b71d7a0ccb172e71a39b8b15fa.1580857303.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) To DM6PR12MB3163.namprd12.prod.outlook.com (2603:10b6:5:15e::26) Return-Path: thomas.lendacky@amd.com MIME-Version: 1.0 Received: from tlendack-t1.amd.com (165.204.77.1) by SN6PR16CA0062.namprd16.prod.outlook.com (2603:10b6:805:ca::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2686.32 via Frontend Transport; Tue, 4 Feb 2020 23:02:36 +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: 650c0bd6-76c9-4826-6be3-08d7a9c65411 X-MS-TrafficTypeDiagnostic: DM6PR12MB3930:|DM6PR12MB3930: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-Forefront-PRVS: 03030B9493 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(366004)(376002)(136003)(396003)(346002)(199004)(189003)(4326008)(478600001)(6916009)(81156014)(2616005)(956004)(81166006)(8676002)(966005)(316002)(54906003)(2906002)(6486002)(66476007)(66556008)(52116002)(7696005)(186003)(26005)(16526019)(5660300002)(86362001)(36756003)(66946007)(8936002);DIR:OUT;SFP:1101;SCL:1;SRVR:DM6PR12MB3930;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: 7gXWZ6JrQUbGxlLuoUmy8LpHj81Y2C3Cyx25aCYxh3vAxQBtvkSobdg6LGGqfABVAUOcORj1SOYGIeByN040YAXUYI5PEa5+JEm3Y0BzeZsB35G9FW4gubYpoFo8Y7//IMl5w6hn4YEAIhXrudjPOBHqqv6Cg2LpGghbEDkKSGPP9DAjvbRqBUDNjXOW+DAdjJ1AC6/JaRXXtFDLtHia3EbdOT3i11Wuyr6W7SCpfH3xWueymU7beogKd1pIP7nna8MNjuP1afdSLAMdkCZC4Yn0I4hnEG1mPR5+Wd0GNZx8hXPTFLz/6K25BMdQx/HBgHX13ayCNd2fy5rCojLowotaVB5w4/PAW5Dmqwb8jKPx40My0imWw489TQmwTOMY08rcDHTUY7zhiEy6povzK+3r9VQlxWU85Ht9kPwG8BN8WxY7+x1udyYImzT4h5+yYedTn73ojRGqdAp+UJ1wIV3ajUO8xTWZKkHCKP5x/xiQ3fupgMKGAAecjJ9fFVAWN3O1x99iAueFahZMhOYagw== X-MS-Exchange-AntiSpam-MessageData: /nyaojksb6FXjFpzoOZrm8+PPKfg25w3722oGJ+FSPojPIEIN9kcNg27JBY96aC2/p7MzV6lSbCUds9dq0s5uPVFoyrtWX+s5n6MdkWYIJM/q1E0c1FJhCljpVeTE8pNj32shuwAYEXyHivO2mn9lw== X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 650c0bd6-76c9-4826-6be3-08d7a9c65411 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Feb 2020 23:02:37.7889 (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: oA2XjeRazyK7tFoduOwgCKZWF2ZVIn+AGvl3uKgjVY1JHSd7vnlEV/vQzEzJLrDaRuijOZaB1eL8lXDX78LFNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3930 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 2bab7128ade2..439c8a09be17 100644 --- a/OvmfPkg/Sec/SecMain.c +++ b/OvmfPkg/Sec/SecMain.c @@ -800,6 +800,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