Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7258165imm; Tue, 28 Aug 2018 08:54:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaHMMjbHOU5+11EdCCg/7EZ1in0o6btpwUb11Gdw/h/M/QMmG7KReYkMVuSmi4LrvOSfJKK X-Received: by 2002:a63:6b03:: with SMTP id g3-v6mr2133303pgc.57.1535471660144; Tue, 28 Aug 2018 08:54:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471660; cv=none; d=google.com; s=arc-20160816; b=vlr08+mHYp9T3Dgy3q7tq1qTl9Ed4tJxeRwUXwkBWyywhartWMCOQz5HCMkMpUG4Pt GT8ppAyvfmEu2/RchKQVDywmtgMRjcFyzEv8Q/qIGNWBnK1ZkthwL+vFucIjCmum/q6d aBbsgpbJk0+3BUSTByAY1aUmnwoJ9KrpGpue5z5PePlGe8wXm1ITGo0+ofj1DxQ2trI5 1ZGRnF88PS0X+DVHlHIUsWrXSfXg/aRybugGkKqgwG/d8aTylD/H7Pz6Pk5By7SMs9Na dm653H75Jc1w7Llq5lSLgxVOfo7ptWoCiypETY148nVusODEYNuVIlVc/6kNWKDn7nsd vnqg== 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=8lCKpTF2O1fS/ydi5yFBOhuyX2mTXQtFKX+k2lvPRXs=; b=T5D8PcYI9rMRCx/RRoJVOySFsXZ+BL9ib5AIshaOizyYjTgaNoz4SGXCJzoSDFksgk 5O2eWz/a3hulMi+QD7bi5iWGGhnAkcEiZ45HJn39C/TgSKtiMftlMUvBqcv9KxF+TbSa cq/cKJ6wRKBy0SAswo2wfo9Z4OfvyE3CAOQKnka6oTFdXh3cqlYNVoVaFxBH36Y3je6q WqPHPyD6pMuLE62J3SvSOULv5+JizV5DCNZc1E2Akjw7C1GpJWXxXeLaAtHLP0LS8Mdk C62NvrDQ6dC59XH5wgKh8aUniwna/O+CBQxM54ogs2Eepjo+74FEK8HXu9zy/NlSGChp eHFg== 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 h5-v6si1321417pfd.112.2018.08.28.08.54.04; Tue, 28 Aug 2018 08:54:20 -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 S1727842AbeH1Tow (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:52 -0400 Received: from foss.arm.com ([217.140.101.70]:41148 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1Tow (ORCPT ); Tue, 28 Aug 2018 15:44:52 -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 D9C4C1682; Tue, 28 Aug 2018 08:52:35 -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 818083F557; Tue, 28 Aug 2018 08:52:33 -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 v5 20/27] irqchip/gic-v3: Switch to PMR masking after IRQ acknowledge Date: Tue, 28 Aug 2018 16:51:30 +0100 Message-Id: <1535471497-38854-21-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 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. Tested-by: Daniel Thompson 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 19a5b1f..eb55da8 100644 --- a/arch/arm64/include/asm/arch_gicv3.h +++ b/arch/arm64/include/asm/arch_gicv3.h @@ -161,5 +161,11 @@ static inline bool gic_prio_masking_enabled(void) && 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 a467fcf..56d1fb9 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -350,12 +350,18 @@ static asmlinkage void __exception_irq_entry gic_handle_irq(struct pt_regs *regs irqnr = gic_read_iar(); + if (gic_prio_masking_enabled()) { + isb(); + /* Masking IRQs earlier would prevent to ack the current IRQ */ + 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 (!gic_prio_masking_enabled()) isb(); err = handle_domain_irq(gic_data.domain, irqnr, regs); -- 1.9.1