Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7257734imm; Tue, 28 Aug 2018 08:53:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZG8C9/p8Wu5SE4HivR5CxEUJOq0UB/0RzzNw5dQ+3n2x9UOBnOvgD7qK92F+lXFxlx5U48 X-Received: by 2002:a17:902:1665:: with SMTP id g92-v6mr2151548plg.257.1535471631207; Tue, 28 Aug 2018 08:53:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471631; cv=none; d=google.com; s=arc-20160816; b=wjhPqRvEa63BPkUwRkeT320I9ycFJhiKsNLUlnmc4M2+KStOLwFHnvFkQocJguFddR HR1uvUyQO1ywULzb6LTTt7M9zVunxQEp9XoBAnjC2+AQgPxd2CQBWrpOwzlWvgFosXvd +l3mP1tCBaNqN5Axe0oH0fbNZASD8/vCYEiHm0W2MYyuXqmn7ZPpLIDvqRwOf2oaQbEN s9XsueZFhp3xKtStzFEYvQh5w86B/mr4bq1cexZnW6I2G35DJDTKqGJskPmBjttbGW6/ meNToBQ8BuOtCL/VZLrUB37WAbvRGuCJmOJ7o6uEhrYBzr4R8mujinuztPNY2cksfOLy EPwA== 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:arc-authentication-results; bh=rbPdgrLwbQZub85QZQM1mTDinA8iEvTs/Hr2BmjwB0I=; b=wHPBcm5yLTLOJqIel61kWV10e4wrPu9jJBk6iD2PV2x5ipEcfyy6TE4SvhdyCXSKAO nNEQvU41+mW83gyl5uavJMUZpkWyijHHvcpWhF0DYQkVaq5O2ZSMPjWNd7SLtI8TA+FT nYdaWn0SXOjFqIn+sWsy5lfAKPKtSCkKgsyn8xIVXaRQUQluQj/yqPVqYy4FAM6yjhcL CpAhfqhdKOHThSUDi8j58yzOlLJNpdICL4gpuMcKqkNirwM5opiVbWNLZcPeLc8BfMFg LD5dD6RCkaNnHNo3/lr3453iI3OuBusM6WARjavCm9F14oHLOBbU3GVjSHyA/TdX9SRm OLsg== 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 h9-v6si1508771pgr.260.2018.08.28.08.53.35; Tue, 28 Aug 2018 08:53:51 -0700 (PDT) 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 S1727582AbeH1To3 (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:29 -0400 Received: from foss.arm.com ([217.140.101.70]:41012 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1To2 (ORCPT ); Tue, 28 Aug 2018 15:44:28 -0400 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 E6C861684; Tue, 28 Aug 2018 08:52:11 -0700 (PDT) Received: from e112298-lin.Emea.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 D56483F557; Tue, 28 Aug 2018 08:52:09 -0700 (PDT) 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, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry , Suzuki K Poulose Subject: [PATCH v5 10/27] arm64: cpufeature: Add cpufeature for IRQ priority masking Date: Tue, 28 Aug 2018 16:51:20 +0100 Message-Id: <1535471497-38854-11-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-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. Add command line option to disable that feature at runtime. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier Cc: Suzuki K Poulose --- Documentation/admin-guide/kernel-parameters.txt | 3 +++ arch/arm64/include/asm/cpucaps.h | 3 ++- arch/arm64/kernel/cpufeature.c | 31 +++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 9871e64..d3e1170 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -2764,6 +2764,9 @@ noexec=on: enable non-executable mappings (default) noexec=off: disable non-executable mappings + nogicprios [ARM64] + Disable usage of GIC priorities to toggle interrupt status. + nosmap [X86] Disable SMAP (Supervisor Mode Access Prevention) even if it is supported by processor. diff --git a/arch/arm64/include/asm/cpucaps.h b/arch/arm64/include/asm/cpucaps.h index ae1f704..8cc2ae5 100644 --- a/arch/arm64/include/asm/cpucaps.h +++ b/arch/arm64/include/asm/cpucaps.h @@ -51,7 +51,8 @@ #define ARM64_SSBD 30 #define ARM64_MISMATCHED_CACHE_TYPE 31 #define ARM64_HAS_STAGE2_FWB 32 +#define ARM64_HAS_IRQ_PRIO_MASKING 33 -#define ARM64_NCAPS 33 +#define ARM64_NCAPS 34 #endif /* __ASM_CPUCAPS_H */ diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 0d1e41e..2f2c557 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1046,6 +1046,22 @@ static void cpu_has_fwb(const struct arm64_cpu_capabilities *__unused) WARN_ON(val & (7 << 27 | 7 << 21)); } +#ifdef CONFIG_USE_ICC_SYSREGS_FOR_IRQFLAGS +static bool nogicprios = false; + +static int __init early_nogicprios(char *p) +{ + nogicprios = true; + return 0; +} +early_param("nogicprios", early_nogicprios); + +static bool can_use_gic_priorities(const struct arm64_cpu_capabilities *entry, int scope) +{ + return !nogicprios && has_useable_gicv3_cpuif(entry, scope); +} +#endif + static const struct arm64_cpu_capabilities arm64_features[] = { { .desc = "GIC system register CPU interface", @@ -1233,6 +1249,21 @@ static void cpu_has_fwb(const struct arm64_cpu_capabilities *__unused) .cpu_enable = cpu_enable_hw_dbm, }, #endif +#ifdef CONFIG_USE_ICC_SYSREGS_FOR_IRQFLAGS + { + /* + * 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