From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3BDF21A6829; Fri, 19 Jun 2026 00:31:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781829107; cv=none; b=OyjwJAY3Yko5hVeYV3uUQrSx8TUwu3EXFeWlutFbnY3bEgj7dRHnBb9dZxCRfTpRmtnyGCRkYqcekhtUKpoEPUI9/h+elaEzQrm38wqlHztB+bmlOpbotfYrE87z2WuPF7BH2qpwWjE1Z+KZ9wiDs8R9MRtrFUlUq5SXE630sLk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781829107; c=relaxed/simple; bh=Vzp8jCq3+1E3fkxWdqNXAg0Z9BLe9ZDYrsSr1hV0TRo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kuGv5kqPvtBOKJbM+39ZUxK526tjQm+0Ku/hKAIaKhIzRWDoTiNqLEh3KlqP/abF//eMlowwRh4uzd1Qfo9DaTBLow7WvQzajK4h8cip5me3FQK+Or3NqjGG4Xm1siTxoipar5JBW1A0JMs/oBJWo5bluHeYOWL55IkJH+4aBAM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=caQZvpze; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="caQZvpze" Received: by smtp.kernel.org (Postfix) with ESMTPS id 136E0C4AF19; Fri, 19 Jun 2026 00:31:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1781829107; bh=Vzp8jCq3+1E3fkxWdqNXAg0Z9BLe9ZDYrsSr1hV0TRo=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=caQZvpzecHz3OPxTB++VuZXF3fiyH30Fbme0bJas42luPEQ47VOTOMYFqb6o9dmGu Ikw+prrV6Qhwv6xvWnlhvlSHzM4ygr/RbEi8J+8kvy4+gYqUz3ueVxdZfAlPvmFElU euQHYy0GvsFQ5xHxnrJaOxgKRAoMCvyGdUDQ9JGA0QErIbQNs3izpHISditJeuKSym vpdJrrPifRxm93o3cumFetsG6Vh/S4zVv3P9L52J+BIn1ADli5pKrttUqB6JX1VdVt HrF0hoGHr7WTnAAKD9uBkuvMCh6OK/yYRFAaPsy9ijFu9XIKuaOvu8NRNcUZgg4bup 0askpqMceB2vQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 063DACD98F0; Fri, 19 Jun 2026 00:31:47 +0000 (UTC) From: Ackerley Tng via B4 Relay Date: Thu, 18 Jun 2026 17:31:41 -0700 Subject: [PATCH v8 04/46] KVM: Decouple kvm_has_arch_private_mem from CONFIG_KVM_VM_MEMORY_ATTRIBUTES Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260618-gmem-inplace-conversion-v8-4-9d2959357853@google.com> References: <20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com> In-Reply-To: <20260618-gmem-inplace-conversion-v8-0-9d2959357853@google.com> To: 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 , Baoquan He 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, Ackerley Tng X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1781829104; l=1692; i=ackerleytng@google.com; s=20260225; h=from:subject:message-id; bh=tPtTsemV3L/BlyDiwtBhiyBvhPxEc3sDZeI948QYhU0=; b=ZOXkVSHaCuMVMkipqLWNhWP1iE87BlVmktp2ZHK+axSNIceX1lSRF0iJBTpQp8efKYl4ZRk9a Ur1GXUZIcQeC6GUzzCDt/JZ3Fmdip/T5fngRW20wYeUkB8SH2S68e3B X-Developer-Key: i=ackerleytng@google.com; a=ed25519; pk=sAZDYXdm6Iz8FHitpHeFlCMXwabodTm7p8/3/8xUxuU= X-Endpoint-Received: by B4 Relay for ackerleytng@google.com/20260225 with auth_id=649 X-Original-From: Ackerley Tng Reply-To: ackerleytng@google.com 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 --- 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) #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; -- 2.55.0.rc0.738.g0c8ab3ebcc-goog