From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F3508C4345F for ; Fri, 26 Apr 2024 00:42:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Ir348DN+oy/3Tv7pKBUjSO1ZB/S0aVWzCDI5pEY+H0E=; b=voSGz4RiyfMOVp H58Dri4nxI1j7U+w9gF0aIIYLqmRy3PKInmMo+xG5/aeXunw5kbvq0ileIvgnX9xBl6utJTLKw+p0 LYH2shhSi5D/e22IDkj5p/V+w9Og5tbRbsEXipfmVPHxZsd5r5lm3h0OK7On4qLe8UsF35le7cHc1 5f4+CadmHqrU8YFK0R0rFjkDeo7QbzQ45NnfBCbtbodzQ092WocT7T+t+ya185mnxwDURUU6d8px+ zKilEC2PrRQ87L0wkR7wZ3+YbP42lw1xMPmEeOaXAa6C6FJefKoif3g3CYrpGNDGKD7Nk0KTfXMWa PRN+f+8+xtxWqRE3Nlmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s09fC-0000000AjJP-34QV; Fri, 26 Apr 2024 00:42:06 +0000 Received: from mail-dm6nam12on20601.outbound.protection.outlook.com ([2a01:111:f403:2417::601] helo=NAM12-DM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s09f9-0000000AjIW-0HU7 for kexec@lists.infradead.org; Fri, 26 Apr 2024 00:42:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RuWRaiPn6X+0shma7N45/TJBUgnPCysL14HV3a6yTcRcx3S3y63mLQXcdRfxNwvr5slgYghTs0ZN27JLXnooFAQKsDU3qOZ/FOt5Sme9yNJ0QZ1qGqa3HsJ0rWa/AwGBdR0gfSYYFJtYiZSOX3NtUnVLJarBWYE2sItYnZySddbJINu2jOybtEnxtFwqOQ3yC3Xi8sOHD1RCriBKxNka1o3oLZJNRKp5VOllJOdyP2sbajLxVz0Rv4kYBVePJLh8njK/2b836jfNa8ryWE0WEvtbxHgOg7qYPca8SNLYSHB2ucM3UrIZUTYH4pYXw+Ejd85MHa5nHlVMZeyUsBlQjQ== 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=UpU7htbXKHEicSll8vMt/Ky9+2XNMdFtksbXyhgnOAo=; b=DX9hAQyoRwmcEWLvHwbHOgH57N5q4PI+rsfzuKLQZCyEMvuwcCDG7uMjLSE0WJgJxDy7bXnfD1YwIuoi95LIHUtI4pkjrNqhKXUZG01wQ8CDW10j1A61eDE8BqmEFnSHCx6Fjg9tBT3KQ6BhOt0/IE6pjGImRLgWM/f8yXeyHEN3Z+vrRR8s3OpSJTsRhmc7oMlbbivIuQjuE1FY3vsC2KStx8kI6+HZBqu1rTusCF4u1h5m1CkmPvEAHo6XxHneyQt2tlvnACSRFNiZIgkcSwkCNPlrScQ6OKddhLtlMr9UATcj1dphbc0a7csIoK7v2ypw8ocgHbnY9i9K8aShYQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=linutronix.de 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=UpU7htbXKHEicSll8vMt/Ky9+2XNMdFtksbXyhgnOAo=; b=2NKrcsy/WIL9zco2gYGF23BLRwRM8JBFFYEIDMKgua/RMjhdgbfU5OyBAOq49Z8yPyktclnaOU5mVQe7sQL3pJrCrqC5cZqo1ox9ADKuqMSHHo24rfpBU/vhTow+fD3Tv8Jpdme5MHDev9mYF/YpJBJ8T2sbpJoAiBt36nYxWH8= Received: from BN9PR03CA0251.namprd03.prod.outlook.com (2603:10b6:408:ff::16) by MW4PR12MB6922.namprd12.prod.outlook.com (2603:10b6:303:207::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.44; Fri, 26 Apr 2024 00:41:49 +0000 Received: from BN3PEPF0000B06A.namprd21.prod.outlook.com (2603:10b6:408:ff:cafe::27) by BN9PR03CA0251.outlook.office365.com (2603:10b6:408:ff::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.24 via Frontend Transport; Fri, 26 Apr 2024 00:41:49 +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 BN3PEPF0000B06A.mail.protection.outlook.com (10.167.243.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7519.0 via Frontend Transport; Fri, 26 Apr 2024 00:41:49 +0000 Received: from ethanolx7e2ehost.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, 25 Apr 2024 19:41:48 -0500 From: Ashish Kalra To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , Subject: [PATCH v3 0/2] Apply RMP table fixups for kexec. Date: Fri, 26 Apr 2024 00:41:38 +0000 Message-ID: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] 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: BN3PEPF0000B06A:EE_|MW4PR12MB6922:EE_ X-MS-Office365-Filtering-Correlation-Id: de07bcb7-156b-47e5-4342-08dc6589a886 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?N4g9XoQbdg/LpudsylvG7BiT2S5k/7hQMkZRwWQXBFYsevOkg7Cvl5fC+97a?= =?us-ascii?Q?FPz+FisSR0u7V5RDPChfy+dCqQEfmeL6minX83gUtTF3ir7VfhReB8DcHnmY?= =?us-ascii?Q?oSQw938jVui9GrEre1H09liv7HjYNysDmYdS4BJ1hnlbMkGPkLqqPYcqw9b6?= =?us-ascii?Q?VG7Nfrv1XQH53lG2NncXkc2XkCMwpNQpuusDqywYNmz0SBACKbctRrZg+ovl?= =?us-ascii?Q?ExVK2RHiSr8PvlvrVP0ygkKQnwMQPZZ1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eFbZtgfIwBiOKeJhOF7/M9CHpk5yWciHiQxcszR/gkgsPBPWU+Uj2G2yAOWa?= =?us-ascii?Q?gTjYhKYSWbKaaAUaKBD5yqz1AMXrMmieD5G9UK+jaSDHOpBQY0JzY8nhF499?= =?us-ascii?Q?Tn8vTanLz2ig9feQOAbVwVC9DUP8rZZEwNcwubkP+XIMpz49gd0Uw+eOHmLq?= =?us-ascii?Q?p5a7HDfPaD8waUFQnKVfi2TdtqvZWXDvKWZC+rJCbU86ANr10I6VQAxP3avb?= =?us-ascii?Q?e2U+KGcZw/ACaXKdBNPxh4IfkZDQ?= 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)(1800799015)(376005)(7416005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2024 00:41:49.1282 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: de07bcb7-156b-47e5-4342-08dc6589a886 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: BN3PEPF0000B06A.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6922 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240425_174203_135381_E88EB678 X-CRM114-Status: GOOD ( 13.61 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org From: Ashish Kalra Handle cases where the RMP table placement in the BIOS is not 2M aligned and then the kexec kernel could try to allocate from within that chunk and that causes a fatal RMP fault. Check if RMP table start & end physical range in e820 tables are not aligned to 2MB and in that case map this range to reserved in all the three e820 tables. The callback to apply these RMP table fixups needs to be called after the e820 tables are setup/populated and before the e820 map has been converted to the standard Linux memory resources and e820 map is no longer used and modifying it has no effect. v3: - Added new e820__range_update_table() helper and updated all internal and external modifiers of e820_table_kexec and e820_table_firmware to call this new helper function. - Updated and restructured the commit message for patch 2/2 to explain the issue in detail. - Added, merged and cleaned up inline comments in patch 2/2. - Added new __snp_e820_tables_fixup() function to be avoid duplication of code for fixing both RMP table start and end physical ranges. v2: - Remove overriding e820__memory_setup_default() to invoke snp_rmptable_e820_fixup() to apply the RMP table fixups. - This callback snp_rmptable_e820_fixup() is now invoked after e820__memory_setup() and before e820__reserve_resources(). - Expose e820 API interfaces to update e820_table_kexec and e820_table_firmware externally. - snp_rmptable_e820_fixup() now calls these new external API interfaces to update e820_table_kexec and e820_table_firmware. Ashish Kalra (2): x86/e820: Expose API to update e820 kexec and firmware tables externally. x86/sev: Add callback to apply RMP table fixups for kexec arch/x86/include/asm/e820/api.h | 2 ++ arch/x86/include/asm/sev.h | 2 ++ arch/x86/kernel/e820.c | 6 ++--- arch/x86/mm/mem_encrypt.c | 13 ++++++++++ arch/x86/virt/svm/sev.c | 42 +++++++++++++++++++++++++++++++++ 5 files changed, 62 insertions(+), 3 deletions(-) -- 2.34.1 _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec