From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 35CC7349CEF; Fri, 22 May 2026 16:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779467478; cv=none; b=DgSHe9aoF+p0njiLuLbscDKAc0UTXa302OFGp3xVgtxuGvLjWhDGKqcqKa8Jp79Fpfcz04H5zG04juu6AdckEAo4SXcHJw0s9/Li87mtH74aAJj8iU2BF1nqKxjgmL5UGH2JMjx1ymJfGt+menPaaCFOSzEsVX4qpx06c9TsAWE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779467478; c=relaxed/simple; bh=VuAtt/dzcCHHVMTS0n782wqgyTVqh4zXwzgIZIAF7Y4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g7KieLRw2gU37dYRLEohbiIbL5peIkeYt5eTRkpRTqcmlHDGTgED2BrupZwCSrpRWhkEDg/89cO+ObnWS3nyEOcIHj6mO2Ntv8v3gG8xbJtExkQVYioNRErz6HWguSbIgF8T6El3T/xYixv+AA4cmG+dwvMNNS2FiuVmOw6Sp7w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DdvrwjlG; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DdvrwjlG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C151F00ADF; Fri, 22 May 2026 16:31:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1779467477; bh=HBXpcrPNB6FEMfdVb7HY+3OOgzcnnLTD6v4nZT5urYo=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=DdvrwjlGN7zLfUbDOXn8o047nIg+D3jyS5hlbUHMz0OE9EDYdbjjO2v4d4Xf3jSwT Oova6a0RmRKwW+WvXR0n2bQr5VK/lCaqVioc/AG/K/kdIFgWsqe2PEDOXSTJUxz0he YVk3cWXiH+v6bS/iOtK8HeiI/XriO2X7HrJDGvjn4Ir8D/47M4K1neTQNiHKQ2nb0h l5EiTx4c0KxBGg9CQGfCRbHznnhXfBBPtokYODcXXPsMWd9GDxRQa9EI6kR1mCIBW0 dCLIeMWSp5b6DAw0IKAoWkgDQ+nPwWUWHFll72kaqepOMjUc7ojPkdA3e+U0ovifbb y3BpsnRW3uVhg== Received: from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43]) by mailfauth.phl.internal (Postfix) with ESMTP id 9FC22F4007D; Fri, 22 May 2026 12:31:15 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-03.internal (MEProxy); Fri, 22 May 2026 12:31:15 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduhedtieehucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepmfhirhihlhcu ufhhuhhtshgvmhgruhcuoehkrghssehkvghrnhgvlhdrohhrgheqnecuggftrfgrthhtvg hrnhepffffkeegffejgfekvdejgeegtddtleejkefhhfduieduhfeigfduuefghfehffdu necuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehkihhrihhllhdomhgvshhmthhprghuthhhphgv rhhsohhnrghlihhthidqudeiudduiedvieehhedqvdekgeeggeejvdekqdhkrghspeepkh gvrhhnvghlrdhorhhgsehshhhuthgvmhhovhdrnhgrmhgvpdhnsggprhgtphhtthhopeeg tddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohephigrnhdrhidriihhrghosehinh htvghlrdgtohhmpdhrtghpthhtohepuggrvhgvrdhhrghnshgvnheslhhinhhugidrihhn thgvlhdrtghomhdprhgtphhtthhopehpsghonhiiihhnihesrhgvughhrghtrdgtohhmpd hrtghpthhtohepshgvrghnjhgtsehgohhoghhlvgdrtghomhdprhgtphhtthhopehtghhl gieskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepmhhinhhgohesrhgvughhrghtrdgtoh hmpdhrtghpthhtohepsghpsegrlhhivghnkedruggvpdhrtghpthhtohepgiekieeskhgv rhhnvghlrdhorhhgpdhrtghpthhtoheplhhinhhugidqkhgvrhhnvghlsehvghgvrhdrkh gvrhhnvghlrdhorhhg X-ME-Proxy: Feedback-ID: i10464835:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 May 2026 12:31:13 -0400 (EDT) Date: Fri, 22 May 2026 17:31:08 +0100 From: Kiryl Shutsemau To: Yan Zhao Cc: dave.hansen@linux.intel.com, pbonzini@redhat.com, seanjc@google.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, x86@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-coco@lists.linux.dev, kai.huang@intel.com, rick.p.edgecombe@intel.com, yilun.xu@linux.intel.com, vannapurve@google.com, ackerleytng@google.com, sagis@google.com, binbin.wu@linux.intel.com, xiaoyao.li@intel.com, isaku.yamahata@intel.com Subject: Re: [PATCH v2 1/4] x86/tdx: Use PFN directly for mapping guest private memory Message-ID: References: <20260430014852.24183-1-yan.y.zhao@intel.com> <20260430014929.24210-1-yan.y.zhao@intel.com> Precedence: bulk X-Mailing-List: linux-coco@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260430014929.24210-1-yan.y.zhao@intel.com> On Thu, Apr 30, 2026 at 09:49:29AM +0800, Yan Zhao wrote: > From: Sean Christopherson > > Remove struct page assumptions/constraints in the SEAMCALL wrapper APIs for > mapping guest private memory and have them take PFN directly. > > Having core TDX make assumptions that guest private memory must be backed > by struct page (and/or folio) will create subtle dependencies on how > KVM/guest_memfd allocates/manages memory (e.g., whether it uses memory > allocated from core MM, if the memory is refcounted, or if the folio is > split) that are easily avoided. [1]. > > KVM's MMUs work with PFNs. This is very much an intentional design choice. > It ensures that the KVM MMUs remain flexible and are not too tied to the > regular CPU MMUs and the kernel code around them. Using 'struct page' for > TDX guest memory is not a good fit anywhere near the KVM MMU code [2]. > > Use "kvm_pfn_t pfn" for type safety. Using this KVM type is appropriate > since APIs tdh_mem_page_add() and tdh_mem_page_aug() are exported to KVM > only. > > [ Yan: Replace "u64 pfn" with "kvm_pfn_t pfn" ] > > Signed-off-by: Sean Christopherson > Signed-off-by: Yan Zhao > Link: https://lore.kernel.org/all/aWgyhmTJphGQqO0Y@google.com [1] > Link: https://lore.kernel.org/all/ac7V0g2q2hN3dU5u@google.com [2] Acked-by: Kiryl Shutsemau -- Kiryl Shutsemau / Kirill A. Shutemov