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 A6D9E43B482 for ; Thu, 16 Jul 2026 14:35:52 +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=1784212553; cv=none; b=ZXl8R5UIpKpZQ853knj4y6JmK3Wfo7uYfsWSiwNGhUoYDUi7lLTOypIrm4J/LCbtw5945u5Oe+f3i0JPYydWWr6OZD5GMh/R1O6sXIoQwsxorCH5uVFa2G6dUT5TItK2tAANzYve5rhogmaiXNmDFfXbO/TolfBBKTdrS4c4a5Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784212553; c=relaxed/simple; bh=ApkqUBjQLYSyKDlXozBwY6RE9clcaB/Iot0odu+4N60=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=df6baet5IxG841WT3wKWeHb0k+XyTsY/01C90WsEX3C4aOg4ZB+nce3hTOwwFSF+nl3S/qivLuGqmOBwG2KHvwmxdfYUxsgpV0kGsAP/3R7526QqwZJhgprVKNtjE2NHWi7uMr5klDmk+uq3EE69LePpNzX4tOh3Lu2INkUkDX0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KFC5xmL2; 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="KFC5xmL2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5973D1F000E9; Thu, 16 Jul 2026 14:35:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784212552; bh=KZ2Jay0loDqW4iEYRBZiTsQd8X5ZUn23JYIMxwnq18M=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KFC5xmL2MtWypHwbA6buxOKY9HEtSEdHzfu24pmWP6h2HrFLPf2lujKqpqGXA96Np T/kolpeW9AOmW1xCzEYHweRfAgFaQ9IjJkl9KxLL3F8XftO/irqT2zrrC/oF7Qoc0l pv3AFbU/u9h8ILqaXbivkxE8x8siaxLgdcQVl9UkPEDG84DWHkSlz/fbSYH45FLHvR iebXW+jO5AqRaPMBgf45KKs5/bs3cXtHLOkx2Lafp9ly1V57X2848bFu0BQMuTiDu5 YJqnVKSu2l79w2+CPNN1h0gj2S9GpIVkva7duBNqiw5xbbFvF2fepFp1NhfCbXMen+ qqL7ABdWr+0xg== Date: Thu, 16 Jul 2026 15:35:48 +0100 From: Will Deacon To: Bradley Morgan Cc: Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] arm64: sleep: dedup the sleep_save_stash slot lookup Message-ID: References: <20260705192331.23150-1-include@grrlz.net> <20260705192331.23150-3-include@grrlz.net> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260705192331.23150-3-include@grrlz.net> On Sun, Jul 05, 2026 at 07:23:31PM +0000, Bradley Morgan wrote: > Both __cpu_suspend_enter() and _cpu_resume() open code the same MPIDR > hash lookup. Factor it into a get_sleep_stash_slot macro. > > Signed-off-by: Bradley Morgan > --- > arch/arm64/kernel/sleep.S | 55 +++++++++++++++++++++------------------ > 1 file changed, 30 insertions(+), 25 deletions(-) > > diff --git a/arch/arm64/kernel/sleep.S b/arch/arm64/kernel/sleep.S > index e112b8537f10..8820a131aef7 100644 > --- a/arch/arm64/kernel/sleep.S > +++ b/arch/arm64/kernel/sleep.S > @@ -64,6 +64,31 @@ > lsr \mask ,\mask, \rs3 > orr \dst, \dst, \mask // dst|=(aff3>>rs3) > .endm > + > +/* > + * Compute the address of the current CPU's entry in sleep_save_stash, > + * i.e. &sleep_save_stash[hash(MPIDR_EL1)]. > + * > + * @slot: output register > + * > + * Clobbers: x2 - x8 > + */ > + .macro get_sleep_stash_slot slot > + mpidr_hash_assert_distinct \slot, x2 > + mrs x3, mpidr_el1 > + adr_l x2, mpidr_hash > + ldr x8, [x2, #MPIDR_HASH_MASK] > + /* > + * Following code relies on the struct mpidr_hash > + * members size. > + */ > + ldp w4, w5, [x2, #MPIDR_HASH_SHIFTS] > + ldp w6, w7, [x2, #(MPIDR_HASH_SHIFTS + 8)] > + compute_mpidr_hash x2, x4, x5, x6, x7, x3, x8 > + ldr_l \slot, sleep_save_stash > + add \slot, \slot, x2, lsl #3 > + .endm I think this would now be the only user of compute_mpidr_hash, so it's probably better to inline that macro here and then we don't need to bother with mpidr_hash_assert_distinct at all (i.e. your first patch isn't needed). Will