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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6ADBAC433FE for ; Mon, 17 Oct 2022 22:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229597AbiJQWRx (ORCPT ); Mon, 17 Oct 2022 18:17:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229603AbiJQWRv (ORCPT ); Mon, 17 Oct 2022 18:17:51 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6209271994 for ; Mon, 17 Oct 2022 15:17:50 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id t10-20020a17090a4e4a00b0020af4bcae10so12242648pjl.3 for ; Mon, 17 Oct 2022 15:17:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=Pa9UF6Hi2q1b744+/zFgnMjVA7j2pgI5ymLqfYIjscYUAYCF5ZXYRaOr8OH7B7Xd9F /HznXiV0rMC5mH6t0PX9UTIUMnvfTMra5P8j8/Err3N0tWueZMfcGzGtxNdF72RRSt7o NHpkNbOoj5ABhkcBEje6If6JGJVChr/yUqpTjUi6oHUQYtvQcn2Qq0A0mMJRwm7jwCpU txbpSRtq6Deb3lMYIB2V2HXjwUD/dBV3FD8oYF4YSQczKnAO+mdCYqOZu/+92E+l+c3z qnP5v2XAfcbbMH4rprLDtpkgxOqarwr2vDP6sOEKWp3p6bnA4ZtbMgRsXFz+JSka9OPZ iKaQ== 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:subject:date :message-id:reply-to; bh=TrR1U1OdGGBTNU+L/j5+q/HQQR5gcpgDZtfvTOOBt0M=; b=fc7ejljla7ZOfcBg0sGxUiWH4tO6Rm05uhaxghoz6A0lB9tcT5bT2SgOGBbbrfN/sL qUCIWHQzZRDMqaoArktDWS5NQR/Nmc5aRhZBCD4K6lR0sCcRj8vU4IwQkuY4dEjPlYtn IAuJjZZBzyuhGMj9aSe1KGf44DHPWOckeGyb11lKJuw7vmID8M76nCOEUMh/jwBGWTzI 0wDUkgmQWVDkbAe9o9viPSK4Jb0la4on93ODMG2nGDPD0bjo6NKRGQcA6NajByoMg5Dq RB2LcKVltQ+BBWhBlLWr5qiEeVGmdjgmHoj8M4WBSrj9gYLXMflvQgqeyOLrZBWvfa33 cVQA== X-Gm-Message-State: ACrzQf3e9ovaB6XnuzihKN8uxlBeYnDTRrLhH1lXOXo4BpjxWh9fw99j sz2D5pztVv/+yp1zK88U+msMf+88/Q9rlA== X-Google-Smtp-Source: AMsMyM5sOws5M1E82UjbITIFno8w/HG4mdjtUwGqdWDsxnzcg+d5uvozuCFcCUl9QhNTIh10tM+Etg== X-Received: by 2002:a17:903:1c2:b0:185:47ce:f4d2 with SMTP id e2-20020a17090301c200b0018547cef4d2mr14097565plh.101.1666045069741; Mon, 17 Oct 2022 15:17:49 -0700 (PDT) Received: from google.com (7.104.168.34.bc.googleusercontent.com. [34.168.104.7]) by smtp.gmail.com with ESMTPSA id p13-20020a17090a74cd00b0020ad46d277bsm9992889pjl.42.2022.10.17.15.17.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 15:17:49 -0700 (PDT) Date: Mon, 17 Oct 2022 22:17:45 +0000 From: Sean Christopherson To: Fuad Tabba Cc: Chao Peng , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, qemu-devel@nongnu.org, 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 , "Kirill A . Shutemov" , 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 , Michael Roth , mhocko@suse.com, Muchun Song , wei.w.wang@intel.com Subject: Re: [PATCH v8 5/8] KVM: Register/unregister the guest private memory regions Message-ID: References: <20220915142913.2213336-1-chao.p.peng@linux.intel.com> <20220915142913.2213336-6-chao.p.peng@linux.intel.com> <20221012023516.GA3218049@chaop.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-api@vger.kernel.org On Mon, Oct 17, 2022, Fuad Tabba wrote: > Hi, > > > > > +#ifdef CONFIG_HAVE_KVM_PRIVATE_MEM > > > > +#define KVM_MEM_ATTR_SHARED 0x0001 > > > > +static int kvm_vm_ioctl_set_mem_attr(struct kvm *kvm, gpa_t gpa, gpa_t size, > > > > + bool is_private) > > > > +{ > > > > > > I wonder if this ioctl should be implemented as an arch-specific > > > ioctl. In this patch it performs some actions that pKVM might not need > > > or might want to do differently. > > > > I think it's doable. We can provide the mem_attr_array kind thing in > > common code and let arch code decide to use it or not. Currently > > mem_attr_array is defined in the struct kvm, if those bytes are > > unnecessary for pKVM it can even be moved to arch definition, but that > > also loses the potential code sharing for confidential usages in other > > non-architectures, e.g. if ARM also supports such usage. Or it can be > > provided through a different CONFIG_ instead of > > CONFIG_HAVE_KVM_PRIVATE_MEM. > > This sounds good. Thank you. I like the idea of a separate Kconfig, e.g. CONFIG_KVM_GENERIC_PRIVATE_MEM or something. I highly doubt there will be any non-x86 users for multiple years, if ever, but it would allow testing the private memory stuff on ARM (and any other non-x86 arch) without needing full pKVM support and with only minor KVM modifications, e.g. the x86 support[*] to test UPM without TDX is shaping up to be trivial. [*] https://lore.kernel.org/all/Y0mu1FKugNQG5T8K@google.com