Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2993570rwa; Mon, 22 Aug 2022 18:42:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR6lUMBnCN0ZRZ/NdlxDUToIY/JsTzfYu4pxxNuF1sAKRpLH5XIzLfPd7nCwlPW0adntCYGy X-Received: by 2002:a65:60d4:0:b0:419:9871:9cf with SMTP id r20-20020a6560d4000000b00419987109cfmr19077444pgv.214.1661218921871; Mon, 22 Aug 2022 18:42:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661218921; cv=none; d=google.com; s=arc-20160816; b=T1lyLwuM9aEX/MAl7v/4fO+QeHjLYHUIsiOdjzr4RT4ktB/IR/NVZVyVW2b6FTvTOW iS24hIeyf6ydikwGTFZx2FgF8ikiDHkBkyVhYlC2xrccICT9+uaC7kzNr8FzV+zxHT9E KayXVJaCSk5g0PvIs2dpmOCLu1cq/Amf2v0dy0iJR58+EmRNc9OP/sir5vTGpBpmBdrC vsQEbxoY9oEPzStxxjqjdWayyjQh5yz9FEl0hS85XBo1zINYoedS4r6xTuivEUmC+Wb6 IchM79nqGl78fWWcT7Jo42Klis6FALuXlOK91mwS0E8gUGu5ak3y4DeXmslbrUKGY3AT axkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zUw74NM1PF7THinMe6GlF9fUaFjzhhz/u/PvpW+nALE=; b=lvozzHIIYwHXWxVI1813fSHQBV/J0yUhmzXA32O20zdgkff42GrYYwJGHHfzeDFXvC egvl1pHCc+9Xy/ZNlUVjqZNcU/DKxLD+vgx+GwaElimXP95MwKBQ0Dpc7Ktj1KjEB9Wh q2Q4K9Nlwoa7G8KqnQdQwgowmryu2qIQOVcTnL6kgfpPCTKKPa+86n6u+Yxy1NWnMxDv XLCLvBjWnvDdu1K29SFW7sd9gLPpcdx+exlZX/4Uaj2AWJnPNi5cSJBvFhkB0kL5la8b /YdG+rBHRYX56TzumtgEZNzUd3Qn7Weyb/v8C1Kj0JSrREWFVGl7aqiQj8+PwMgPFz4s 350A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Q64HD9Fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k8-20020aa788c8000000b0052f60f7e0a1si15605728pff.5.2022.08.22.18.41.50; Mon, 22 Aug 2022 18:42:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20210112 header.b=Q64HD9Fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238994AbiHWBZt (ORCPT + 99 others); Mon, 22 Aug 2022 21:25:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233491AbiHWBZq (ORCPT ); Mon, 22 Aug 2022 21:25:46 -0400 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8938857E12; Mon, 22 Aug 2022 18:25:44 -0700 (PDT) Received: by mail-pj1-x102f.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so13126902pjf.2; Mon, 22 Aug 2022 18:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=zUw74NM1PF7THinMe6GlF9fUaFjzhhz/u/PvpW+nALE=; b=Q64HD9FubVrlP5FmJOhxKQUOt96oa1y4u811xQjDNizh82sETFqtDd7YBhlyq7Fdxb rLbPDmVH9HGNC5K/UDeLYv14kfMyzYjVa50MOJ3QGeHCfs4+qrFqcTtzZArm4uraIU/C Nvrv9grRvmRE9oXrd0tzcZWKDezpB1lWXwmfxeu/1emkEXRpVPM/7arbKBomI1miyiS1 hy+2xHiijPE8GCpoe5wjF/dscpP7+aowXMXjkAsfFbEH43jZ108/WVH0r9AZlzcMQqx9 hVVjlHJU7iqLQKQKcheYNF9PR/qe1ORY2lIlJGzxRCAvGY1+/1jjiSLaSTUkLSyqVi90 uW+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=zUw74NM1PF7THinMe6GlF9fUaFjzhhz/u/PvpW+nALE=; b=Xwicifs0XYamrE5uEXARQ0O+rvs9DfdwfuznrzftFxPvmxE5c/sZtC6SWIC4P5D+x+ t2wugjjIguIzAB6qkyx0d/kX5Nv7s/bv9ZhBLWh0WL+FaWLZsd9TKMkSkKCfJXjqILUC mES1anJuno4CTHQhwiQJqmm8uxQ34OxeJL1i2jTU+5dIIf3HawhI878QJavcM8OCmHCo Txo8Xctnf9uOZdKrN+UYfjwtQStLPwnCL+rr8hvm04NVEcbH8XzmS8seICuhOJfCwSWz aT+gqayCn5EXzpfe3YBB8Ca/etcqI6byfylLm/D5twU9Ma/nbLMt6RvnA+XCLMRdcqvL 15KA== X-Gm-Message-State: ACgBeo0yAtxRa+c7WmLpG4AdzoOIzDG3JvRHY98EM1KoJSK8FBAZofZb Zerx4sPtVH/dAjJx2zhbyyg= X-Received: by 2002:a17:902:9886:b0:172:bb36:70f1 with SMTP id s6-20020a170902988600b00172bb3670f1mr21126201plp.139.1661217943863; Mon, 22 Aug 2022 18:25:43 -0700 (PDT) Received: from localhost ([192.55.55.51]) by smtp.gmail.com with ESMTPSA id d10-20020a17090ab30a00b001fb53587166sm1055886pjr.28.2022.08.22.18.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 18:25:43 -0700 (PDT) Date: Mon, 22 Aug 2022 18:25:41 -0700 From: Isaku Yamahata To: Michael Roth Cc: Sean Christopherson , "Gupta, Pankaj" , "Kirill A . Shutemov" , Chao Peng , "Nikunj A. Dadhania" , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H . Peter Anvin" , Hugh Dickins , Jeff Layton , "J . Bruce Fields" , Andrew Morton , Shuah Khan , Mike Rapoport , Steven Price , "Maciej S . Szmigiero" , Vlastimil Babka , Vishal Annapurve , Yu Zhang , luto@kernel.org, jun.nakajima@intel.com, dave.hansen@intel.com, ak@linux.intel.com, david@redhat.com, aarcange@redhat.com, ddutile@redhat.com, dhildenb@redhat.com, Quentin Perret , mhocko@suse.com, Muchun Song , bharata@amd.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, linux-fsdevel@vger.kernel.org, isaku.yamahata@gmail.com Subject: Re: [PATCH v7 00/14] KVM: mm: fd-based approach for supporting KVM guest private memory Message-ID: <20220823012541.GA2147148@ls.amr.corp.intel.com> References: <422b9f97-fdf5-54bf-6c56-3c45eff5e174@amd.com> <1407c70c-0c0b-6955-10bb-d44c5928f2d9@amd.com> <1136925c-2e37-6af4-acac-be8bed9f6ed5@amd.com> <1b02db9d-f2f1-94dd-6f37-59481525abff@amd.com> <20220815130411.GA1073443@chaop.bj.intel.com> <20220816122457.2fjyd4uz5hp5cani@box.shutemov.name> <20220817152719.g7pgu34syekzkha5@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220817152719.g7pgu34syekzkha5@amd.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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-kernel@vger.kernel.org On Wed, Aug 17, 2022 at 10:27:19AM -0500, Michael Roth wrote: > > I think the best approach is to turn KVM_TDX_INIT_MEM_REGION into a generic > > vCPU-scoped ioctl() that allows userspace to pre-map guest memory. Supporting > > initializing guest private memory with a source page can be implemented via a > > flag. That also gives KVM line of sight to in-place "conversion", e.g. another > > flag could be added to say that the dest is also the source. > > So is this proposed ioctl only intended to handle the initial encrypted > payload, and the KVM_MEMORY_ENCRYPT_{REG,UNREG}_REGION ioctls would > still be used for conversions post-boot? Yes. It is called before running any vcpu. At run time (after running vcpus), KVM_MEMORY_ENCRYPT_{REG,UNREG}_REGION is used. -- Isaku Yamahata