Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3275682imm; Fri, 25 May 2018 02:54:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpGE9UgDeQ8ESIZaAbyifObWYMFMQw2YfSmd3gDmjr+TCLXf/2xqwTYXzrnaXBz4Jmd38HW X-Received: by 2002:a63:7e1b:: with SMTP id z27-v6mr1411075pgc.65.1527242096705; Fri, 25 May 2018 02:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242096; cv=none; d=google.com; s=arc-20160816; b=SlophOQ/RqfhSdAH7hwoThxCE9njc9n8Ch9Lx8gnE22awBTuCcIcM3Qx+6L2Nr53Xz viStR3PlrfO73wmPB+mY0mV9r29Xq/9OmBz91uZ29ujslAOT62MuyIHl01UeFlk8+ML8 e/jn/S6U8i2AOFOG17SAOj786VpWl+Grb0Jm+gGfZV9BoDcrHjGuY4HAuGAUqweoe/mk L+Z6Njmp9jxusVqQ3CAtmj6cdzOOJkTHf02jr+bJNystWnFzMvSQ+hB94bGa9XJoqpda XS61g9jLFgXKvTv0Q0BkHxSLwLHIaRIlI5VgH0fTIMbjCPX1HebQPvERNPDg83SeVbbq QwDg== 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=cYxNmAHIpscvS1EgJQS0WkhRza5UcBgLpMVINGZiyYk=; b=rbPZWiHBuP+HRTYuLuJC61zmCaKBHtfFmBg9xrtIpjqb7csXm6fSOOQvBYiLfH0v/j TAFskeahtY5lQTjp/5KeJ1owf8z1zok3WDOgeOkWi7Rl7ERnoI5PVhQwzC91rCJQxaOt 9XrHVyXMBcao83lg/KSX3A6vR1R0Tfz08CTaYrASdbSuxbXhPf/RkwKzq+EGwEDpCzoZ Lv2jVp3URjlzT99GhDcooOMFllrVH89dYWTCoVuma4RlRpRcFISrUAKdCQGAIwrsQYyY hU7LZGx9Y/IKZ71tgP+pHt8ebPUwSJhwlx19puHcXqePERIjGIhTkuLM7aWm0ioE6+Ta fZIQ== 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 c12-v6si22315722pll.360.2018.05.25.02.54.42; Fri, 25 May 2018 02:54:56 -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 S966219AbeEYJus (ORCPT + 99 others); Fri, 25 May 2018 05:50:48 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57614 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966147AbeEYJun (ORCPT ); Fri, 25 May 2018 05:50:43 -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 85C8480D; Fri, 25 May 2018 02:50:42 -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 166F53F25D; Fri, 25 May 2018 02:50:39 -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 , Thomas Gleixner , Jason Cooper Subject: [PATCH v4 19/26] irqchip/gic-v3: Switch to PMR masking after IRQ acknowledge Date: Fri, 25 May 2018 10:49:25 +0100 Message-Id: <1527241772-48007-20-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 After an interrupt has been acknowledged, mask the IRQ priority through PMR and clear PSR.I bit, allowing higher priority interrupts to be received during interrupt handling. Signed-off-by: Julien Thierry Cc: Russell King Cc: Catalin Marinas Cc: Will Deacon Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier --- arch/arm/include/asm/arch_gicv3.h | 6 ++++++ arch/arm64/include/asm/arch_gicv3.h | 6 ++++++ drivers/irqchip/irq-gic-v3.c | 8 +++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch_gicv3.h b/arch/arm/include/asm/arch_gicv3.h index 58d5d3e..b39d620 100644 --- a/arch/arm/include/asm/arch_gicv3.h +++ b/arch/arm/include/asm/arch_gicv3.h @@ -368,5 +368,11 @@ static inline bool gic_prio_masking_enabled(void) return false; } +static inline void gic_start_pmr_masking(void) +{ + /* Should not get called */ + WARN_ON(true); +} + #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 98b09db..23c88ac0 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -160,5 +160,11 @@ static inline bool gic_prio_masking_enabled(void) return cpus_have_const_cap(ARM64_HAS_IRQ_PRIO_MASKING); } +static inline void gic_start_pmr_masking(void) +{ + gic_write_pmr(ICC_PMR_EL1_MASKED); + asm volatile ("msr daifclr, #2" : : : "memory"); +} + #endif /* __ASSEMBLY__ */ #endif /* __ASM_ARCH_GICV3_H */ diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index fc477e2..2fd0440 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -355,12 +355,18 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs irqnr = gic_read_iar(); + if (arch_uses_gic_prios()) { + isb(); + /* Masking IRQs earlier would prevent to ack the current interrupt */ + gic_start_pmr_masking(); + } + if (likely(irqnr > 15 && irqnr < 1020) || irqnr >= 8192) { int err; if (static_branch_likely(&supports_deactivate_key)) gic_write_eoir(irqnr); - else + else if (!arch_uses_gic_prios()) isb(); err = handle_domain_irq(gic_data.domain, irqnr, regs); -- 1.9.1