From patchwork Thu Mar 28 15:21:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13608719 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2086.outbound.protection.outlook.com [40.107.93.86]) (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 D32B8199BC for ; Thu, 28 Mar 2024 15:21:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639284; cv=fail; b=fJ4ROMPGRxSYplDUMpTKZbYw3IW1XIYJhpoQe2VxdPtrXQFsnO1eWJ6vrPCuI0YlzKNS5fb8uYmTgxfb+NAPfgj9O9bhEk8AkKVDMZl6mEgn7KwjAhe85GUrEqrS3c2eTZeH5IbS3gocYEqkB+6g8Nc/k1qQA29N8I2Dv8uFeoU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639284; c=relaxed/simple; bh=eqS707r7Bse27gh7zugFdLJZjTKtTFKjwLTUC614W8M=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=ZR7vU7dvM2HwMPXhZjgUAE6n5n3/+r1TVaXxJLaB0CdTOOtw+VX/J/LoBkLSeOuNY8tX+qJ3SUopGu8z4p655g6jQAcuF2q5jPHE3/LEs2HQzZj50KpfC/ccvnOmyLyDhTlg91+Ce3jPAG5dNhLDNd89WvsqNi4RMkvLv5XGRjo= 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=4VvRv4iv; arc=fail smtp.client-ip=40.107.93.86 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="4VvRv4iv" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YzQgqQbvqy6xgsf2bZzLtQRxcINvQi+/dYPGTlYLmAe8emj/I10OVsSeMW+PoOoUlEmOGThMNTQnA8jeVlMbgF+MXqZoDcc7/52TsH6Qdww9fTGAvfBdF7zwupMxrdOYAKQfjPybAGfNAvG4Oi94oHzStEyE+ZgrkfH9h8s5dJrXxAXnjdW2PsczYgoOPOWpVeS3OuJQocPZdof6JNM+XicbH+aKwSeXzlvTsbeLafoc0RGKFY/L+SBQJzR3HxHAW0+m4V+OEzG4lh+58BdXr5ucJ3Q7sSJuWnWnJN1D7PcmhHWQZrU5MZLpBstHULFYURH82BXQCznNVCawmCv+gg== 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=KoqEjZtMxVxzeVqpZABOV4G4Gd6XVC3elcBVHQ61A0k=; b=IuJsvBstuR8t8gJWFa1Dbkiku1qwrwfv0qywFbmiW78usQDQaWauS/5jQQ3JL9G4H3vOkxUO9S9k0CnDKXJwtpf0613DQ4gRcDmKjjbqUuv1KUDAo1biNxEFCrqXVyAuDG15UVr45si1lRBxJzq6oEzlV0EHmhvtDkyWs1nr1/+eSa/J9xeIlvt0ZTE9ddnLRpe9T6Y6kd72mYL+dxeEALreOtIjeHrwjDCF//HOg/BA+9HgHPCuhsl0aOqAnjjqCDgsfOEcr6ooWqm2QRmNpUzysnO01BhbTj5MexhKAU08l04ctz2VhdJ2xwRRRq5hpowSlfukGrYTF+0O7pTdzA== 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=KoqEjZtMxVxzeVqpZABOV4G4Gd6XVC3elcBVHQ61A0k=; b=4VvRv4ivr8BRTPKZRAptcQA5qOJUfRXbpZBs2CneG7BrRCwukXfdqQMibwZeu3Nrp9QNyR2o6iSsQwrbR82UNoYakFV6+/CGoP5e7I1DTNSHUrro5a2vuwMzp3IWkhtlXYHWtukPbD7AqN9yDEa9kqCaqgm+R/4tvFigaXSBZxg= Received: from CH0PR03CA0020.namprd03.prod.outlook.com (2603:10b6:610:b0::25) by MN2PR12MB4271.namprd12.prod.outlook.com (2603:10b6:208:1d7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.39; Thu, 28 Mar 2024 15:21:20 +0000 Received: from CH1PEPF0000AD7A.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::f) by CH0PR03CA0020.outlook.office365.com (2603:10b6:610:b0::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 28 Mar 2024 15:21:20 +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 CH1PEPF0000AD7A.mail.protection.outlook.com (10.167.244.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 28 Mar 2024 15:21:20 +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; Thu, 28 Mar 2024 10:21:19 -0500 From: Pavan Kumar Paluri To: CC: , , , , Pavan Kumar Paluri Subject: [kvm-unit-tests PATCH v3 1/4] x86 EFI: Bypass call to fdt_check_header() Date: Thu, 28 Mar 2024 10:21:09 -0500 Message-ID: <20240328152112.800177-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: CH1PEPF0000AD7A:EE_|MN2PR12MB4271:EE_ X-MS-Office365-Filtering-Correlation-Id: 48c87855-c8ca-4e30-7849-08dc4f3ab89f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wfgQYtBTaJWSaTj9/Xa3WM+v8e/62Vuz6ZJZWtSz5k2wPeMsymuPzA9PtebVlW5Er+zJI899qXqMSReX1tjtgLF/+nZigv08Uu0fOco8DHsKl6icW16/+OfUmMWf5FDJ/3mGwcuQLFv2FBiSFMzDov6L7CKi3Kt/gaoMEMa/4ruF3y0/zfow89eb1QZ7Qo8bDBqeVYy5Tjk4ApWvBfwLdPvkR6yLlNYr1v3xhJCODSsuWAY7Fj8wcmuzgKy6VzCmRNGJd0fmUY5elG87qFvyH2bG0Mb/+NKPREZ8rTGUGPTVHGyyKs/I8Ecy+T0JW66AcCMWbJCpLN4oB4qNApXv/iePBfN6pZrujFtx+teNuy5yl8fyUkJpZQIPQxoa1LY5+zYnBKUpXmz/RjxOcZSGT13hsTFWZqAQM+mdXLYg8ho5NQbgtdSqTruxWzVY1egL5tD6pTC+nCZ70GITU4sHNR2i/1hZLfQgQ301yjrmn49t1OwruF47b8dHXhbFt7LCqIESa+4FR0ZCmLsMXz10AxuQ9lOHgOGKV3xJ6g/0N/VBn/5FzluGyRH89QltfhOomASPNNEW3UVLrlNVP7pATxbQkYd8xadXDmOLJ5JDNagVn+xxkWBFew93ZeoNgPzSd7mbYMY18wlZGXuki+z1jTO8yldryEtULLhc0NGewQfgEU44Mt02qkMzil6p4RoU2bqa3Js2qRuymrpXgg6BBsghPncdOyI0MJL1UOhqWwkTEjlMxScPSAd+eXX4QASn 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)(82310400014)(376005)(1800799015);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 15:21:20.3299 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48c87855-c8ca-4e30-7849-08dc4f3ab89f 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: CH1PEPF0000AD7A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4271 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 Thu Mar 28 15:21:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13608720 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2043.outbound.protection.outlook.com [40.107.237.43]) (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 B0E7083A1C for ; Thu, 28 Mar 2024 15:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.43 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639295; cv=fail; b=ci5FS5+TzeLrwhytKbPbb2TGv0aPHDCnkzQvCuonbBcGY+XhgzY7JZTwWG6U4DhH0mChyYHTIiJN3vHT5OGxlWaJ+ohIxCP09Zp2xxrx2S5ri/Cz0n1tDp3BiQdRzpmoiprrfLTP3bhXsZ+cM8nYbz7Gz+AAbFYGx1m0cykY//E= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639295; c=relaxed/simple; bh=xIq1010nD5STKgYxdg/nDepitNATS45035y5uV1dtd0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=e5V16OyLD7U5Ey5BiWAvHdKTmvtW9aHUkfcN4TvResQjnQVHPzakCRGFD+3cUo3K5A0hNc363Gm9bBJxgTvOAtgnwJs4rcKrE1/8HHSRiZD8deYbC0e+9VZH9zGL4W5GW5QBXrrKDu1SZXeo0XlcXD6rdlYl1++HnuLjLKqKiFI= 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=wRIeLC6g; arc=fail smtp.client-ip=40.107.237.43 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="wRIeLC6g" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W0DY0iPbHZtLWK5H1Ec2Sx9RmOOUzoJRXcs9LGwP6M5LtHQwTuoyiNFtv0yAvzzktg+77lBFxnLxp8ejdQB5qEjGeVhiHPmblJpAXwIViSlgb/vbcjZCr3x4GSlGvl88LDJdON+x6KK1ImuPbA2FsQ/nx8WrILujgRluHMcqrbiKPvRhY9NjuI1OKNUbCzQxwDZhMl0rA8q7s2WUZi8JBW2TRBmx8XaW01YEroDrL2ij64xZLOVA+59fYXm0Xae8KlHtXNU1fQzWHrzGlcorsdc3PnASmD1c4yUnV34DWTtklQ/CQ16hRMtBfMT4gdWk/n8Vr08FzNqoq0SpLBxRAg== 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=nht1mymGFfETQEkHOgtEtM9Fz5HHlTezkZW8HwK3BkE=; b=ETo+1fUVwgXONJ/xXO1T/SngGEQRT8w1orX/pK37yFeYLAB6wk5gjHR6EsOEVriOsI/3YgFKhy1k0i9HYJxtLwqUQ+6iSD+ta2znAPUFH+dpMyueAVKrzFjxS9q4U6GKy9sUmXOq+vMk0fVfqUpKGBDyDy7ALy9KLgbrSwIZULJcPnf+CiFMBNZo2tjgVTCVifbyXxeNGlWX5wCfyKgg02g6PCYFl0oixgXHqkIBe7arDs8EMuAmE0jtDKiHsVTfqKDeQRbpF0WHClkYymnO9jAMGmEtQEq/dYv7o9EYznC6+zFt6a81onYQWhM0J0fj3PYUnezZ/D+HpEMzQzdOHw== 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=nht1mymGFfETQEkHOgtEtM9Fz5HHlTezkZW8HwK3BkE=; b=wRIeLC6gGsYZg40pv6QQG3/dsQlxvZ6HP839+MHIMJzARtfarX8ucRel9eC3mPowWuflTo2rP52gGC87nkPXZ1eBJvxU3FS4Nv5SofqVW0aiIM0LHEV5kuOxeL5BQxIZGeFWzpFXMMIhBbIXXUyly0iPttGlMPUX2rnirvQpNKs= Received: from CH0PR03CA0269.namprd03.prod.outlook.com (2603:10b6:610:e5::34) by MN2PR12MB4191.namprd12.prod.outlook.com (2603:10b6:208:1d3::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Thu, 28 Mar 2024 15:21:31 +0000 Received: from CH1PEPF0000AD79.namprd04.prod.outlook.com (2603:10b6:610:e5:cafe::4b) by CH0PR03CA0269.outlook.office365.com (2603:10b6:610:e5::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.19 via Frontend Transport; Thu, 28 Mar 2024 15:21:31 +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 CH1PEPF0000AD79.mail.protection.outlook.com (10.167.244.57) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 28 Mar 2024 15:21:31 +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; Thu, 28 Mar 2024 10:21:30 -0500 From: Pavan Kumar Paluri To: CC: , , , , Pavan Kumar Paluri Subject: [kvm-unit-tests PATCH v3 2/4] x86/efi: Retry call to efi exit boot services Date: Thu, 28 Mar 2024 10:21:10 -0500 Message-ID: <20240328152112.800177-2-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328152112.800177-1-papaluri@amd.com> References: <20240328152112.800177-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: CH1PEPF0000AD79:EE_|MN2PR12MB4191:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d84e0c2-a3b4-4406-81ec-08dc4f3abf09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: R+guLkDhvKnnVxBOnKvtgKe23Jogm+oHNpuvVgIOnZsGFdDRZgewDuhuLFTK/itBWHy58eme/bhPqkkZXURXulaF3J5fgiIJlNYDSnFm557aczUVKK9S2VSh5rRLgk6lX+zKZnuQQiYpoqDfUiNdNFkt/JeFt0Be4sLMDjRvtRPs15AR2KJd3CsTzD224gGDrjfTjKBnIbDF5ogsmYuhp6LwXpokjbjLYwYe9mhwmpNgtS7M5wWCSkjESEjYF3/KxWDwW4bCYvzRoQMy3Zf4ekvWrjiIY3XYG9pmQQ212rxlEbHbQ2SODMkNtUPnTKWFU+Exjof/jm3pzXnsID3gvPYLaV0F0sC9MZUxd9h3OUQUCRwkUHptM7AQmRoPMPfMHjnKo024r3wHu/VUFPbEShp/KEaHY1Dk2qPb/CnvXxpJ7NJHzubX0tXkJSL0BR3hOWEW3PPDHkA/JNNBjCIzOY2NaxyCMsZafWqh/gSFeLix7cwnL2/eeMzYS4BGvcCYIy8gG+GUKaU7FAtUqEs1AHoVMWHf8C7KZkY3J+bgdjgZcNyoWNMmR7hATcNM1YERdUYIDKn49Pk5g4SeMy82Vx44aDslhDM+ACT1FvBku0qgZFrX2aGzmGjNn2QDDvqdcLoHEvWSFh38uSqmGfRJP+WPS4R/kCTZfxgHL70yXvoPWhIp9I9doeHd5kHK0ThmOzlTFYFtgs0msgEDejTKE5VqKpl83rrvQ2oQUEYQgMoQUxpK7Hhdlg2AAsTxBpyb 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)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 15:21:31.0911 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d84e0c2-a3b4-4406-81ec-08dc4f3abf09 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: CH1PEPF0000AD79.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4191 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. Keep freeing the old memory map before obtaining new memory map via efi_get_memory_map() in case of exit boot services failure. Signed-off-by: Pavan Kumar Paluri Reviewed-by: Andrew Jones --- lib/efi.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/efi.c b/lib/efi.c index 8a74a22834a4..d2569b22b4f2 100644 --- a/lib/efi.c +++ b/lib/efi.c @@ -406,8 +406,8 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab) efi_system_table = sys_tab; /* Memory map struct values */ - efi_memory_desc_t *map = NULL; - unsigned long map_size = 0, desc_size = 0, key = 0, buff_size = 0; + efi_memory_desc_t *map; + unsigned long map_size, desc_size, key, buff_size; u32 desc_ver; /* Helper variables needed to get the cmdline */ @@ -446,13 +446,6 @@ efi_status_t efi_main(efi_handle_t handle, efi_system_table_t *sys_tab) efi_bootinfo.mem_map.key_ptr = &key; efi_bootinfo.mem_map.buff_size = &buff_size; - /* Get EFI memory map */ - status = efi_get_memory_map(&efi_bootinfo.mem_map); - if (status != EFI_SUCCESS) { - printf("Failed to get memory map\n"); - goto efi_main_error; - } - #ifdef __riscv status = efi_get_boot_hartid(); if (status != EFI_SUCCESS) { @@ -461,11 +454,24 @@ 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); + status = EFI_INVALID_PARAMETER; + while (status == EFI_INVALID_PARAMETER) { + /* Get EFI memory map */ + status = efi_get_memory_map(&efi_bootinfo.mem_map); + if (status != EFI_SUCCESS) { + printf("Failed to get memory map\n"); + goto efi_main_error; + } + /* + * 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_INVALID_PARAMETER) + efi_free_pool(*efi_bootinfo.mem_map.map); + } + if (status != EFI_SUCCESS) { printf("Failed to exit boot services\n"); goto efi_main_error; From patchwork Thu Mar 28 15:21:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13608721 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2051.outbound.protection.outlook.com [40.107.94.51]) (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 5955C2C6AD for ; Thu, 28 Mar 2024 15:21:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.51 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639309; cv=fail; b=pkO0lgNtQUszkD5LPYPKjrOsax2VIcbXgFq5ZTgCYJP+mhO8kchbnX4Nfxngpi1IoehdcbK6gX04AbsUvzT5HQeQqBrVXEpoB4Pdi9hRPfM6NClScCavTrQlhoGGQ8+cj5Ym5xh/na9enR3clKnQQKj2FCckUVibbjrhl67OmhM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639309; c=relaxed/simple; bh=foaezEub8w3w4KRjUpDjY3MwvtuJonm19FbkVaFMylk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=snSkWp2y+rNrFsI38QlK8FSUrGlNyCCYND+/E0mXAJYMzAdo5Oiu75PlRdiuvtumPS1HN7gkq8h99MeukzrdKdY64qc229VmcKcDnC96DSjglRAhQu6DAsQh9SPKAwgRMg9bx6y6x2QNBuTzXQVJjzqAIOQecWZTktQfrVKRZcs= 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=ndHp3OVR; arc=fail smtp.client-ip=40.107.94.51 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="ndHp3OVR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dlLZD/zL3LstQj3Q/z4etcoDPSMnG7OsBp5vva8rQEbhTayyYbJlXDgnKrNVRbXPAtJDhd7ij3tgwRwMNHA2lrQt3jTHAZx9d/sCcj8SMEZn+qqnAWNKQ/iSrE8MBA5A7H4FlcqkeULgvBBAOVXPiGl6lUzEvcVVOBFwrdD+AW274mjqtPCmqqeZphz2RYH5mGHUvGpDg0mTFLb5ZRMVdH7TLz/7VlVDq561EA+NuuIhSTxoWE2dIjqlOqgzIgsLNnS5DTUl0Ys2tBzzNTE8VycvGeaJDr+xXiGWVTxa9gxo5tJ39sjJsCp1Jj5WNC4GAOL8CO98JB1LNAGO8g9Cqg== 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=ZxHT+mb7RBJ8Yhi5YpAADSNnQSo5UMqJHOkOLnKOwATPVbLL+TZ09x4Y3bEqApr38ZZFtElYq3XTLylQOLKxAyt70P8X+LWlhzyfTOul5QToOn137rZM6amgsAx4panzGL86Xcab4+U2Yf6Gi8fMsBMUuk3wW/ZihuJ26yPbEgr3PsGk+eLoOwr6ABMOWAggKf9YAl9O8KFSLVLk/0Hnp6txXI4+pJr0taLAMvr8m2uWZerQuLFbJy7CHyVteeb2UhHbilVdZt5YgTsbqt22Ols+DwsjDAoJtCMqMHoLhUI+7Ed1DUxm24MkCRLX2M+CM0D4zGX4uv9BZpC4hSZgQg== 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=ndHp3OVRT2D/hxEDX80sdlPgilvuyeD6yXahQi66EpFq5v0t+7vtWABw7dHI5L+Qj4zUamGhThhx1sB3B5i8sflbxBttwZvUTPITxGmTVaUG3IZFh13zS5eZ9oRKdoiMOedz2OUkoqV3ycjlfnnrO5chbBruTn9DpQw7djCqRsk= Received: from CH0PR03CA0095.namprd03.prod.outlook.com (2603:10b6:610:cd::10) by SA1PR12MB8885.namprd12.prod.outlook.com (2603:10b6:806:376::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.31; Thu, 28 Mar 2024 15:21:44 +0000 Received: from CH1PEPF0000AD78.namprd04.prod.outlook.com (2603:10b6:610:cd:cafe::36) by CH0PR03CA0095.outlook.office365.com (2603:10b6:610:cd::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7386.28 via Frontend Transport; Thu, 28 Mar 2024 15:21:44 +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 CH1PEPF0000AD78.mail.protection.outlook.com (10.167.244.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 28 Mar 2024 15:21:43 +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; Thu, 28 Mar 2024 10:21:41 -0500 From: Pavan Kumar Paluri To: CC: , , , , Pavan Kumar Paluri Subject: [kvm-unit-tests PATCH v3 3/4] x86 AMD SEV-ES: Set GHCB page attributes for a new page table Date: Thu, 28 Mar 2024 10:21:11 -0500 Message-ID: <20240328152112.800177-3-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328152112.800177-1-papaluri@amd.com> References: <20240328152112.800177-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: CH1PEPF0000AD78:EE_|SA1PR12MB8885:EE_ X-MS-Office365-Filtering-Correlation-Id: ef3c2055-f5fe-4ff6-3fd5-08dc4f3ac6ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Kix4FbbmL7qaoy76RnYVcbLOlZz+VbAncYj2id46iSPmizYnbmqeI8iYhtpnx+hxifgG2pZ7maZg8Ge67cvN+s7sCQ3l9OKORCXtLUysN1zTpcCdQc4+bIECcQeiWmJGaWL1M8CHp9PUxlPh9K9eXjZMJZ2/uEhngFzbWNkLgYyPmf42fMWWBwuvmcOObBytaRpoRe9w2hZa6NkLSBCWisVvpYJGaDrLbpHdc6o/7CT6YSnu//Btf1KFh6ugnWccjxnmOTAlWE6nXAXdGkDOiwhhbRB8qtCAhHI5ARgkQQY6morX2dpusURyJGeF9+FUBznYXAv+/b9vi2XzVxgExt+eaAFqblpNW92nNWhEuuERwxkj5f3QMGzv9mFRFDKj4cjFsxSSUHXt0jlW043mlqdlMqMui3Q4EfSpwq/YtbB1RkVulM3Lu2ioDyyuxQMfv5Qz5u9VVFTzBfb2MR1WPxuwcFogicrWGe8Lsl/XIhc30+NZ+fU/aEA5tvo1Yk2j7TzNBwgQbPO/ahxkYK+sqlFuFqzsdp6OHaKbwq6+oalfEkxl2CpadPovMEF89ltAwLd9Gt6GpSZ/Q2IhKEuWD3KzmGHw63o5hXRZ5BtISC/jjKTq0+/XgFKbH+DWu/YuhzZJXx8WK/EGYtQ6B2bigVNRf+8QtDsjZ6Kx1uwDcB6hX/jV2HLJpzFA00VIkGJtmO5Dc2Gf0d1N63juVSL5yYklnujY9kr5UTyHSEdv3kf5BcIXnF8naXiw+X8XOH5q 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)(1800799015)(36860700004)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 15:21:43.9935 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef3c2055-f5fe-4ff6-3fd5-08dc4f3ac6ba 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: CH1PEPF0000AD78.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8885 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 Thu Mar 28 15:21:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paluri, PavanKumar" X-Patchwork-Id: 13608722 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (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 6BBAC2C6AD for ; Thu, 28 Mar 2024 15:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639317; cv=fail; b=h/dv8DKzzY0zlFxTzdOyFVbBWLLumFN1AROez3SqKyDmMwd1whzsXarxEQR5oeKVpZ3WGc0345q6aKiNG28qwpb8kpiygoD6Hln59y1W025s0PqJ2gSiIcnxIU8UdTpij1gzCfuvKo1MoPQYXv/hkLwW5pPElWGTSJuF8k712JE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711639317; c=relaxed/simple; bh=FoilVzfWr4MAehofgksYR0krpj8svqHfS8SNRCVDmnk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QazJ8NfDiCH1oG7UgkYTdkpJ79G651yCjGhtoNwoz3kyksRxJRrrM2ghzwQ1JWWlkYVj8AmDCtHE2fIVcVOVqdFtPzX7Lp2eBjGrJg6pRWjHb6z157G1j36wBoywSMCMej0Mkof1KVmeLpOZfvsaV3Tammw8SWnSprgS0NWmpjg= 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=4hDyOK25; arc=fail smtp.client-ip=40.107.236.41 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="4hDyOK25" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fjfb4S/SxOFZL4rxK6UOKYz/5XrqSSO5RGtriCZoGtTPT0KEKEubwKm4T7gWg2T/aFH1YVic1S5OthYpAcKh2/MW3I/KYKljyiz8sPB9XLd58z6QET9QlfAyP5D6gZepEXxx48ITdPxaG/nRg0HY07vxYLNrfHt0EKWb1D6P5aHcl7SV66jrgK7ewkMfDalsr34KpzhxYgOFkiksaphUiE0oH8eiMh3bj2A8VPJ3IjxBUivpkU3Q4OTKDI6TOXG2w7SDaAYGXvgy3XBWkqwPr76h3HCcK3uxyGrpH9y5ipV9J2PcN7jUO4ZD/jggUvvU9frZT0MXlAw8IDalTzzzpg== 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=X4BhR8kPnabwcI3aLKBYElDY8OShjD50ChjkEAACqj8viiCaNaeoqyTN6BCsbVTRf9gyNrlqg9IwhVz4eoQtQHnAK4uwSHjiVbp65Wd1+7D7Yt6v54Vj2gnhqO08e03XjX+dzy1pOYNDbdwjfIQx6riW6dwpxwCOs/+kmxhQBFkDAy+uHrepWdggcxA9NFUBgHFn76BS87Rw8ZUGrZjtdzeSL6JJrl2xjXDQPwuTlrpBCaw8yxKbyxc8jcmEw2eLl0Z1mOJDm3iByewnMVxO6r8M1wLrmj24dFeX+nUHFBFMCewNj7wIcDup/RDn78674Lxo8z/fbbbyTvuRaIhMgA== 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=4hDyOK25z7myWyoUtjoxhL7qN6859Be7LWot7x1IPquhvecjLxJPkRr7MlupQ3Dp0uKmrzjzD293Y1A4cBdaN/tx5TOy6Ym3ilWbVQ9uyJ59IRHnMSopqMPTwY6SMNl6gI0P5VKb5IkCMDUn1n4WAkhb7mpjNQRmUPcExqrucYo= Received: from CH0PR03CA0025.namprd03.prod.outlook.com (2603:10b6:610:b0::30) by CY5PR12MB6081.namprd12.prod.outlook.com (2603:10b6:930:2b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.32; Thu, 28 Mar 2024 15:21:52 +0000 Received: from CH1PEPF0000AD7A.namprd04.prod.outlook.com (2603:10b6:610:b0:cafe::39) by CH0PR03CA0025.outlook.office365.com (2603:10b6:610:b0::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.13 via Frontend Transport; Thu, 28 Mar 2024 15:21:52 +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 CH1PEPF0000AD7A.mail.protection.outlook.com (10.167.244.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7409.10 via Frontend Transport; Thu, 28 Mar 2024 15:21:52 +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; Thu, 28 Mar 2024 10:21:51 -0500 From: Pavan Kumar Paluri To: CC: , , , , Pavan Kumar Paluri Subject: [kvm-unit-tests PATCH v3 4/4] x86 AMD SEV-ES: Setup a new page table and install level-1 PTEs Date: Thu, 28 Mar 2024 10:21:12 -0500 Message-ID: <20240328152112.800177-4-papaluri@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240328152112.800177-1-papaluri@amd.com> References: <20240328152112.800177-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: CH1PEPF0000AD7A:EE_|CY5PR12MB6081:EE_ X-MS-Office365-Filtering-Correlation-Id: 90dc30ed-052a-4ca4-622d-08dc4f3acbd8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ls/XAHzmxNNkL6yhG0aI0l4erIrLrn45p1vyDSAAV8s1V66sCdUiWnV7HCrq8nNRxVOar8mHPsIZ7qy3GVmT7knfboPs0tb74IuPHGrSY/fCKDfJbdLzk3JLNGpLH6jgGv0F9DwV6F8pd+DZoX7uJjyoloQFqR8vLPhy6aOTYOaSv1QI4NPpQx3N0afRGobrCS5QOkrt12QdILVXnjCMBL7fZ0QtzhWZBNmPaOY71psZh4F8gzY07BJ8ujvkTsVcDyXUPrz0Y1NncCAj4OjkGWApe7YiUJSP40B5WkCQC+xHOIm4vj0F9e/T8mmmaKyPodjtGwqZN05a15OQrR9FSLwRNwNBKnb9H6f4BPeptUSJg/sYzMOvF/paRQoS3F7BKOOaonTnRhUBB/odVVUaoIQnVnbFme0TdVReShk4IkkPZGe+zqjbJOX6luntTqQ0QwRDjq5JQbL5nKt6Md09CH3I3+95+eaFKEQM/yuovf+1VftpSEQilJZkdnyx6J/rCQrqrQXHVKgiB654+A/kqFUqT0FnXcNdQci2ELsGKPvzpQwCTK9JaMo+JKpX+E5Mx4jp/N9o8pJjsOJ43C53LqBkC+GinORq1x7+mDmj7RtIohEBBwvuN22uY3XQYc4uMkg+rQSSB86ySjT3Rtc5VGT3blVZtQWFxtex5gx4LYVKamDLWlSojUWskr8NC/Ua6igA7k21WCIInXM5812ljYQzkBaxmMrZ0rpmGzWG4UIlHByHrRJfHR1rOn6W/9eb 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)(376005)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 15:21:52.5796 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 90dc30ed-052a-4ca4-622d-08dc4f3acbd8 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: CH1PEPF0000AD7A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6081 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(); }