From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8B4202C21D9 for ; Thu, 11 Sep 2025 10:52:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757587931; cv=none; b=rfp9q7/2RBQ+g1xRBlmFmrKe/TrdgybmuGXiJVNR93QIfiUpkO914muQb16dLyr/1tJQIOH4Z8gXaANZl3GUEki5VlBU2VZTmliWB14OSaaA8UpfDpsqGYdMyztDoJtkaR8QkWI8YCbhrP/cYkgFafxmgE31eIH9eF5yI5DvxO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757587931; c=relaxed/simple; bh=5xm/oKxNE7MpPJD888pjCXmQJWzr/yIx12TTrwyYy9A=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=h/0lfU9/c8pdHdL6RLrtm4AZg8X57bBHz8Gh36c1gaQrjAeFgLeBnwQBjBcK+SRRgtNlDH2KLnzZlQwcuHJihsRM1CYKavTxRuwMAt3BTe3lbWhCq8SBLfUNxyaHleumjUsLJBk8ggkRUnNOQyHmM+oNLVJi2QeGq7ll7CTrvyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5E965153B; Thu, 11 Sep 2025 03:52:00 -0700 (PDT) Received: from [10.57.70.14] (unknown [10.57.70.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0A66F3F694; Thu, 11 Sep 2025 03:52:05 -0700 (PDT) Message-ID: Date: Thu, 11 Sep 2025 12:52:02 +0200 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] arm64: mm: Move KPTI helpers to mmu.c To: Ard Biesheuvel Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Anshuman Khandual , Catalin Marinas , Kees Cook , Mark Rutland , Ryan Roberts , Suzuki K Poulose , Will Deacon , Yeoreum Yun References: <20250910104454.317067-1-kevin.brodsky@arm.com> Content-Language: en-GB From: Kevin Brodsky In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/09/2025 11:19, Ard Biesheuvel wrote: >> diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h >> index 49f1a810df16..624edd6c4964 100644 >> --- a/arch/arm64/include/asm/mmu.h >> +++ b/arch/arm64/include/asm/mmu.h >> @@ -104,5 +104,11 @@ static inline bool kaslr_requires_kpti(void) >> return true; >> } >> >> +#ifdef CONFIG_UNMAP_KERNEL_AT_EL0 >> +void kpti_install_ng_mappings(void); >> +#else >> +static inline void kpti_install_ng_mappings(void) {} >> +#endif >> + > Nit: you might just keep the former declaration, and check for > IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0) in the function, rather than > propagating this distinction to the header file. > But either is fine with me. That's an option, but that would mean removing the #ifdef around the functions defined in mmu.c. They would probably get eliminated by the linker if the CONFIG isn't defined, but I'm not so sure about the static variable (kpti_ng_temp_alloc). Probably not a big deal but I feel keeping the #ifdef is more self-documenting as well. - Kevin