From patchwork Tue Mar 26 17:33:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13604776 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2064.outbound.protection.outlook.com [40.107.94.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6D100A95B for ; Tue, 26 Mar 2024 17:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.64 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474459; cv=fail; b=sNVE+Hjy0UxEbLhfXHER2ce/ENTtB1HXt97O0Ec1ON/9TZ3UXJqVE3R4REwWYKSPYcb6yxhHiB9OEKMPaviVP4SvqrSI4jZubeFBtmkNZbWFS1c/HftrXQyEenJBw0pCF+6BRqqeIaXMZT38fkR5yeGiHP+ffQ5hrDeZpdF1YIs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474459; c=relaxed/simple; bh=TRdKKg7iopiyugY7lkvGAzP7qbcifFAUi0k3Fxw3+CA=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=EUdpyiW/CNktOmkoOUpx+VFiaygqhawff7QdwCLN84SSwA819jlOMZ94FCARRrF+N6n/3SYgL/X3zg5i0iYK+PJYOMPcS0dL5TrzqotBqJDN42pWE+Zfmx44OO8QNoctWL4YbEGZIulqY9gGzvTP6OkoG5s7oiICaPRmrRNhLHI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=njmbpijJ; arc=fail smtp.client-ip=40.107.94.64 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="njmbpijJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d5fn6OT66e8hoCiU2taOa0Sraoy6vnkxsaE9bHNySLGZHx9I8YBQaQDmS9YkH99nN5knRTqVl0Bt+HoRjCNM3XDzYcp9KzWqAtDyDiWRbzSk5T9whUg/1sTSWgTwyqtVGGIKazBvREAPyws6E+oZJRiEqHfr9On1B+MUpmvvNnTWKDkw2AIUc4Go3FEom/mwDEt8xDuSOlq7qd03vH8ffU2SxSaEb/7zbh7yThk0Zdq0jot/ReMZZWwgjyu/iVXFcmFoq8eywEk1d54UTrLAgXy1BDjDZnRdEgdF+antWGsHt0B36xiKDhsi2+00i66ZUAbTrK4CnvSIyTP/4Rh+ig== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GWOzrl1wYZNAxQWu6gXQ2Q9al7igmUvtZmcci55qYiE=; b=JIuHk9XXJrVW2t22jdsDAHh4ZFBUploGNkFH6BiENUzdYunipUhHygDPedwaPHX3ZVbb6yVbX2H7E0Ff5bSu6ESnnCIg3t9eyKpHy+KTxXZuld6SGcwcyBK2UU2X4x/smSIWiXQymfz4M5HmZuG5vFfxb7RaGzqHfPQY2NymiR/Str7lR23RsiDTSGjE5Ph84C9YGyV3avUwdNnFa6rJOdpTbCkobTJoU3VSkmItg5I36uR0dDN4JfUH7sEWNIMzD820TPYj2TC7i9hN4lvYInsD9P6NpAWBP/FR3sM8lhrqUskQIowoCy0R8M0wWnW6GvSNtLkghewFFgQ9a6/iLQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GWOzrl1wYZNAxQWu6gXQ2Q9al7igmUvtZmcci55qYiE=; b=njmbpijJHu96dd5KX3Ft3xheKy6GBqfjtHrpiJGSjP3y/Fn4vdqsUimUwI34d7WSPnS5GU1Bb0HFQrNJp8OD6sAs7LZS8CFcQtqray42XsDpKveAYxcbxRfLWdzLw0HjKi8T0iAl+TMEK3zfhqWU8rbAfWLkQ0WtnTwfArqpJf8= Received: from BY5PR17CA0004.namprd17.prod.outlook.com (2603:10b6:a03:1b8::17) by PH7PR12MB6719.namprd12.prod.outlook.com (2603:10b6:510:1b2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Tue, 26 Mar 2024 17:34:15 +0000 Received: from CY4PEPF0000E9D9.namprd05.prod.outlook.com (2603:10b6:a03:1b8:cafe::27) by BY5PR17CA0004.outlook.office365.com (2603:10b6:a03:1b8::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:34:15 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D9.mail.protection.outlook.com (10.167.241.77) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:34:14 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 26 Mar 2024 12:34:14 -0500 From: Pavan Kumar Paluri To: CC: , , , , Subject: [kvm-unit-tests PATCH v2 1/4] x86 EFI: Bypass call to fdt_check_header() Date: Tue, 26 Mar 2024 12:33:57 -0500 Message-ID: <20240326173400.773733-1-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D9:EE_|PH7PR12MB6719:EE_ X-MS-Office365-Filtering-Correlation-Id: 94a90b81-f635-4df8-8c1a-08dc4dbaf51b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pNvuRvTVXRiY4KMAa73Tjekwbv+YKgPr1OTmmG2B+0zpsMB4RZJ/pfemcvofH81bg8VrI3a6PmOBadD4GxX9qPd/9RZq5nwfBiJjrdredMwSGMo90npdloo/lbFqEWj9FTX5OMABFZteF1VywPY/ahRTT62oYf0bJDKaONhk3aSCNLn4MJbj8zGn8YMuWysJ/m2fObbVWapkRaibn7zK764gydgO+gB4UhsEizTTXAiNhX4Rudidj7YJUGBaWIzmw5tUqf64+xlPxWd7jx6It3miC7F49qnG83cc1xveLn8W/EwwmBJ/jPxcEVKg68IW7SWVy1Er/mzuFTv7ZA661T3c2MxSOZJzDiW53LejsyP7OKZtqjBznZLk3KPYyzBLtHi+BEQw//Ve48vnYYFZCE6X9nxtAl1zYju217m4DUUc9Vq5JogazkgiC9k7vLKyeMc0WT79nLJuoPKEET/CKV4/xNhkGO6PGTKrOPUvlRV1kLIYCQ82wuiAYth/CNJH1Q2UtX+cexN2Yy8JxE/V+wCHFLHOOZz3puS9yTEqjOGJtvORlx4xB/Jffe1L943SM9IP5mPQCkqT/q0EqPjYGuCy0lpJfvQ4+mzae7sK6tvUKkVCEaSnRWo0VSLREXEiWRkCEzQg2tjHw4kOfDG4irBegei59a+VIvmADQ23Vm/d8rMLkRYj9DsURV4M0YmibkKgKrnsY666ZpOgEtB+KDxfZE30fEipWwboi5/6hNB1Cwv+ZSmamp9RLAW47R3l X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(82310400014)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:34:14.9684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 94a90b81-f635-4df8-8c1a-08dc4dbaf51b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D9.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6719 Issuing a call to fdt_check_header() prevents running any of x86 UEFI enabled tests. Bypass this call for x86 and also calls to efi_load_image(), efi_grow_buffer(), efi_get_var() in order to enable UEFI supported tests for KUT x86 arch. Fixes: 9632ce446b8f ("arm64: efi: Improve device tree discovery") Signed-off-by: Pavan Kumar Paluri Reviewed-by: Andrew Jones --- lib/efi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/efi.c b/lib/efi.c index 5314eaa81e66..8a74a22834a4 100644 --- a/lib/efi.c +++ b/lib/efi.c @@ -204,6 +204,7 @@ static char *efi_convert_cmdline(struct efi_loaded_image_64 *image, int *cmd_lin return (char *)cmdline_addr; } +#if defined(__aarch64__) || defined(__riscv) /* * Open the file and read it into a buffer. */ @@ -330,6 +331,12 @@ static void *efi_get_fdt(efi_handle_t handle, struct efi_loaded_image_64 *image) return fdt_check_header(fdt) == 0 ? fdt : NULL; } +#else +static void *efi_get_fdt(efi_handle_t handle, struct efi_loaded_image_64 *image) +{ + return NULL; +} +#endif static const struct { struct efi_vendor_dev_path vendor; From patchwork Tue Mar 26 17:33:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13604777 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C5F91CD2E for ; Tue, 26 Mar 2024 17:34:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474475; cv=fail; b=VKka179ca5DpZl/0uGBEvJi2m7ySX0tvJCiPo69Ci9GNurxpH6dCsUsPYciUTaKdR8GdSslkQXaanUWGyFINXlKHG8VEkchnJl05VQFjK8uhdfLqiShCNKZo+nonplqJ33Gs5dTsjdpqImKdc0PHTrI6guQfvnUIGTp8o24ZnuI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474475; c=relaxed/simple; bh=yhg/rTTLMhdYh/WMT3Am/PSnoRo2f1nDqWREEu0fhfU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ML6Vr/p2D1x+9S/78Jm57burmw26OtHKF29it6UFznquuzKBGJjYQF9CZNHH0AfeQm2zrSXMdHjX2rdZWBTOcKn5kNLqHx0lYtrouJQYlqZBIhmAfy/AYyU4XuUh7DvEksTlca/ZSaBHi9wYexo1QjqpkqazZ/ojNeGy6L2SEoA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=CjWQwjTE; arc=fail smtp.client-ip=40.107.220.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="CjWQwjTE" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OXgS5m4cwwa8rdXqKjlu/bZZptsExFVJxyIVb9sZ6s6nv1TQglntFvBMyFQu71bpIoa6s5OR+1kxMZbA8Ptlcr/oIL7wzWpzP0+e9AqoM4tMsLlxnVj1mf0nrWBJ5dstAS2HQcDW7kU4ObI2fMkinCzask/o4izNS0sjCLBRSc+dQWXSxMfqQVwxdPdE7UvJd9h5+/qcfu9TdGhIgsn16Sb16/Xkc5Yobn/XgfsoxHnFaZdVIL+ZKAmEpjZmQOSawwSICQp83TZseLHq7EFzBhaGFAvWGGTC03NYmGMPq+Iq0f8xc8e42BimchfYJ4WwnVx9HVI/XiYhzMvhj+E1oQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RhZZQM9uqiYCGqWzmQjNWxiYb4QXlovvvrDe+pkpRYw=; b=lOkUK2Se6JZBwycgCQficuqQXxr13oUsHyDs7bBrhS8PcFF+weCE12em/zmlDZBbRKhl31mADT66PyWf1yE8O8PelRTdxJEFVfMUalOzRBhSG49GphGzMVIwFg4x9zGsOc8ksw7TMPA0Z9vODv1N0XuGCkJx0TEgpNsRcu2cnEWzztLPPfu27Tr+vLL56ZvwbddhIWocF7/UhFx2qpnewi6C6t5Z/WS1hIOhm3xzp9DpIa58G4D6OjYhv0hEudPv/M+DAnBiMffd2cSTFSAKtHg8AvNvpjzSMhBeW3Qm39q+OSE+vU/2W1DLdI0l7MxYN28yL+c9VLsqPIYnq6Gnxw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RhZZQM9uqiYCGqWzmQjNWxiYb4QXlovvvrDe+pkpRYw=; b=CjWQwjTEGuUTveVNKSQ6JoHw2751jfJ4ffXFL6hWV+CTFv55bBCAZLM8QngVIhwwkcliLitUbXgFFJBb6K9vACFsmVm0MHL5sUalRrHwt/Y/tcN9/26w+TPWXfkrz33jriYh9j6RjpzMs0w94Dm1tOtINLAvaJFK3MrsmWXVxt8= Received: from BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) by CH2PR12MB4213.namprd12.prod.outlook.com (2603:10b6:610:a4::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Tue, 26 Mar 2024 17:34:26 +0000 Received: from CY4PEPF0000E9DA.namprd05.prod.outlook.com (2603:10b6:a02:80:cafe::1a) by BYAPR01CA0004.outlook.office365.com (2603:10b6:a02:80::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:34:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9DA.mail.protection.outlook.com (10.167.241.79) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:34:25 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 26 Mar 2024 12:34:24 -0500 From: Pavan Kumar Paluri To: CC: , , , , Subject: [kvm-unit-tests PATCH v2 2/4] x86/efi: Retry call to efi exit boot services Date: Tue, 26 Mar 2024 12:33:58 -0500 Message-ID: <20240326173400.773733-2-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326173400.773733-1-papaluri@amd.com> References: <20240326173400.773733-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DA:EE_|CH2PR12MB4213:EE_ X-MS-Office365-Filtering-Correlation-Id: 81f5521e-1467-430a-6850-08dc4dbafb5b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0WD/KuTVha5Y78pqlU5/3pG5IPzoz0y9HjNNjcs1IvrJNlrl9zUSr5L1mXTCq2A31Ieif+Q2VtrJLRG5UGHb/Xbbo6C6wcWpx26uJgEdkTik5ctOy7gazx+uTb9j9SpIQcLeUDCCrbZ3OY3zO+ok8U4h7lnb6RYrBDOZXvGewq4irJn/IaIv7aigFPdNWdSwHpv+kYWk2c2TjxvMZFe27pgQ2SlUa9IeKNc8VFpwElG8LnuEVmfDAqa17jaHEGSq9dklmWT1kOa6b+VeoTl87sv1zobTA6FaysI32lcx2xVhyJi6ruPJRDVhrXx+n2UtZQtFEU+nzf78GTuHn1FUo65BfhoAk/R7BcMAhaT9rAF4upwlnZIdTBnQHvd7iX66qnIRMfV3lrOmy76CP9SnWY3jPiujIQnADH0MJxuOYjLwf3GHsa9Y2JGx7TM1IsCvImNW9+n2CDO6PUo8hs/k5UU2E2Bw35seVfb9rfDqQik666en5ajSj9gy32zAp/2F7xctYlVz1ajFkQ1ObTf9jDOC/QXl6A4k4DWHQZ6t5gQnT2Y2CdR20nGM6qsVfZhPGAKHq2orAnHsIpTksnpwUtIyb/E9gkgsDYUj2Ne0aJN/1B0Z54UC1LxzWriXrcQmja0uuQU163E6t+RTbKgiLN0gJp0VTRCESgG5dkzgdbkRNyVSCT553HnOuqdqf2ZqpYdK9ZRneT68hSisjwH7ylSkzu3SNg9D7Fo/ufNE7fdZ5q0//kBKNrUjRcAHdL4c X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(376005)(82310400014)(36860700004)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:34:25.5157 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 81f5521e-1467-430a-6850-08dc4dbafb5b X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9DA.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4213 In some cases, KUT guest might fail to exit boot services due to a possible memory map update that might have taken place between efi_get_memory_map() and efi_exit_boot_services() calls. As per UEFI spec 2.10 (Section 7.4.6 EFI_BOOT_SERVICES.ExitBootServices()), we need to keep trying to update the memory map and calls to exit boot services as long as case status is EFI_INVALID_PARAMETER. Signed-off-by: Pavan Kumar Paluri --- lib/efi.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/efi.c b/lib/efi.c index 8a74a22834a4..c98bc5c0a022 100644 --- a/lib/efi.c +++ b/lib/efi.c @@ -461,16 +461,35 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab) } #endif - /* + /* * Exit EFI boot services, let kvm-unit-tests take full control of the * guest */ status = efi_exit_boot_services(handle, &efi_bootinfo.mem_map); - if (status != EFI_SUCCESS) { + if (status != EFI_SUCCESS && status != EFI_INVALID_PARAMETER) { printf("Failed to exit boot services\n"); goto efi_main_error; } + /* + * There is a possibility that memory map might have changed + * between efi_get_memory_map() and efi_exit_boot_services in + * which case status is EFI_INVALID_PARAMETER. As per UEFI spec + * 2.10, we need to get the updated memory map and keep trying + * until status is not EFI_INVALID_PARAMETER. + */ + while (status == EFI_INVALID_PARAMETER) { + efi_get_memory_map(&efi_bootinfo.mem_map); + + status = efi_exit_boot_services(handle, + &efi_bootinfo.mem_map); + if (status != EFI_SUCCESS && + status != EFI_INVALID_PARAMETER) { + printf("Failed to exit boot services\n"); + goto efi_main_error; + } + } + /* Set up arch-specific resources */ status = setup_efi(&efi_bootinfo); if (status != EFI_SUCCESS) { From patchwork Tue Mar 26 17:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13604778 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2042.outbound.protection.outlook.com [40.107.243.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 282651F94D for ; Tue, 26 Mar 2024 17:34:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.42 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474481; cv=fail; b=vBkyAVUkR8Qf6r8GKSavB8v8R/VErbaJxEDsP2cCj1TwVqxf9oc5B7f4UXEJbqHvgpQBOzdq2UQfu605wOEzgzPJCFwlU2muCpoTfbZtwj5I48tGvrM+FyFYZ4ZKOglW0efvgPwHgOrl6+3PLBfY2Z6WShsyxeB1QQpjJd53QXU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474481; c=relaxed/simple; bh=foaezEub8w3w4KRjUpDjY3MwvtuJonm19FbkVaFMylk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JrRA5nNXrRS/Vt77mzTXSwgTBJgxbDaYuFAdaaNz7c/1KqyVvej0rwNJGcDS5ucn7TXndRYzXSXLnb8rb7F0FA2uYB3bPCFphTZe/PyvYtbOT9IibMvEWryi6by3FQ1Hj4aJD1zY68J5uhginiv15ZEJMrXHcrIp+3lAwyQlTAs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=DXO4Z20K; arc=fail smtp.client-ip=40.107.243.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="DXO4Z20K" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Zdc0aYakoX5kTQ0OYzr2DzzNuhKv3vu+2I02J4fyDnR8EUIgMODXuyPx2YhFWOIBrvEXg27hQGjRvYl9HdRXHmtfX8dBih20DvjmmqroTjUgv7myJDrF9cCcPKHXkrvS2Lg8ySJpPjJwDXuPbj60c3C/H8JjqQnfSuMIHfaH2hyL4IIa72au/2G20HLlPgQOCTZU1y7zpQ+8rtqErNiv9zGUKzWApO9o9nTECnXwSmzo9Q5R736XBB7RUWr/OuFR3rPCixOtNEtPNjQR3N8x8QrDckCUxeI1UHgf6/aagRgiIiJ8+0Nk59eLVMBGX9oJcTYsbpXrW0VbvryzjksSAw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OnlPEo1cI5ksYjx05NMY6ADOjb6SbbZErbEm1jgDg98=; b=MTujc3LuET41mJ1V02JvtO1CJynqJ7ajU3MqorXm9+xin/rNF6znkCfYQlwDAoClqxvAFYkRXj6vUSJXbSIeXBM0gG2riH4N6hEypPYoMvvKGrd80Xix9uYl3vor3xgKSX3p5thseM7juxsCKYQrIM9yKcqwpiR4FdNLXGMvtRsQwcwE6EXD9Whuk48O4w1tnzx+wIkpSPilWQI+g0ZvYM53AiaSv/n+pNOBzQo0SK+Vw1VYO/udeU+nakk0CvxVd6nWAklmzITPCUUCgigwja1Osofo7F+8CG3OV5OW3LFW2zxQ2DqcpV+uT5CqDZ69okIbCZwO+Bh93E1TR9laAg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OnlPEo1cI5ksYjx05NMY6ADOjb6SbbZErbEm1jgDg98=; b=DXO4Z20KA0aeKZnD2s9XGYZxtfymd6fwTQfiskaev04EHUKZtuXz/9GN9i4EcrdQOKTntrp845/5drLz0Me81Pa49FPdh6+zwpNElTz1dsWNnP3n+2Ux1nJ6o7hdWDce8/g9rMteMsrhB1AnZEJI5wuH6vbFR8s5XRIHbuUfR0E= Received: from PH8PR22CA0021.namprd22.prod.outlook.com (2603:10b6:510:2d1::7) by MW4PR12MB7192.namprd12.prod.outlook.com (2603:10b6:303:22a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:34:36 +0000 Received: from CY4PEPF0000E9D8.namprd05.prod.outlook.com (2603:10b6:510:2d1:cafe::d1) by PH8PR22CA0021.outlook.office365.com (2603:10b6:510:2d1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:34:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9D8.mail.protection.outlook.com (10.167.241.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:34:36 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 26 Mar 2024 12:34:35 -0500 From: Pavan Kumar Paluri To: CC: , , , , Subject: [kvm-unit-tests PATCH v2 3/4] x86 AMD SEV-ES: Set GHCB page attributes for a new page table Date: Tue, 26 Mar 2024 12:33:59 -0500 Message-ID: <20240326173400.773733-3-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326173400.773733-1-papaluri@amd.com> References: <20240326173400.773733-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9D8:EE_|MW4PR12MB7192:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bed8a46-eaa5-4449-bab2-08dc4dbb01ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ybVkYR0SrAQ4SwO6gX1L6WjUoienGIIRJJB8M0lQnxOxGZFKVX2140NSo/Z+SEkFLkOHI0nKYbvf0ghOk0gyWn7btpBQzYqVHYn84AiVhYJjtt1JgSNkleLcscADHCmJ/rml6JW6GIoY220eOccMcMA5YvxRdLLFhPyMaxziQPONxxDiV8pl8B6SnoC1WRtC0gNsgofXDk2IlsFvMfv6XasJtPknyvdU7qoWPuMrUGAy7gWV5lMwsow37R9RXOdMoS+PvzULFPdcP6URVddXErfa1eav0xFU9eiRpzZdnG2E5tQ8iknFfh7IGgvNbDb/eoHOzaVQ3s8o2vuEiXhkFEIPSROpTi2So1MKWLLywrp5vTefhO3OzIfloYEsoGbqrzCsuaSNSPBUk3H7ifP/I0oGcN1aIWkrMNn7pqYTnQSvIV+5JCfmbTXdq77wuGaqGsxNRrSy0vrEnVoF4v2uCTjKgPkpeyBv5+SNbSCU2fqhTjEPZA2d3gk7xMpKGnRfsRgwZERcKcAiCWbKx2UfoHFWWqcxJvfKQsr/DUvDFesf1VSnGZ9bff1s/ujAuyHqe8d5kMTYBoVP/JXhyMRyOzp5VUaWTKqB3ZtepPWRk2E/HKw0hkTRFURyi/r60iVebxpcuVZSTk215lwkLQ1DDfZ3WpeehFMNPSKBIIq+/GV7bGkYdBBAZXmWF/QwOP5B1DlJWoCQvXdWfHJLS0ptYFhqw2Af21Sh6vGFmSWwmw4EC3IGTD96k2QTtbCt1F7W X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(82310400014)(36860700004)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:34:36.3222 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bed8a46-eaa5-4449-bab2-08dc4dbb01ce X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9D8.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7192 SEV-ES/SNP guest uses GHCB page to communicate with the host. Such a page should remain unencrypted (its c-bit should be unset). Therefore, call setup_ghcb_pte() in the path of setup_vm() to make sure c-bit of GHCB's pte is unset, for a new page table that will be setup as a part of page allocation for SEV-ES/SNP tests later on. Signed-off-by: Pavan Kumar Paluri --- lib/x86/vm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/x86/vm.c b/lib/x86/vm.c index 90f73fbb2dfd..ce2063aee75d 100644 --- a/lib/x86/vm.c +++ b/lib/x86/vm.c @@ -3,6 +3,7 @@ #include "vmalloc.h" #include "alloc_page.h" #include "smp.h" +#include "amd_sev.h" static pteval_t pte_opt_mask; @@ -197,6 +198,11 @@ void *setup_mmu(phys_addr_t end_of_memory, void *opt_mask) init_alloc_vpage((void*)(3ul << 30)); #endif +#ifdef CONFIG_EFI + if (amd_sev_es_enabled()) + setup_ghcb_pte(cr3); +#endif + write_cr3(virt_to_phys(cr3)); #ifndef __x86_64__ write_cr4(X86_CR4_PSE); From patchwork Tue Mar 26 17:34:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13604779 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2047.outbound.protection.outlook.com [40.107.237.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D094C1CD32 for ; Tue, 26 Mar 2024 17:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.47 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474498; cv=fail; b=q6cRrBNedJjoxc+HDU0rX3ubbjYZq3s6A2VKLHLhJ0/emznhgXnWvEhVt4mwNqZIYreJ7vf6PYXmjpjK489bm6UQvu48YJw1k6kulyg2KhwZVF9kcKu4rC1/Fzz5VRiGxgL5KuH6ExUtzhb4Chd79Oqj9jSvGdK+C65h6wy6EzY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711474498; c=relaxed/simple; bh=FoilVzfWr4MAehofgksYR0krpj8svqHfS8SNRCVDmnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=JvBCR18ZzsLgMOKwFd9BkWUOlp57JzJZSbjk4it/wDhcqUETdrpIp90dYi+UjxGJ/5w6bu+AEUXU/n+NN9zHgdCZJbiXl2nQ2sFxO5ByKyIvS8xN8DA8fIGCmBKvLnnx8RHvpvi3IuoAq4QrmC8GBqZnxYv3RG45Ka+F27yyd8g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=TUrTeuFL; arc=fail smtp.client-ip=40.107.237.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TUrTeuFL" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D/1kAZjDUvvUi3hE8cFgODa1jLW9ukP7/Hq6nPC3ilEPFoL4tNfCmnUzocAxrXgizrdVD97cZfZFc+pCVQVZr7QFTnYACHpBYCRz9Qye71LsGHfh2iJ4MpOl8nKeNT58VduZtQfNYAWb3d8E4fmh/xsWOR2HThK3T8N8ivt6dImPbAtQlMBfVWyORPGheGBrMyIxHu0SuhQ8tNWVcre0Bx8hBu6nj+PXyMqoZWZ0fpUL8Zn3PuN/wVGbZHCKnWVxzEemMChNZe6AclT7I0Auyhis5HCZ5XticL1i7Pdorg1QQxzNx3e29UmoViaC2UJpoLIAiVo1rusKoJX6QdB7Kg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=38GtvsUbergKtNwWt8qv6uxU2WvNf8p6l32I3typL9U=; b=mXovD25tfCd9f1XwKKS8S9g04TP5IqSynEnpFd71yliw2D7an/A2TnSbsbw40M3A3jYLCrGaNF27KQjWDUKBX77V5UdvaheHp+iyHkUkqoWDHQiMWWGGrLJbfY0zrfFB01z4vd3vUgho2uVG9BZ1SItj2ZJIgYIEF3rhJ5g8wAngxJipzSgtdquOuA7Mok+ASfKJxg/S2efg7xc22kK2vNJg90R7uOswqUInkC5xzSykBmgQhrjHTN9uoMWZtKoSUp2aPTu/1Ym/JyuP/P4EYOkEH72RqzOipSwi3jSRz8oVVHpDjy7XkmMGe/7Nd18FXjQC29gAsWKDtM8HTMzPqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=38GtvsUbergKtNwWt8qv6uxU2WvNf8p6l32I3typL9U=; b=TUrTeuFL/g4pB6fpRwc0eHlXREY/m07+e3tnqn4QqR1wpXnK/0CNKKdh2NhfZqzq0O3uJcopMv9UV5rjrbV0PKjXj0M2qZYAMXWGczcXd0hWTFK5XIbb76mFq5PkPo1xbI4U/ee2kMunfvyQbSTUrzcjCYajg+dThnOr/08mACU= Received: from DS7PR03CA0256.namprd03.prod.outlook.com (2603:10b6:5:3b3::21) by DM4PR12MB8557.namprd12.prod.outlook.com (2603:10b6:8:18b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Tue, 26 Mar 2024 17:34:54 +0000 Received: from CY4PEPF0000E9DB.namprd05.prod.outlook.com (2603:10b6:5:3b3:cafe::2c) by DS7PR03CA0256.outlook.office365.com (2603:10b6:5:3b3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Tue, 26 Mar 2024 17:34:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000E9DB.mail.protection.outlook.com (10.167.241.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Tue, 26 Mar 2024 17:34:50 +0000 Received: from ethanolx16dchost.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 26 Mar 2024 12:34:46 -0500 From: Pavan Kumar Paluri To: CC: , , , , Subject: [kvm-unit-tests PATCH v2 4/4] x86 AMD SEV-ES: Setup a new page table and install level-1 PTEs Date: Tue, 26 Mar 2024 12:34:00 -0500 Message-ID: <20240326173400.773733-4-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240326173400.773733-1-papaluri@amd.com> References: <20240326173400.773733-1-papaluri@amd.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000E9DB:EE_|DM4PR12MB8557:EE_ X-MS-Office365-Filtering-Correlation-Id: 16ff3f74-7020-44b3-31ae-08dc4dbb0b76 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vWg48bSWZ6UTq1Y8rpTiLfYxRZiubGWfpMe+8F3jfYDQAcpDIF5urYq3BAKAdgnYn+wl9v5Ca/86oTekp1xKF6v5M/y2azhrUcdZhF9VeciBt2hKKC3dz6Bhcwx64e+nPCN34WGdLHYu8cGKrKM81ir0onSpAdeqrzrFvcDGGyJtfmwEdjn+uoKXOM4nSiOsvz4ikN+LzbLTf6SdOUin5eS6eaGSH1OyIsYoQhjrtI+RYhH64zbFaFsb8uxaQBHpLME2clG6v65Tk3cxK61o1oN48af1T+X8AEjZmDpxlpCsdhNwC9vcUNBQgGic7gwbECBwb1ezgE0ty2KcYsOW5DYd99v6d4TccgR4UOfuNWvC26q+aYYzC3yWCsnHEwHcr+fgqVDf1WdZEbiaasNTjhexB0odztq4SzFbm+ScyOKXnYdZL16RaNbNHBJ6bZ0laEmpr/PVvw/xUyYxwIXserMg7Awg+dQlnij3z8zWSLRFr8dgHQb/ZHLtspifJ9haXN1H+g8gVreMKPJ8BVlB8l28NhTxDWhpJHsWKBD0Fybd6MMGb897vAv5u+lHbPvFVQvI1YtsHcEef87olmNa8x2UNBCsfZJFKa77vfpI/v1RK8TZ7dhvFYWtAEigwD4MAJIZz+d89atlanxf4R/ilhN/ypZuVO4mcZA0SroiRBvgW/IAv2a1FnNxyz5l2WsJZ2uWngPNyTBNUAP6IEN+ZaD9UOLlicVdEJFWli/YdlqwLMJZQN0HsIPrkDPHC8px X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(376005)(82310400014)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2024 17:34:50.9098 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 16ff3f74-7020-44b3-31ae-08dc4dbb0b76 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000E9DB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8557 KUT's UEFI tests don't currently have support for page allocation. SEV-ES/SNP tests will need this later, so the support for page allocation is provided via setup_vm(). Signed-off-by: Pavan Kumar Paluri --- x86/amd_sev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/x86/amd_sev.c b/x86/amd_sev.c index 7757d4f85b7a..bdf14055e46a 100644 --- a/x86/amd_sev.c +++ b/x86/amd_sev.c @@ -14,6 +14,8 @@ #include "x86/processor.h" #include "x86/amd_sev.h" #include "msr.h" +#include "x86/vm.h" +#include "alloc_page.h" #define EXIT_SUCCESS 0 #define EXIT_FAILURE 1 @@ -89,9 +91,14 @@ static void test_stringio(void) int main(void) { int rtn; + unsigned long *vaddr; rtn = test_sev_activation(); report(rtn == EXIT_SUCCESS, "SEV activation test."); test_sev_es_activation(); test_stringio(); + setup_vm(); + vaddr = alloc_page(); + if (!vaddr) + assert_msg(vaddr, "Page allocation failure"); return report_summary(); }