From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 C9C7F3CC300; Tue, 30 Jun 2026 10:48:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782816493; cv=none; b=DLzoRXpxE0/1CXgnBcItcJbxQOxVArCz4tCkfylav2WjiqVfawcwJ+c+6K3WCmSdwJkRJEVk93rm6kR5BaA4coeaFMGNu12CNjoXlbxBlfGnE/vVh1daZrxNURBJ34x0MnLAEf+nlXnvvuYWoLrpTZCwl5aLWpwewiM4afvFyvY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782816493; c=relaxed/simple; bh=3lVVfc+fn9929mpQsDK3Jls66W7HEXpS9akiNi6RlX8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=jDk+AmUvFNPz7Kah+781Rf1dVgMv77V9mq58qYRwj3QQAFzqABVQmy80bJ4BFXQReSk9sdcLqo81lbAoA/pOBtsdFUgBoq4viTzPuBAySjfiF277+yW0r0JNFpuztUQLmp87Q2gKHQKgfsMla0FI+YGr9bhzWt/tO0UiqKYxSlM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JN2GhHEm; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JN2GhHEm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782816488; x=1814352488; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=3lVVfc+fn9929mpQsDK3Jls66W7HEXpS9akiNi6RlX8=; b=JN2GhHEm3Iq1QexMExqJSA2gl2eiUfleTFPEjiMbVm+lLNYC08wnAgLF Hz9xbCvh+6SbTfpLh7jcvNvQKodvCw8YmaB2AaaycqIWteII3Cl8RqtRY ioDv3FgFoDVVlOodlz0h1kzutap+0hkPfMsiaa4kf++NEiaM5K6T0oX9h Sq0MeBt5PBBH3JGRfshCythYMypkhq3Crm7WNlzTtUWY4uf9AsNL+YEYK ZbCijUWTUon43oHqlywVOhdIY7vwNXskyjjeXdCiTjc5/v/N0+Zdsxosx LuWaqOiXtXshEghRjDsqf8qyZmk2VECMCc9+P0F8vxADw5MRzDeENcQg1 w==; X-CSE-ConnectionGUID: YEVgwuhPSjaoVhBg+JP/sA== X-CSE-MsgGUID: W00ckU6NQya86JXVFSWODA== X-IronPort-AV: E=McAfee;i="6800,10657,11832"; a="106318231" X-IronPort-AV: E=Sophos;i="6.24,233,1774335600"; d="scan'208";a="106318231" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2026 03:48:07 -0700 X-CSE-ConnectionGUID: JBu/+lqkTGietoQsv+PEyg== X-CSE-MsgGUID: bIygpzouSBKb3G2R28LYWg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,233,1774335600"; d="scan'208";a="257141581" Received: from xiaoyaol-hp-g830.ccr.corp.intel.com (HELO [10.239.158.70]) ([10.239.158.70]) by fmviesa005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Jun 2026 03:47:54 -0700 Message-ID: <6b1f0c77-f059-4f8d-8f46-443b944c59a0@intel.com> Date: Tue, 30 Jun 2026 18:47:51 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 04/46] KVM: Decouple kvm_has_arch_private_mem from CONFIG_KVM_VM_MEMORY_ATTRIBUTES To: ackerleytng@google.com, aik@amd.com, andrew.jones@linux.dev, binbin.wu@linux.intel.com, brauner@kernel.org, chao.p.peng@linux.intel.com, david@kernel.org, jmattson@google.com, jthoughton@google.com, michael.roth@amd.com, oupton@kernel.org, pankaj.gupta@amd.com, qperret@google.com, rick.p.edgecombe@intel.com, rientjes@google.com, shivankg@amd.com, steven.price@arm.com, tabba@google.com, willy@infradead.org, wyihan@google.com, yan.y.zhao@intel.com, forkloop@google.com, pratyush@kernel.org, suzuki.poulose@arm.com, aneesh.kumar@kernel.org, liam@infradead.org, Paolo Bonzini , Sean Christopherson , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Jonathan Corbet , Shuah Khan , Shuah Khan , Vishal Annapurve , Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Youngjun Park , Qi Zheng , Shakeel Butt , Kiryl Shutsemau , Baoquan He , Jason Gunthorpe , Vlastimil Babka Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev References: <20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com> <20260618-gmem-inplace-conversion-v8-4-9d2959357853@google.com> Content-Language: en-US From: Xiaoyao Li In-Reply-To: <20260618-gmem-inplace-conversion-v8-4-9d2959357853@google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/19/2026 8:31 AM, Ackerley Tng via B4 Relay wrote: > From: Sean Christopherson > > When memory attributes become trackable in guest_memfd, the concept of > having private memory is no longer dependent on > CONFIG_KVM_VM_MEMORY_ATTRIBUTES. > > With this, on x86, kvm_arch_has_private_mem() is defined if some CoCo > platform support (or the testing CONFIG_KVM_SW_PROTECTED_VM) is compiled > in. > > Signed-off-by: Sean Christopherson > Co-developed-by: Ackerley Tng > Signed-off-by: Ackerley Tng Reviewed-by: Xiaoyao Li > --- > arch/x86/include/asm/kvm_host.h | 4 +++- > include/linux/kvm_host.h | 2 +- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h > index 8e8eb8a5e8a6b..1bde67cf6eb0e 100644 > --- a/arch/x86/include/asm/kvm_host.h > +++ b/arch/x86/include/asm/kvm_host.h > @@ -2394,7 +2394,9 @@ void kvm_configure_mmu(bool enable_tdp, int tdp_forced_root_level, > int tdp_max_root_level, int tdp_huge_page_level); > > > -#ifdef CONFIG_KVM_VM_MEMORY_ATTRIBUTES > +#if defined(CONFIG_KVM_SW_PROTECTED_VM) || \ > + defined(CONFIG_KVM_INTEL_TDX) || \ > + defined(CONFIG_KVM_AMD_SEV) Maybe we can just remove the #ifdef and make it always avaiable? > #define kvm_arch_has_private_mem(kvm) ((kvm)->arch.has_private_mem) > #endif > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > index 201d0f2143976..d370e834d619e 100644 > --- a/include/linux/kvm_host.h > +++ b/include/linux/kvm_host.h > @@ -722,7 +722,7 @@ static inline int kvm_arch_vcpu_memslots_id(struct kvm_vcpu *vcpu) > } > #endif > > -#ifndef CONFIG_KVM_VM_MEMORY_ATTRIBUTES > +#ifndef kvm_arch_has_private_mem > static inline bool kvm_arch_has_private_mem(struct kvm *kvm) > { > return false; >