Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7258351imm; Tue, 28 Aug 2018 08:54:28 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdarq+N+7vdyW/bf8NL6BasYU2ZpSP+kpRT6Rsrjda/GUmMDErqlc4hhTsLsnpWWPCVbWh+u X-Received: by 2002:a62:9349:: with SMTP id b70-v6mr2200684pfe.193.1535471668640; Tue, 28 Aug 2018 08:54:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471668; cv=none; d=google.com; s=arc-20160816; b=p6HxgUvxeezmPUh2TICoMfergTvtghagelw/P2oqtT5PpdmGlCUKTFEiHdw1ZQh2g/ OPqV6J9jRhURo2oFhkbY0cs9bh5Ue8FMQRyFp+dZu3Pzb9MOcU0ML18i3hk6+kqv6gug Gv39tgOoo7j5o3GBwo8Ci6BtZUUL8A6cteKYicFztexzaIt2sIkpo8dPqRML1lytX0A9 hZYZjvq2M0Ctx3ntCkk/obpk8NdT9ljxKOjLr8k0snhpAdrpwuwtc2Xn7ooq8yO+bVWA fuXylkQUHLXXoEQ8ox09PBPUsx1R1Wr2wH1hqRT9apGi76xR08Tx3EPwglmutH8AZ7Q7 ombQ== 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=LaTBlHmew+3EOT9qAY/AmBDfwqaWAaF+5N5etXPFW00=; b=bc91KY75az+jcoh42w0+ba1Z2u6xBf3LGIT9SvEumlFZcqAU2s8gLI5E6fOxe1Cl4y JkijdJ5YaGDNP1vQY7QuspKc3+kjK8GgA7YacAL+BHbMFDi7ymQG/JgcCJUPw7S6IO3h K0gMOGlsF5JvOKbKjb5C+kcCPY+m5xF+65fGav1LJpA4PCuGJzg8Ghky+67nQs+9SRUA R7n5WPSHWaVlpaKdazwmCH7O3Z7P2rmglI5qzKvCaFa5OroaXXUI4B1XdPHa79mwOLXG zhLu/leMYegJCTwjI1pnnlQnW8FWs6KZPe4yKSax6xzvZ6LWj7M/srnCU/wrOpGlOmUh ZmGQ== 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 l15-v6si1244325pgh.593.2018.08.28.08.54.13; Tue, 28 Aug 2018 08:54:28 -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 S1727655AbeH1Tog (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:36 -0400 Received: from foss.arm.com ([217.140.101.70]:41038 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1Tof (ORCPT ); Tue, 28 Aug 2018 15:44:35 -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 EFF1E80D; Tue, 28 Aug 2018 08:52:18 -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 DDC7A3F557; Tue, 28 Aug 2018 08:52:16 -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 , Russell King Subject: [PATCH v5 13/27] arm/arm64: gic-v3: Add helper functions to manage IRQ priorities Date: Tue, 28 Aug 2018 16:51:23 +0100 Message-Id: <1535471497-38854-14-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 function to check if priority masking is supported and accessors for PMR/RPR. Tested-by: Daniel Thompson Signed-off-by: Julien Thierry Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Marc Zyngier --- arch/arm/include/asm/arch_gicv3.h | 21 +++++++++++++++++++++ arch/arm64/include/asm/arch_gicv3.h | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/arch/arm/include/asm/arch_gicv3.h b/arch/arm/include/asm/arch_gicv3.h index 0bd5307..58d5d3e 100644 --- a/arch/arm/include/asm/arch_gicv3.h +++ b/arch/arm/include/asm/arch_gicv3.h @@ -34,6 +34,7 @@ #define ICC_SRE __ACCESS_CP15(c12, 0, c12, 5) #define ICC_IGRPEN1 __ACCESS_CP15(c12, 0, c12, 7) #define ICC_BPR1 __ACCESS_CP15(c12, 0, c12, 3) +#define ICC_RPR __ACCESS_CP15(c12, 0, c11, 3) #define __ICC_AP0Rx(x) __ACCESS_CP15(c12, 0, c8, 4 | x) #define ICC_AP0R0 __ICC_AP0Rx(0) @@ -245,6 +246,21 @@ static inline void gic_write_bpr1(u32 val) write_sysreg(val, ICC_BPR1); } +static inline u32 gic_read_pmr(void) +{ + return read_sysreg(ICC_PMR); +} + +static inline void gic_write_pmr(u32 val) +{ + write_sysreg(val, ICC_PMR); +} + +static inline u32 gic_read_rpr(void) +{ + return read_sysreg(ICC_RPR); +} + /* * Even in 32bit systems that use LPAE, there is no guarantee that the I/O * interface provides true 64bit atomic accesses, so using strd/ldrd doesn't @@ -347,5 +363,10 @@ static inline void gits_write_vpendbaser(u64 val, void * __iomem addr) #define gits_read_vpendbaser(c) __gic_readq_nonatomic(c) +static inline bool gic_prio_masking_enabled(void) +{ + return false; +} + #endif /* !__ASSEMBLY__ */ #endif /* !__ASM_ARCH_GICV3_H */ diff --git a/arch/arm64/include/asm/arch_gicv3.h b/arch/arm64/include/asm/arch_gicv3.h index e278f94..19a5b1f 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -114,6 +114,21 @@ static inline void gic_write_bpr1(u32 val) write_sysreg_s(val, SYS_ICC_BPR1_EL1); } +static inline u32 gic_read_pmr(void) +{ + return read_sysreg_s(SYS_ICC_PMR_EL1); +} + +static inline void gic_write_pmr(u32 val) +{ + write_sysreg_s(val, SYS_ICC_PMR_EL1); +} + +static inline u32 gic_read_rpr(void) +{ + return read_sysreg_s(SYS_ICC_RPR_EL1); +} + #define gic_read_typer(c) readq_relaxed(c) #define gic_write_irouter(v, c) writeq_relaxed(v, c) #define gic_read_lpir(c) readq_relaxed(c) @@ -140,5 +155,11 @@ static inline void gic_write_bpr1(u32 val) #define gits_write_vpendbaser(v, c) writeq_relaxed(v, c) #define gits_read_vpendbaser(c) readq_relaxed(c) +static inline bool gic_prio_masking_enabled(void) +{ + return IS_ENABLED(CONFIG_USE_ICC_SYSREGS_FOR_IRQFLAGS) + && cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING); +} + #endif /* __ASSEMBLY__ */ #endif /* __ASM_ARCH_GICV3_H */ -- 1.9.1