Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3277065imm; Fri, 25 May 2018 02:56:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrNywBn409LJM+tC8Fu9LAyjvoz8ybNlfO+5mV9bWbFscfs61xLab9DyHKzBUD45vyk7FCC X-Received: by 2002:a62:3d54:: with SMTP id k81-v6mr1828866pfa.193.1527242214469; Fri, 25 May 2018 02:56:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242214; cv=none; d=google.com; s=arc-20160816; b=xn5tKOkWu9zHbMkPUzaFve1gncJW/qr3M757Ppo1u46DIdrgC1Geb4/NQsyqF8Z4N4 /9tTjtBXNC+MC/3BZV2r/kMQT2NMr+gXuZU0UABB02ps07ZcGbVus8GkCv0b9qivDx0D ppD+bd8/s8BXiZWmjfoOawUEQ0zHPJBdm/b3H3SDCwPsBiHQAIyIaNSSWUZWEh2GPDWt 7u7UP0IB2fu/E7lO0U2OH3vRkaCiS+dy9tAC8ujEtdGjc6dK1DmozMmEcMQFMlk6i+9Q kuqD/fzw99+XoSpidVFysm0HYkexGx2s7SBqi2ZjhMre3GsVfqpprtr4xxAs66aYe7Lk +5PA== 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=O44oejflr1vs1PvAOi1mnR/eiiCh2PM0TR3bfBMsabM=; b=rRdjEWD5AZub9MHcRfiJJSG9myOJYYapraVuq9w/QXOkjEahyRcxiUHC52xd0F01Rn tMii+VkRYIe88igaDFDqhM/xBR2pUt3R62GDdssvF1zxGnzsXZHrDIW///F9L6h0ru6B eyHMOUVJefA5qlJOilh0VeaAXK55xBWODKVhwSIL2iHR5I6tq8jGlRGYqE5pQ1MfsgLj gPJEJzLFH/n3bGxf1Lwj04+GGRLAVtlBkicRx/9H6WcZQYcEP9MBuwPPgM3qoOLKxpHH 3TFXQuMnjhgi44vDHutaAa9iqfrquxt/san22gBn8szsw2rS1PMI0TZk8/rNmT2dyo6r zczg== 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 b10-v6si18392944pgs.456.2018.05.25.02.56.40; Fri, 25 May 2018 02:56:54 -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 S966301AbeEYJy6 (ORCPT + 99 others); Fri, 25 May 2018 05:54:58 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57530 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966042AbeEYJu1 (ORCPT ); Fri, 25 May 2018 05:50:27 -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 813F119BF; Fri, 25 May 2018 02:50:27 -0700 (PDT) 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 51F133F25D; Fri, 25 May 2018 02:50:25 -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 v4 13/26] arm/arm64: gic-v3: Add helper functions to manage IRQ priorities Date: Fri, 25 May 2018 10:49:19 +0100 Message-Id: <1527241772-48007-14-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> References: <1527241772-48007-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. 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 | 20 ++++++++++++++++++++ 2 files changed, 41 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..98b09db 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,10 @@ 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 cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING); +} + #endif /* __ASSEMBLY__ */ #endif /* __ASM_ARCH_GICV3_H */ -- 1.9.1