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 X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MSGID_FROM_MTA_HEADER,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E0A6C636C9 for ; Tue, 20 Jul 2021 23:11:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05CF960FE7 for ; Tue, 20 Jul 2021 23:11:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232051AbhGTWaN (ORCPT ); Tue, 20 Jul 2021 18:30:13 -0400 Received: from mail-dm6nam10on2078.outbound.protection.outlook.com ([40.107.93.78]:24257 "EHLO NAM10-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232014AbhGTW3o (ORCPT ); Tue, 20 Jul 2021 18:29:44 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jKP6net69+u+F2uecVxUFhJ3LG222guGTvunsbGpq7C7EuAhcPAOv1Ol0ph6FxE2ZfDM6euVVdPjtj+dXFQb+LlzdMVIusixaK6BsJD1n6watU9HSj3C7i05O1J9azCcszAWhUYjJpaJ42eUzb5DNHtj3+18CM5XJNSU9t5e7sN2dYOTtrUvYc+n4w2LMXQXajw++43y22Iuyv0Ok5OBC1qD1l1gFwFKxdNFeYtBelNIgV+vnYWg6SRTF3Xyw89ijDSJ0QIg1S0L/To1z05Bk9PkHprsWfGBxal2uurb0gJ8XNBZebsYpmYHlPcFHOkZqFmImrtOVVzQWkG6RDSwTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=i9oJ19Tn4Ab3jpYZCXCjUOBMj3nYYJUJ/CXDsm5/ljc=; b=X+n3IYcO8sOf7/tQisgdr5hg9xYuQC4UmoQ43hTf3RscVQW+ffBO0SxMPsbymdqsUH+GlynNByyQd6De3957jlWS49Ntrg3FYwc5+7Y0MFQDNTrQDZfmrzdbeFQVeG4p8IBIqEvKFOtkBwQZFYDaCijXj2jdR0SultEW9EAqrWr5Rs9TkYbhvpomBHjP/QgRi4UHAtcZth+wYo7urpDhfjPPyx7edQPUQ4wSj9WW2lmjgG4dijmNCZ2kcjyW5PiAgjgVg5dcEGQuiebzTJ/qFx1ah13kPq7JwXZe80dqGo5iFAXwKG32vnW516ald6PVId4X9H+1yS+FTfoGtmuc8w== 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=i9oJ19Tn4Ab3jpYZCXCjUOBMj3nYYJUJ/CXDsm5/ljc=; b=U/9FA5QOiLl8UxMeJm+VVNoHP0ZhVeA4iL2j6BNL0KNvGYaVSROLlYuZsFW6mWGAgxoFG8sY4otzEwCwIitD4QoNaSY1DH+lmfcuA9BClPONHeTP7zKxULFSFmIiCq7qU1QMs5bxZcku0lwsAuumZSBXeC76g88QyDUR5CF08jU= Authentication-Results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=amd.com; Received: from SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) by SN6PR12MB2717.namprd12.prod.outlook.com (2603:10b6:805:68::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22; Tue, 20 Jul 2021 23:10:19 +0000 Received: from SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa]) by SN6PR12MB2718.namprd12.prod.outlook.com ([fe80::a8a9:2aac:4fd1:88fa%3]) with mapi id 15.20.4331.034; Tue, 20 Jul 2021 23:10:19 +0000 Cc: brijesh.singh@amd.com, x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-efi@vger.kernel.org, platform-driver-x86@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Joerg Roedel , Tom Lendacky , "H. Peter Anvin" , Ard Biesheuvel , Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Andy Lutomirski , Dave Hansen , Sergio Lopez , Peter Gonda , Peter Zijlstra , Srinivas Pandruvada , David Rientjes , Dov Murik , Tobin Feldman-Fitzthum , Borislav Petkov , Michael Roth , Vlastimil Babka , tony.luck@intel.com, npmccallum@redhat.com, brijesh.ksingh@gmail.com Subject: Re: [PATCH Part2 RFC v4 05/40] x86/sev: Add RMP entry lookup helpers To: Sean Christopherson References: <20210707183616.5620-1-brijesh.singh@amd.com> <20210707183616.5620-6-brijesh.singh@amd.com> <437a5230-64fc-64ab-9378-612c34e1b641@amd.com> <39be0f79-e8e4-fd4a-5c4a-47731c61740d@amd.com> From: Brijesh Singh Message-ID: Date: Tue, 20 Jul 2021 18:10:10 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-ClientProxiedBy: SN1PR12CA0099.namprd12.prod.outlook.com (2603:10b6:802:21::34) To SN6PR12MB2718.namprd12.prod.outlook.com (2603:10b6:805:6f::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from Brijeshs-MacBook-Pro.local (70.112.153.56) by SN1PR12CA0099.namprd12.prod.outlook.com (2603:10b6:802:21::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4331.22 via Frontend Transport; Tue, 20 Jul 2021 23:10:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e02d9f9c-b176-4688-d4e1-08d94bd38af9 X-MS-TrafficTypeDiagnostic: SN6PR12MB2717: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /oGGOXvaj8Y3/epKD7VQ3wWbV44L7QQ81kdDR/y9PUtZm3LOtSqz0Ubp8Luxi12ffpfPo2KZR998A+mmo+w7fUUmqk4gmYgD7owMRqUngC6ifAjsE0EyyL11Bh3al61ATVuCN7p9ZcQsrLAtm+t2Mj/frkw/JYocN9ZU2QsbmBda7Iyp+fFtARXHAPD1fsMrcDASxQAixiC/JzQd47dTw/s8kn2t6G1bJqmL1cjbTm3YfubgELRdtDUkc6zx8+IQ1UgRNy/2LXhKalIw0Ed7TM70qlI3yytSGFz9000PfPTSyD22dP3tg7R9B/H9u/tuYTZrUFX8/7eC9+RJdtrf/zYBmZk7hE9/543vlpE+iCqC2tRBZqaIJnZMZzYijobl3/AZIzfVgIGxt0LRzF00VW7P2qGy15+7eINv+FiKHwq++3mYC1v0KeHa+MAP+xq13oSTQJZhvwhWqSO7RUn38LudkbYa336IVA8xNhlIV7j6FbKwepFBkxXJDc37W6etXIFT5Gp1iyj7raFSAokWlkZi/97yMB/T2kWqRU6IbHBzpIEc4jv+rF6/dpRp6s3dazviFvUedGl5D7SNgvwflVhr7kiZRvp3UWz9KszvCzPYR/ulOjh1B7nt7wcdkYKSLTbTX132FfVEwMsXsHS0FRRuRRs9oec1leB3X3v0ZuxndPd1pSspeu8JIKyOU7urIwW4ZMEPO2HHdrmJXfgISTJ4CdWF6RUqM3v7ODd+4x+x2Q3JPSIlA2zlYs1HsJn6TexKLXerbH9UEqrOgbGbFw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR12MB2718.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(376002)(136003)(346002)(396003)(366004)(7416002)(6916009)(83380400001)(38100700002)(38350700002)(36756003)(8676002)(186003)(44832011)(31696002)(956004)(6512007)(6486002)(6506007)(86362001)(478600001)(53546011)(26005)(7406005)(2906002)(4326008)(66476007)(6666004)(66556008)(8936002)(31686004)(66946007)(316002)(52116002)(2616005)(5660300002)(54906003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cEo2dlVEWURXMVgrcXB6cS9CaUdlOWJFczJoWER2MXJaSXM3bC9sakRia2k2?= =?utf-8?B?M3ltUVgxZUxyRU5FYTlsVHBzalZlMWVyTW96R0JUc2dHM3R5MXJVM1RuTHl4?= =?utf-8?B?WE5YOEJDTEJFc2EvVWdEV09XRGhwODJMR05wZlZ2UEFFb3cybXpMbU5IUHE1?= =?utf-8?B?dzBNeXpUNVZhRndhTGhsSjFuRUs5YjR5Z1pYQUJmVWpYTnByb004MDdlVHVa?= =?utf-8?B?Z1dUMGd4Y3k5RXN5VnE1VjFwRnR3WHJ0RUh4T3pDSmtVTFdocUM0bUtsSzBZ?= =?utf-8?B?Wk5GNTd0QnhXekszV01XRkk4YW1CaURXb292TEhmS2xlZ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QlJnNGY0cmlsTVp3RkI1?= =?utf-8?B?Y1hBYWZMemd2QWtrMzJWTWdIZEU4c0FUWnlVSm5xUDlNT0hobytnWGpPM1BO?= =?utf-8?B?dXZaMXhpVi9sQkxSbTJxS3ZaWjY1L0gwQ05PaW5sWmV5OUl1enFneEcycG12?= =?utf-8?B?dmFiOUxjQ09WTmxMc200dTZkeTNWNWxiTE9Ub1BPV1pjNDRGcGpMakd2N0hm?= =?utf-8?B?SXJWb0s0ZE05ekhpeEJDNlRqbk9MUmdNbGVZeEMxUU1Qa0I5dFg5Z0h4dTlW?= =?utf-8?B?QUZraENTckdnV1llR1dlUnZQU3dQbklTciszQkZVV3NaVzJVVDlUd3p0WEJ1?= =?utf-8?B?NEtyZEZObnhucEw5dU9NV0xHV1NvOWI4bnc0MytOdzJMcURVME9WaklEaUEx?= =?utf-8?B?SWt5bWlwNktadDNPcE93RUFuVDNZNHBQa0xPOGh6Ny9aOWhqdFlHKzB4bTI3?= =?utf-8?B?b2FPc05xMjRITWZaSm9PZDdxbjh3MXBXVXZYYUFQMUJrMDJaSTMzVWhlSE5C?= =?utf-8?Q?675M9Ieaqq/lawywc9xoO0A4ANtllZ6j537FLFA?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: e02d9f9c-b176-4688-d4e1-08d94bd38af9 X-MS-Exchange-CrossTenant-AuthSource: SN6PR12MB2718.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2021 23:10:19.4315 (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: uiWBjpY6JxWM4YLQVtayoQztWtEllf1/VGzqytiXPtLXMLrwGPDzs9NYrdDgfQIi9unrmGs80RSSHTjQohlhuw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR12MB2717 Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org On 7/20/21 5:06 PM, Sean Christopherson wrote: > On Fri, Jul 16, 2021, Brijesh Singh wrote: >> On 7/15/21 2:28 PM, Brijesh Singh wrote: >>>> Looking at the future patches, dump_rmpentry() is the only power user, >>>> e.g. everything else mostly looks at "assigned" and "level" (and one >>>> ratelimited warn on "validated" in snp_make_page_shared(), but I suspect >>>> that particular check can and should be dropped). >>> Yes, we need "assigned" and "level" and other entries are mainly for >>> the debug purposes. >>> >> For the debug purposes, we would like to dump additional RMP entries. If >> we go with your proposed function then how do we get those information >> in the dump_rmpentry()? > As suggested below, move dump_rmpentry() into sev.c so that it can use the > microarchitectural version. For debug, I'm pretty that's what we'll want anyways, > e.g. dump the raw value along with the meaning of various bits. Based on other feedbacks, I am not sure if we need to dump the RMP entry;  In other feedback we agreed to unmap the pages from the direct map while adding them in the RMP table, so, if anyone attempts to access those pages they will now get the page-not-present instead of the RMP violation. thanks