From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 871E6606A31A for ; Wed, 2 Dec 2026 09:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=N8i3ffnf Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D9F3B10E933; Wed, 2 Dec 2026 09:56:58 +0000 (UTC) Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 87011112061 for ; Wed, 2 Dec 2026 09:56:52 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 6D58D451AC; Wed, 2 Dec 2026 09:56:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A81731F00899; Wed, 2 Dec 2026 09:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796205412; bh=huEssHtkFTTBYIhOPLmOb/3+lORTnB9fmBDuszd0SUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=N8i3ffnfZBcsu+nBuYP/6/pxmlzoPeshePFtZBG/vZZ/Iw74JMFw/bCaZU2tFICQu zk9WL16LwqV01qyteVhcNcpISusY9ByKIiWcWckmqDQrXvqoQPn7JH4ugmYqIRllMF /BBEJUvp+Bcx3NF0dULXU7pA1sGiLGZZzYiuktO9fupQYbZFdIWIKKD8opeMQBtOts 9HrQ5O31LZH1cqGsQXM1UskN6GZr3tKeKWgXJDpLc28PlvCE7gahLU6l18L3nvwbXs 6puZ4izZdmWfsIfRjY1DxvtOVTZo9wQ4gFmE2Tpyrkum678HU+Ml48LgMTOnqqzuwi g/mGx0LxI+K3g== From: "Aneesh Kumar K.V (Arm)" To: linux-coco@lists.linux.dev Cc: "Aneesh Kumar K.V (Arm)" , Andrew Morton , Catalin Marinas , =?UTF-8?q?Christian=20K=C3=B6nig?= , Jason Gunthorpe , Joerg Roedel , Marc Zyngier , Marek Szyprowski , Robin Murphy , Steven Price , Sumit Semwal , Suzuki K Poulose , Will Deacon , "T.J. Mercier" , Madhavan Srinivasan , Heiko Carstens , Christian Borntraeger , Sven Schnelle , Dave Hansen , Kiryl Shutsemau , Rick Edgecombe , Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Haiyang Zhang , Wei Liu , Dexuan Cui , Andy Lutomirski , Peter Zijlstra , Alexander Gordeev , Gerald Schaefer , Vasily Gorbik , x86@kernel.org, dri-devel@lists.freedesktop.org, iommu@lists.linux.dev, linaro-mm-sig@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, linux-mm@kvack.org, kvmarm@lists.linux.dev, patches@lists.linux.dev Subject: [PATCH v11 08/23] mm: Document zeroing by set_memory_decrypted() and update the fallback Date: Wed, 2 Dec 2026 15:24:31 +0530 Message-ID: <20261202095446.2029567-9-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202095446.2029567-1-aneesh.kumar@kernel.org> References: <20261202095446.2029567-1-aneesh.kumar@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 The architecture implementations now clear memory during successful private-to-shared transitions. Make the no-encryption generic fallback clear the supplied range too. Signed-off-by: Aneesh Kumar K.V (Arm) --- include/linux/set_memory.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/linux/set_memory.h b/include/linux/set_memory.h index 27c32fbabfec..43ab0d62b87e 100644 --- a/include/linux/set_memory.h +++ b/include/linux/set_memory.h @@ -5,6 +5,10 @@ #ifndef _LINUX_SET_MEMORY_H_ #define _LINUX_SET_MEMORY_H_ +#include + +#include + /** * DOC: Kernel page table permissions * @@ -21,7 +25,8 @@ * * When an architecture does not implement these APIs they succeed without * doing anything, so a return value of 0 does not mean that the permissions - * were actually changed. + * were actually changed. set_memory_decrypted() also clears the range, + * including when no encryption change is needed. * * Callers that depend on the permissions being applied must ensure that the * architecture supports the required operation for the target addresses. The @@ -186,6 +191,7 @@ static inline int set_memory_encrypted(unsigned long addr, int numpages) static inline int set_memory_decrypted(unsigned long addr, int numpages) { + memset((void *)addr, 0, (size_t)numpages << PAGE_SHIFT); return 0; } #endif /* CONFIG_ARCH_HAS_MEM_ENCRYPT */ -- 2.43.0