Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2863225rwb; Mon, 16 Jan 2023 00:00:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXtG7Ut1droDz2vaSwiN8E9i0LVx7tcPSoIxFGxLS5HHXLuw9ev+9KmhjqDSVlmMgyrIMi34 X-Received: by 2002:a05:6a20:cc41:b0:b1:f593:e738 with SMTP id hq1-20020a056a20cc4100b000b1f593e738mr89080634pzb.28.1673856028542; Mon, 16 Jan 2023 00:00:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673856028; cv=pass; d=google.com; s=arc-20160816; b=T2KUeiC462ZVpxvOcWGbWdj30yUzHRqpIdoGJ16nxTuVyxEIzfeSAdlPSPCpGh5VgU Rh33QLyrmIf0zRuqyj29o8Z5ahWovw9r2T+7OMyLvD1ohdZsjInBLBnob1ACTV9AsPgV /1Y3He7q9oihcIT4F/vFnGgXtuo7a9LMkrIo+FrXfpCK4P1qRxs7yy/5CWkmpkD8GXgk WHZ6/h9VK1hs4Wy0CfxtL4u8WTE9RE7BNXluyIG6upIqk5uCIztvCJjGAIBUt2z+HGjp yvpwtA0BIQEhRXTd20vA+5vX8au8RKOKWR7dlUntPU23P31x56oOmdpq+KISd0SZ4Xjj ZUBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=NW6njqAsEPYeRJh2kj8dx8+Rq3/ng4T35lcB/RbAxoE=; b=gafc/rcwBVfFfu83veQm9ZHERblpprzVG5Pxaigy4Y6lqxjqrZFFDDrPHle9KklCFF sNcBvCygcnsAj0HdjOUmqCXhC3bQ6+/RtUguKjmp8IMyjPLoqIUsrEp7ovMgljlDnBE/ XEieHU45dqKgU+mkKRNyLUeg0dkz+jLfKcc53E4gWwxgtE2lcLsUC74tADSIUNTNcsHM 3UJjtXPezeAJuTFC50Wph+cR3b8r2VT85eXSczgBp/dzS5n0v3AHp9p30Ta9hWi6/L8X IJgRpXazB0NzkZ8oqpFDgv0psJH5qO53frjZgnekiqei8IrI6rW8iinw9CMelm/LCv42 LgOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=m5reoDZu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d11-20020a056a00244b00b0057f8d82dda4si28916829pfj.218.2023.01.16.00.00.12; Mon, 16 Jan 2023 00:00:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=m5reoDZu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232021AbjAPH4b (ORCPT + 99 others); Mon, 16 Jan 2023 02:56:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbjAPH4a (ORCPT ); Mon, 16 Jan 2023 02:56:30 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B069E8691; Sun, 15 Jan 2023 23:56:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dpVo7iopzZdeeAyl6FVbMXQPU0wDD7rORdRTbyaGoUSUwVNDEKQEwW/dOG7gY6FmudSIZBfl9yj+4oHvpr0g4h6Qsy/OzTWUA1O5139WV4v2pLmijBBHWxNyYpYKotTaskqxEbICQPGyUth8C+tuRr+tObU2C8NeVN0kjYqsxPN77pq+bZiLd2r2bbXwxdGygUS/J8MIyVxc6s6EOjqtVqOKWvNNHkZ22OiLn9dKTMYsAPwCiU5Sg28VxX/XoZKdfXyhRcwV8jPrdwHFqPkKVByMghpn1Nijj0SQrzJXF2IPF6xTCyb0h3r1EolX4r/FOjPFvlFvRSikwBhrr4lyOw== 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=NW6njqAsEPYeRJh2kj8dx8+Rq3/ng4T35lcB/RbAxoE=; b=Ep31T8eKt1mqmUepPMLVPCZ6Pp+Az6CRCx4gqtvjZXMxREMQSgJa3sZQD22DXwAKAxFbJshrV1Tr3/wN7PEz/LYMtjMnrOTVNAu1RmfvOfKEzZfOpviXspjSLxBLjv2xUEUQbd4AW2PoXWY0gmc1tloz+D3nBVbMCzGr1a8PqJWebQCr4L+1Uy3LKAkxgu2CIGyBO1QJy1bwA6duIkgN0OsTCz6clOAnvFVXXgygWFVd4CZlqfpLhypcamfLa8H0NRaV/SHpl+JWkihYnvJjE9A1v8GnVu+sUjFFlx5a7qPafa3tfFcrfjA88ecH7Dia+qvoI8Lm6YbsuY6LkAaIYg== 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=NW6njqAsEPYeRJh2kj8dx8+Rq3/ng4T35lcB/RbAxoE=; b=m5reoDZuJAxXtKuSmTwwBdehM/IRz06jNpY2eXZjSakcyzdvgGn9hXRWG/938aUOcMSuNLgzN6ydySXTo1hOSZXLV4uvMFncbh2sGOTMfSNQF1SYly0qpMIzwDgp1Orh5+/4ezGZwpTNejP+FFE4ip/xsKhoVX25DoWKPQ7dzF8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) by IA0PR12MB8278.namprd12.prod.outlook.com (2603:10b6:208:3dc::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.22; Mon, 16 Jan 2023 07:56:25 +0000 Received: from DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::8079:86db:f2e5:7700]) by DS7PR12MB6309.namprd12.prod.outlook.com ([fe80::8079:86db:f2e5:7700%6]) with mapi id 15.20.5986.018; Mon, 16 Jan 2023 07:56:24 +0000 Message-ID: <460524f8-e52b-e195-3bd2-27e41f367f5d@amd.com> Date: Mon, 16 Jan 2023 13:26:02 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH RFC v7 07/64] KVM: SEV: Handle KVM_HC_MAP_GPA_RANGE hypercall Content-Language: en-US To: Sean Christopherson , Borislav Petkov Cc: Michael Roth , kvm@vger.kernel.org, linux-coco@lists.linux.dev, linux-mm@kvack.org, linux-crypto@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@redhat.com, jroedel@suse.de, thomas.lendacky@amd.com, hpa@zytor.com, ardb@kernel.org, pbonzini@redhat.com, vkuznets@redhat.com, wanpengli@tencent.com, jmattson@google.com, luto@kernel.org, dave.hansen@linux.intel.com, slp@redhat.com, pgonda@google.com, peterz@infradead.org, srinivas.pandruvada@linux.intel.com, rientjes@google.com, dovmurik@linux.ibm.com, tobin@ibm.com, vbabka@suse.cz, kirill@shutemov.name, ak@linux.intel.com, tony.luck@intel.com, marcorr@google.com, sathyanarayanan.kuppuswamy@linux.intel.com, alpergun@google.com, dgilbert@redhat.com, jarkko@kernel.org, ashish.kalra@amd.com, harald@profian.com References: <20221214194056.161492-1-michael.roth@amd.com> <20221214194056.161492-8-michael.roth@amd.com> From: "Nikunj A. Dadhania" In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN3PR01CA0049.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:98::12) To DS7PR12MB6309.namprd12.prod.outlook.com (2603:10b6:8:96::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB6309:EE_|IA0PR12MB8278:EE_ X-MS-Office365-Filtering-Correlation-Id: adf13bbf-e61f-4ca9-54bc-08daf7972a14 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FUgM5yEfDef0+M5hc2lNQrySfuaevZsU6pDbkiw65H4D9jpIQlHmV55N8MbS21ZV8f4gDYkvE3jFeqG+yE8FDDw6VLHcDzkpbS2cFZBjqEfokTR45LkEwr35ohiqr53OhWWFbhZr4Qn5eC0m7CubOeN8Hb11cz3dklxcFhRf8al2rhPz3Esn16OPjNwPPGpZiyTjwVlNaDdhGzp6JrhLG9LGZ3VhF6gJ2UPaUfxDodN5sevGlf5dbZd2jF1L4drLTy6ysjOk1jZmmiVPvEP860WjD3XrL6EFAOQVk1xWqQv+kVF4NNJjLgErqAHaSc6haN12ySY9KNetKn9ELz+3EASLTFlEdIpmXmMK3f+MZNnPYTtyqP4lRuhOC3ZH8c6fZDKy+jKbdnj6mQ8rSXsGitd9oQo+SnrZDEBUVEv4h329WNSOJL98MpB9LdPGOZX5thCdh7iBk88O/OJcFDOaFaecaJKXhsEO4+q/EVO/YTz8FFTgxjfltZuWx0nLTTeiJ+CNxyrACnS82++6VMW7GLvf88Y9GKpOF4khjlKBTmRVnoPDOLluu8sVipu7RpHnK7ws7oC57I2gjBoMvimrjqti9GUosAPD0wHzbztLT1HDx8fS8hIsRc8mu3OeKGYCS40dXfmht5thyarsVAYnYCBrS/eQdaYNZaY3+T2fhaq+zDMWWnNsmSo5yHYpGtcLaTxQiWv+6TWOj9PQ4N8Wd5ug6IjU+2djzpT8aNvJahY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB6309.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(376002)(396003)(136003)(346002)(366004)(451199015)(2616005)(8676002)(4326008)(26005)(186003)(6512007)(66476007)(66556008)(31686004)(66946007)(110136005)(478600001)(41300700001)(8936002)(7416002)(5660300002)(7406005)(6666004)(2906002)(83380400001)(53546011)(316002)(6506007)(38100700002)(31696002)(6486002)(36756003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?RFJVOU4ycXdpVktzaVlXTXExWW9xYTZGeHg5YzZrZ0tWMHJvVDFqK1JzWUx2?= =?utf-8?B?Z1oxdUZYZUhiSVRLVjRibUo3T2QzZExtTjJmT3ZGZnBTY0xDR25pMUNObldk?= =?utf-8?B?QUxnY0RjS2M1enlpbWVJNHNRZ2tFbnoxa3lPMG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ZiOEZOc1JZMldtQUk3c2M1ZjlWQWllRFpXSnhN?= =?utf-8?B?d3drem8xQXBrY1ZGRnUzQkxhUC9pd2VpbVJDaVdVRWZlVkFXSm5KWkdvUkgy?= =?utf-8?B?VmViZ2o2dWttRGdJRTlISk10TkticVRzZHhUS25IRlprUGl0eVExUDB1NGxL?= =?utf-8?Q?kMV4q9TSWOEvqWgBaTe/nLEsu?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: adf13bbf-e61f-4ca9-54bc-08daf7972a14 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB6309.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jan 2023 07:56:24.6944 (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: K/NeX47rgO1c5exW0eV+Alf84/ReLXOK292cLw1tRIhI4QTIg+HDDrVa66MAlPmc9wPEcsVQqINN4dDs1fSihA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8278 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On 13/01/23 21:47, Sean Christopherson wrote: > On Fri, Jan 13, 2023, Borislav Petkov wrote: >> On Wed, Dec 14, 2022 at 01:39:59PM -0600, Michael Roth wrote: >>> From: Nikunj A Dadhania >>> >>> KVM_HC_MAP_GPA_RANGE hypercall is used by the SEV guest to notify a >>> change in the page encryption status to the hypervisor. >>> >>> The hypercall exits to userspace with KVM_EXIT_HYPERCALL exit code, >>> currently this is used for explicit memory conversion between >>> shared/private for memfd based private memory. >> >> So Tom and I spent a while to figure out what this is doing... >> >> Please explain in more detail what that is. Like the hypercall gets ignored for >> memslots which cannot be private...? This was required when we were using per memslot bitmap for storing the private information, mem_attr_array is not dependent on memslot anymore. > > Don't bother, just drop the patch. Agree, we can drop this. I have tested SEV without this patch. > It's perfectly legal for userspace to create the private memslot in response > to a guest request. Sean, did not understand this part, how could a memslot be created on a guest request? Regards Nikunj