From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (NAM04-CO1-obe.outbound.protection.outlook.com []) by mx.groups.io with SMTP id smtpd.web10.21267.1594737501370482114 for ; Tue, 14 Jul 2020 07:38:22 -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=Kh9ibRnw; 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=I7huv8/fzLf1ghKkg/cY4k7/uJMLBm5HBCaskq58U3jPboEp+nBmNVGl2qJOw3VnjY5xaBQBT/6za/r9jPQ2BxI6uQU64vekL6evBSFI1dTddGs4BFZnwHtsZaI/yQPvTxLR9KSH34kti6UCWY0Kb2ypNb8GcrNk0pMLuKhiJ9i2YbsDOUgSx7kz6MBoQzDF/hThEt8xgpg1d6vRqx5F4RCfBKw4noW/lE2erYowEI+SWZYUqTYhp0ArUBYQP6bynyRfYoE2ZZO+dxgXfxjNyo+aOU30ivHmmJ4YnCNuZFKMlz9hEQl1/i6u5k4UHGa9Wp1mrc6NwQfHlsX5O8TiBA== 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=VCTqQRVsUHmvrzRW1qbExUMUO+qodKIJEjiiJWqoDo6BC4ETRnV/t/tDT357Mm85WD/LiDcAro05/EIpuY1Pt14pP5OFd5vsU/sn3Auu/0SYxZCrr8JCOrYONQ+MlzbQaQUmtIz7NdzFnxnvWoG9M3miTFS1G87HI9yMKlhEVagxn+BUGjDew665q1y5fIO66SK7I8qEAIwauj5YPOV0II+zEw5fCw1EZjgiqe55BEI0JumRmIrOv7rF5J6OwjjHkBu8c1ESq8RjWLG3sPtYUQRxi7L4YsPpgCOtWK8djcwIrnG063yWvFGGM1xmmYEt20kvwfraw8ATA9XtvTPsMA== 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=Kh9ibRnw/vKJtk92P0oorsX0JAbFBx2nYgGU1ZaOARzJJ1HspdUYHPypyZrrzMlbgVOM/OzG8/r1LZHX46pDrGa0+czmkEVYv/9xmlI7dQ2yvdoszGzjGaveqzUIlNBnYWS9m2FkVSt8asZRQe8iTMb0uDHh5Q3jCUZv9wyp/ng= 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 DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) by DM6PR12MB4219.namprd12.prod.outlook.com (2603:10b6:5:217::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17; Tue, 14 Jul 2020 14:38:21 +0000 Received: from DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0]) by DM5PR12MB1355.namprd12.prod.outlook.com ([fe80::25ec:e6ba:197c:4eb0%8]) with mapi id 15.20.3174.026; Tue, 14 Jul 2020 14:38:21 +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 v10 38/46] OvmfPkg/Sec: Enable cache early to speed up booting Date: Tue, 14 Jul 2020 09:37:45 -0500 Message-ID: <28caffee502a6f98eface77131ef6db91afb7896.1594736896.git.thomas.lendacky@amd.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-ClientProxiedBy: DM5PR20CA0032.namprd20.prod.outlook.com (2603:10b6:3:13d::18) To DM5PR12MB1355.namprd12.prod.outlook.com (2603:10b6:3:6e::7) 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 DM5PR20CA0032.namprd20.prod.outlook.com (2603:10b6:3:13d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Tue, 14 Jul 2020 14:38:20 +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: 2496a382-0c23-4849-dac0-08d828038e13 X-MS-TrafficTypeDiagnostic: DM6PR12MB4219: 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: C1y5siMLm1WEcXli2K2yGrQKS8fIW8rB2N8CsRveKHCjzW1ks/d0v85P79i/wbQ2oHjQusj/C6QNBuVkoGCPRtyJ70YASxLiyW4wr6O0qkKLOJxvqyzggZx1DP4yrOb1Y990XbYFycyUZwchlCUzvHzOIz4giIaZHjxjuycwuNtHjwg/1iL4e0nNlKadAzQ8AuUiD9VgfA1AygVBIcK6qZlqD5282xIN96jOwRUTWP6poYHWmjegbjP+8zR42Um8qdtG1SXK/2KUXiZpt2G6FoYQNfO8sC0NtlusCBT5s6tWGJPF9CHLG32TjCpdmDURDjxAlVe+s+76K1XxY12IPX+65NFT21RGNXvuedZej1xqsDU89MjcOiKfwHG34C3qe8z4ynrlK8pSQe9uM5+Ryn+PuEm2S1kr05Dy8k1DLeYAfsOnwOVO3pPCYU0Y4UoJRys6aorvmGoJpYEUxy/6SA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR12MB1355.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(346002)(136003)(39860400002)(366004)(376002)(396003)(4326008)(316002)(66476007)(2616005)(6916009)(36756003)(2906002)(66556008)(66946007)(54906003)(52116002)(7696005)(6486002)(956004)(8676002)(86362001)(5660300002)(6666004)(186003)(966005)(16526019)(26005)(83380400001)(478600001)(8936002)(136400200001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 9K7CODd9efV2a87iqj5hkqI+tbItIWWoJiQvuCi9frhItvF5rKdJzqE4MqZjZYqj+Mqzr9WHEF44Veaq+wcwe/fGQ0czKMMEc+tG4LbOwYYfTZOIx6T1oIDJM6tLO/9OHNK3fnPP6DWVE2HAQNfh53/yB5a0RB5WCggQhwzRlG1nK0Fc/SWMv7vnXK0y98PsZSldHxX88fTq/TuQsOwX4CMZPEcnjaADjDW9+gF8xbebjtUxburM/AlU1B1ST4JJ3h6Ccbb0ds/zMiG+XTu58gujQgK3WYbVjwYrAm1Hh7HHtFdyalOa5sSHItwThX9H6ER5tbRXShBj/2sLMtw4RKg0g2BIhJL64uHs/tapXHU+zAu06CXwSpNLQJSJvMENpdh/Qwv7MBIutuKqKKo+S75Qgih08oAs2rUM/wUjpFo5O79VU7aBvduCf3Wy1XTPO3Q6jg2G8V1Kq5/Gf5B4R1baHV/jP/hHq+pyd2/W6+o= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2496a382-0c23-4849-dac0-08d828038e13 X-MS-Exchange-CrossTenant-AuthSource: DM5PR12MB1355.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Jul 2020 14:38:20.9022 (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: uFcxzPkOp5nQ/eqzKD8CTRyQjL6zjJ4EU7Jbzdvc/MA9KUP9vyoPjIYbKajpU9rMtUtDBErJpdYfXb027KeTSw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4219 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