Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7227842imu; Thu, 31 Jan 2019 07:03:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN5KDIaec0jmSojvgNQycHMsFGozHKHek4+ZpXtUfMI5Gr/iWz4GTtna8yzQepTaZ94gmu0Z X-Received: by 2002:a17:902:f44:: with SMTP id 62mr35414921ply.38.1548946990865; Thu, 31 Jan 2019 07:03:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548946990; cv=none; d=google.com; s=arc-20160816; b=YJMRrvDvxS7Zk429KJBmKGhFFe3lfTf0dRyB94HZMLQca+lkJ4OZNmDUIhbIGYNano FVzOQbcj4FD9RGA6Wz/j2Vocq1cW+WfE9kzDg8wXBPbw60i3Ae8a0bf/JmP+JhoxIyiu C9S8oB9xJo5q0xEm1q/EeckcGqT6l3UKfStghE6vxeEqhHQa/RAceZm0cGbhVUsUXA26 vM9v/YUdmcxulzftTzKy22AU7qimrc55VNssFlB3jkikc9xrI4WBriR7lRgNRS48s14g oOhVLBgjyiDn4iaNoWZH99bkHC8N8W7UE4NRBb3ai0ayE8PqrLTINzLM4WflFhY4R/wW 4bYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=nVNTdplGJTDTjiRxHdyFxcb5LtDBQZMH4At0CQGoXzY=; b=02yg1A+q1BtjhVVYHqJER0po4f82vCt83Odqfo9Xw3inlplVltg/g9QiPOMhOw9p+h PgwrT3gj5a/rRXKb9u/4Tg1yNcQi+IYj+aHVV4BZ6X0LKmVEpv8f4Q8FfvUsQRLvii4b 7e1AIEHki+CzlGcdRN9eN49rz85uCAbLB0xVTMw+O4H4sRT4cH18v/llMwKECfU0LVr0 9sK3KHU91MJ1Fx5+9nrz/htwO34EncJhaMRwOIPjvqYRZVj6VzNYW4d+VDqmkOOcTlnj duLQx4tQ4SstC7L1CEl3wVMgRBbCxB8ZblRY2oB7xeG+3MdZ14v4Gk88mxKJh8rOi+is Irng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r81si1282779pfr.164.2019.01.31.07.02.52; Thu, 31 Jan 2019 07:03:10 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731572AbfAaPBX (ORCPT + 99 others); Thu, 31 Jan 2019 10:01:23 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45490 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730283AbfAaO70 (ORCPT ); Thu, 31 Jan 2019 09:59:26 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A6C0F80D; Thu, 31 Jan 2019 06:59:25 -0800 (PST) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 895103F59C; Thu, 31 Jan 2019 06:59:23 -0800 (PST) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, Julien Thierry , Suzuki K Poulose Subject: [PATCH v10 04/25] arm64: cpufeature: Add cpufeature for IRQ priority masking Date: Thu, 31 Jan 2019 14:58:42 +0000 Message-Id: <1548946743-38979-5-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1548946743-38979-1-git-send-email-julien.thierry@arm.com> References: <1548946743-38979-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a cpufeature indicating whether a cpu supports masking interrupts by priority. The feature will be properly enabled in a later patch. Signed-off-by: Julien Thierry Reviewed-by: Suzuki K Poulose Reviewed-by: Mark Rutland Acked-by: Catalin Marinas Acked-by: Marc Zyngier Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier Cc: Suzuki K Poulose --- arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/include/asm/cpufeature.h | 6 ++++++ arch/arm64/kernel/cpufeature.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index 82e9099..f6a76e4 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -60,7 +60,8 @@ #define ARM64_HAS_ADDRESS_AUTH_IMP_DEF 39 #define ARM64_HAS_GENERIC_AUTH_ARCH 40 #define ARM64_HAS_GENERIC_AUTH_IMP_DEF 41 +#define ARM64_HAS_IRQ_PRIO_MASKING 42 -#define ARM64_NCAPS 42 +#define ARM64_NCAPS 43 #endif /* __ASM_CPUCAPS_H */ diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index dfcfba7..89c3f31 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -612,6 +612,12 @@ static inline bool system_supports_generic_auth(void) cpus_have_const_cap(ARM64_HAS_GENERIC_AUTH_IMP_DEF)); } +static inline bool system_uses_irq_prio_masking(void) +{ + return IS_ENABLED(CONFIG_ARM64_PSEUDO_NMI) && + cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING); +} + #define ARM64_SSBD_UNKNOWN -1 #define ARM64_SSBD_FORCE_DISABLE 0 #define ARM64_SSBD_KERNEL 1 diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index b9c0adf..6f56e0a 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1203,6 +1203,14 @@ static void cpu_enable_address_auth(struct arm64_cpu_capabilities const *cap) } #endif /* CONFIG_ARM64_PTR_AUTH */ +#ifdef CONFIG_ARM64_PSEUDO_NMI +static bool can_use_gic_priorities(const struct arm64_cpu_capabilities *entry, + int scope) +{ + return false; +} +#endif + static const struct arm64_cpu_capabilities arm64_features[] = { { .desc = "GIC system register CPU interface", @@ -1480,6 +1488,21 @@ static void cpu_enable_address_auth(struct arm64_cpu_capabilities const *cap) .matches = has_cpuid_feature, }, #endif /* CONFIG_ARM64_PTR_AUTH */ +#ifdef CONFIG_ARM64_PSEUDO_NMI + { + /* + * Depends on having GICv3 + */ + .desc = "IRQ priority masking", + .capability = ARM64_HAS_IRQ_PRIO_MASKING, + .type = ARM64_CPUCAP_STRICT_BOOT_CPU_FEATURE, + .matches = can_use_gic_priorities, + .sys_reg = SYS_ID_AA64PFR0_EL1, + .field_pos = ID_AA64PFR0_GIC_SHIFT, + .sign = FTR_UNSIGNED, + .min_field_value = 1, + }, +#endif {}, }; -- 1.9.1