Return-Path: Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60672 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727547AbeGTKo1 (ORCPT ); Fri, 20 Jul 2018 06:44:27 -0400 From: Marc Zyngier To: stable@vger.kernel.org Cc: Will Deacon , Catalin Marinas , Mark Rutland , Christoffer Dall Subject: [PATCH 15/23] arm64: ssbd: Add global mitigation state accessor Date: Fri, 20 Jul 2018 10:56:26 +0100 Message-Id: <20180720095634.2173-16-marc.zyngier@arm.com> In-Reply-To: <20180720095634.2173-1-marc.zyngier@arm.com> References: <20180720095634.2173-1-marc.zyngier@arm.com> Sender: stable-owner@vger.kernel.org List-ID: commit c32e1736ca03904c03de0e4459a673be194f56fd upstream. We're about to need the mitigation state in various parts of the kernel in order to do the right thing for userspace and guests. Let's expose an accessor that will let other subsystems know about the state. Reviewed-by: Julien Grall Reviewed-by: Mark Rutland Acked-by: Will Deacon Signed-off-by: Marc Zyngier Signed-off-by: Catalin Marinas Signed-off-by: Marc Zyngier --- arch/arm64/include/asm/cpufeature.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 87a6e47047ff..0c1529e020a7 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -227,6 +227,16 @@ static inline bool system_supports_mixed_endian_el0(void) #define ARM64_SSBD_FORCE_ENABLE 2 #define ARM64_SSBD_MITIGATED 3 +static inline int arm64_get_ssbd_state(void) +{ +#ifdef CONFIG_ARM64_SSBD + extern int ssbd_state; + return ssbd_state; +#else + return ARM64_SSBD_UNKNOWN; +#endif +} + #endif /* __ASSEMBLY__ */ #endif -- 2.18.0