From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lorenzo Pieralisi Subject: Re: [PATCH v3 18/23] arm64: mte: Restore the GCR_EL1 register after a suspend Date: Thu, 23 Apr 2020 16:23:52 +0100 Message-ID: <20200423152352.GA21616@e121166-lin.cambridge.arm.com> References: <20200421142603.3894-1-catalin.marinas@arm.com> <20200421142603.3894-19-catalin.marinas@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from foss.arm.com ([217.140.110.172]:42208 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729024AbgDWPYA (ORCPT ); Thu, 23 Apr 2020 11:24:00 -0400 Content-Disposition: inline In-Reply-To: <20200421142603.3894-19-catalin.marinas@arm.com> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, Will Deacon , Vincenzo Frascino , Szabolcs Nagy , Richard Earnshaw , Kevin Brodsky , Andrey Konovalov , Peter Collingbourne , linux-mm@kvack.org, linux-arch@vger.kernel.org On Tue, Apr 21, 2020 at 03:25:58PM +0100, Catalin Marinas wrote: > The CPU resume/suspend routines only take care of the common system > registers. Restore GCR_EL1 in addition via the __cpu_suspend_exit() > function. > > Signed-off-by: Catalin Marinas > Cc: Will Deacon > Cc: Lorenzo Pieralisi > --- > > Notes: > New in v3. > > arch/arm64/include/asm/mte.h | 4 ++++ > arch/arm64/kernel/mte.c | 8 ++++++++ > arch/arm64/kernel/suspend.c | 4 ++++ > 3 files changed, 16 insertions(+) Reviewed-by: Lorenzo Pieralisi > diff --git a/arch/arm64/include/asm/mte.h b/arch/arm64/include/asm/mte.h > index 3dc0a7977124..22eb3e06f311 100644 > --- a/arch/arm64/include/asm/mte.h > +++ b/arch/arm64/include/asm/mte.h > @@ -12,6 +12,7 @@ int mte_memcmp_pages(const void *page1_addr, const void *page2_addr); > #ifdef CONFIG_ARM64_MTE > void flush_mte_state(void); > void mte_thread_switch(struct task_struct *next); > +void mte_suspend_exit(void); > long set_mte_ctrl(unsigned long arg); > long get_mte_ctrl(void); > #else > @@ -21,6 +22,9 @@ static inline void flush_mte_state(void) > static inline void mte_thread_switch(struct task_struct *next) > { > } > +static inline void mte_suspend_exit(void) > +{ > +} > static inline long set_mte_ctrl(unsigned long arg) > { > return 0; > diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c > index 212b9fac294d..fa4a4196b248 100644 > --- a/arch/arm64/kernel/mte.c > +++ b/arch/arm64/kernel/mte.c > @@ -76,6 +76,14 @@ void mte_thread_switch(struct task_struct *next) > update_gcr_el1_excl(next->thread.gcr_incl); > } > > +void mte_suspend_exit(void) > +{ > + if (!system_supports_mte()) > + return; > + > + update_gcr_el1_excl(current->thread.gcr_incl); > +} > + > long set_mte_ctrl(unsigned long arg) > { > u64 tcf0; > diff --git a/arch/arm64/kernel/suspend.c b/arch/arm64/kernel/suspend.c > index 9405d1b7f4b0..1d405b73d009 100644 > --- a/arch/arm64/kernel/suspend.c > +++ b/arch/arm64/kernel/suspend.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -74,6 +75,9 @@ void notrace __cpu_suspend_exit(void) > */ > if (arm64_get_ssbd_state() == ARM64_SSBD_FORCE_DISABLE) > arm64_set_ssbd_mitigation(false); > + > + /* Restore additional MTE-specific configuration */ > + mte_suspend_exit(); > } > > /*