Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp34121lqg; Fri, 26 Apr 2024 08:06:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUupfuVgd+hISMzZc/VcoqUen7jTgJ4j2P5pTjUMxdg1ceEMJMiWoVOkojrtKi6AjUWgJgkEqx8PV+PHQYJZyUHru0unC8lEUvOKQlPfg== X-Google-Smtp-Source: AGHT+IG9gSJ/0r7RGPtMv8IQkEmuxzIBVjf6yK+2339YmxqctBFCitqUY94z+VVkxNMAOggrQ8NV X-Received: by 2002:a17:90a:ea0d:b0:2a5:b73c:8440 with SMTP id w13-20020a17090aea0d00b002a5b73c8440mr2734941pjy.12.1714143991279; Fri, 26 Apr 2024 08:06:31 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id kk3-20020a17090b4a0300b002af4fc1da69si4996970pjb.18.2024.04.26.08.06.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=dawcHHsB; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-160196-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160196-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C51FBB23F86 for ; Fri, 26 Apr 2024 14:56:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CBDBD148832; Fri, 26 Apr 2024 14:56:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dawcHHsB" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2048.outbound.protection.outlook.com [40.107.237.48]) (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 398631487DC for ; Fri, 26 Apr 2024 14:56:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.48 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143391; cv=fail; b=Nsqgz5sEvCyEjsQwaB+2J75XUnqhAlvB9IOjVsoXtMhsDDhC5+HL859cfuAGU/rLxBof1NCot2p6VcP77cIDD8ImKb8WdwATHUHzBRU0OlzDzMG9o6RTxRsbSP5enjbr9K7j0eokQRk4+c9RcwxAsF7+gES8uKxISkTgyw+PxEY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714143391; c=relaxed/simple; bh=xZPaK5L4JAjoqzYM1+MIcqWY/qj8TcNtURPAyUQydRM=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=KLOlj3kyHoNdbYReIri3JBny88NDkjY6riRNbsT+/pHMFOJ53RXMVeIjKI8BoiDHd0kF4rQ0B0VNDEyBcTmZWixzndY/kQ79NIr9lYX4xSHAiJN50mT3s/ikDC8b0PCtG5pq6ZUIz4g931JieoONeSnbtLk+dpQEdQnbdxdWYsM= 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=dawcHHsB; arc=fail smtp.client-ip=40.107.237.48 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 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Snnoz8aYjVRixlVJfS33vbLJ0pt9dJjv4fMcUiKH5Lyd0QHCp9rfj6uRhyUyjB2b/ZT4Xikp6jFL6TJUE+ydXcIBtJsMr+nJx7bHmYHPl84EH7vDICzkKGARp0pMKFq3MQYUxyvHyEDugJ7//VeNxslC+DymSLLgdayy7ldLqNM/FhDlscE1BBlPM1mN/1KzooiGFzPwB17wNASLa+EYxnFJnu3K1AVAQMZMwr6maE6naiikPecWKdZwci9HCYkpU5PG12HB95aTAZc07/OwLwzUwJKv/1S3Qa78ZRTQo/2Iyq5PX/CO+Q9ttl4H0FZQaF0XegOyz/pR23ap9oXKvw== 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=uVrAT6YUdz8k1Me7lbCfuWoJKBZToDF05sREq8qAsrs=; b=AWa2NkxEzvHXGm8nfylrpd7e36KKQ64ZT2s0g73s6FsjXqgrMMj0s/OW+fVkqeTCUSC4+NqQgKrh+poJpBPk/6ni94NGR3Oo2fJ3Kycs39lrV+tZp0swvk15kSdRHFT699Xa8LWi+clb0QS/eflegB3uSAjIvcu/IDg0fGTauQArNjnQ5/JMraV9nqgm5/Eg1F58gxKODi1WdVD4u/58q10OwG5gE05RH+VLMId1Ak9XRBkTU/f2l/wRH6NcQb8ud+OB/5NFNYVMeIwZ4OTSrTJVvTS+MferIN7ldlawe4Uw+BXJi6SSaUXRImXFFbUNYjV7oQLYhvXvWm+BI8s0EA== 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=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uVrAT6YUdz8k1Me7lbCfuWoJKBZToDF05sREq8qAsrs=; b=dawcHHsBNS8nnkNAkXMH9OxZ0JyXiTItaKJ05CM8j7VwdPw8GsUgxxv8SOpwZhwYu7+cu2As0Woi5jCztY+hv48TmkG93TxZ9iIrArW6ajI1sB5vVecwwuQKO/sakx/VacNDwiL+FF6pYv1WM3lkj0jZLr7KqaiOasiBXZnWSl0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) by MW3PR12MB4473.namprd12.prod.outlook.com (2603:10b6:303:56::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.46; Fri, 26 Apr 2024 14:56:27 +0000 Received: from SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::3cc5:f552:44ae:1f26]) by SN6PR12MB2767.namprd12.prod.outlook.com ([fe80::3cc5:f552:44ae:1f26%7]) with mapi id 15.20.7472.044; Fri, 26 Apr 2024 14:56:27 +0000 Message-ID: <5d515e4e-5db8-4840-a200-a67e7df8043b@amd.com> Date: Fri, 26 Apr 2024 09:56:25 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/2] x86/sev: Add callback to apply RMP table fixups for kexec. Content-Language: en-US To: Borislav Petkov Cc: thomas.lendacky@amd.com, michael.roth@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org References: <96b2949cf225501d686b47070c7bbad341e160a3.1713212104.git.ashish.kalra@amd.com> <20240420130533.GNZiO9nShSxjxB-FQn@fat_crate.local> <20240426125803.GDZiuk2-YonyodvSbi@fat_crate.local> From: "Kalra, Ashish" In-Reply-To: <20240426125803.GDZiuk2-YonyodvSbi@fat_crate.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: DM6PR07CA0037.namprd07.prod.outlook.com (2603:10b6:5:74::14) To SN6PR12MB2767.namprd12.prod.outlook.com (2603:10b6:805:75::23) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN6PR12MB2767:EE_|MW3PR12MB4473:EE_ X-MS-Office365-Filtering-Correlation-Id: a4e5f42d-a517-4b91-44c6-08dc66010cb3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?utf-8?B?eWg2ZnZrTmJ4S0p1Qm1ldTVEeTM3RmJFM2tYY09xUXZkZklKQXUxTGtCOVJB?= =?utf-8?B?OXRaU1VjS1R1WUJZb0haVDlMYS9aUWZIWlZXM01Ua3pXUzN0R1JEOTAzV1dE?= =?utf-8?B?R2EzTGVWc1ZxZW15eGNKWERNc1RtSWxoTWJZRnAvTlY0NEE1STVUY0pvVS9x?= =?utf-8?B?WnArblVyZEt2a1Z1bkRRbFlGd0d4NVhYdEY1c0hjZndvR3V6UVZvSm5ORFRS?= =?utf-8?B?TUxMMXlqSFFPazhQY1F4WU5aSlhWSlRtZW4zREM1MGxrN1lMclgxYzZLQ2o2?= =?utf-8?B?czZhY3k1NFRzeGJuWlNObWh2WEFpNVVnQjR2VUpxSmdOY0JTbjV6V1pOU2ov?= =?utf-8?B?K2ovOW9zK0xlNXY2NkZmSzNqazdDOWJaYzdNUXNO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FlNT2VVbkZVaUlRSUcyTFVoQjd4TDZZQlVpajBCTEI0?= =?utf-8?B?bldIaTY4SU5nb1hlY1BMQmhBVW1yekZoRzJ2d0VzT1RjMGszZmh1MTNnT0V6?= =?utf-8?B?VnZ5ZUlxRVJZSUoyOEpYa0xpMHY4UkRJSjJOZ05ndlhhTGVYVENCekRFbm5E?= =?utf-8?B?ZHdtRk9XMy81S0N4OFBBVk9ldlh6RjI1bUxHUExBU08wZmtXZFNuV1RyTHla?= =?utf-8?B?SGEyZkMrakU2Y1hwU29VNWtsQXNRWUlXT2pxaTBhaGREZHBoMFVJZnJzQklu?= =?utf-8?B?ZGpYbktKaFY3UUtqN3IwRlZZVFloeXN2QlFFZjFIaWxDaGdzSVRlM1luRm1Y?= =?utf-8?B?amw3VFh0NTZOS0k2Vmx2cWVNZzJ4RTJqVlhKeHNYTmJ0QWRFdEFXTUtBSjNq?= =?utf-8?B?VHdvNHFhNmVhcVgzY2pYb25UVWdXOFBsd0plRi9zL0hRNWZwd0VWcVV3PT0=?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2767.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(376005)(366007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?U0hPaEgzOHlmVjgyK1VnSkE3dG5LSmZ6SDR1bDNuRUNmNjRoTGZxWkVpZTA3?= =?utf-8?B?cTJ4SFRtOGZQd1I1SVpWV1hheVVSQ1pZcEk2ZmdDZzhZNlRQeTIwTzVlUmky?= =?utf-8?B?ZzJ2THp5YWxxWVRWWi9pT1ZLYmZWL0FoNmFjTmNWZFBYOVVTQlJFZG5GU0RT?= =?utf-8?B?cno0ZDhBbklkQW9qZlFWR1JRSytHZHMrRjJ0QjlUclp6MFQyVWdwbUlQdGVk?= =?utf-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0azhibzFmWEgzUy9DdVZWWmlqdjVhYXhT?= =?utf-8?B?eTJxVFRaV1dKMjFSTEREN3pCK2lXeW1nVVY3a2kwclJtM2NlZGVMSVNxaFZZ?= =?utf-8?Q?Bw4pf+0W1li/UmmHsO9AjA7fR?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4e5f42d-a517-4b91-44c6-08dc66010cb3 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2767.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Apr 2024 14:56:27.4864 (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: cv/oa1A36snAiwRqnrn1O5DxrBn4UPGpA3VVZSkOW+Qx98HrsgZOSe+yHfZXENsxvLiuRbHb8NHLSCamG7XvnA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4473 On 4/26/2024 7:58 AM, Borislav Petkov wrote: > On Wed, Apr 24, 2024 at 06:48:08PM -0500, Kalra, Ashish wrote: >> This callback needs to be invoked as part of setup_arch() as it needs e820 >> table to be setup in e820__memory_setup() before the callback is invoked and >> snp_init() is called from sme_enable() in kernel/head_64.S (startup_64), >> which is much before start_kernel() -> setup_arch() is invoked. > So? > > snp_init() still runs before e820__memory_setup(). So what's stopping > you? As i have already explained above, snp_init() runs before e820__memory_setup() so we can't invoke this callback in snp_init() as e820 tables have still not been setup. Again to summarize, the e820 tables are setup in e820__memory_setup() which runs after snp_init(). Additionally, RMP table also get probed after snp_init(). So this callback cannot be invoked in snp_init(). I have added this comment to v3 of this patch series which i posted yesterday, so please look at those. Thanks, Ashish