Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3275650imm; Fri, 25 May 2018 02:54:54 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpa/TLzhEpdJBmmplC0tFx10V6Yjzif3CZFdxdHmdegrJ1MH2n0/lMTHbeZQIHYrmECtHOn X-Received: by 2002:a17:902:5502:: with SMTP id f2-v6mr1902891pli.108.1527242094454; Fri, 25 May 2018 02:54:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242094; cv=none; d=google.com; s=arc-20160816; b=Sg6CGN8iqQhMdCwndzQmoHwxW5u9qiVblY1Mq9+Fx/y+pr7WP3PZHCvvdyKrsQBGSW u/QL/CSnofYsWNjh86bmisMdZ4NRpCkPBEr7OCO/PisqIoIsi9nMpIO5+ey0WvuAvFfU MqZTzuRbEUPAX2x4hbq8H2jsTVCW+/7haVbJrK7O1hzZRdeP+vuXLfgHMQkmwQb4499d qHCN8uEf9AYPXXRwrl5oJFMO2yPz0oMiG1TWo2J35wdBM2Z75WsrhLMyqyqgYkcCX/aj ebyjx4JzU7mq9+n1H18fpGLrgoUid2N3Y3p7luf2tgVQS6/4QR1vXFFG4pFerB1Zmf2T EZEQ== 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=6wsYviC6cTeFf4Q+vzFmwyMd5q+dE4qTt9EYSTbFCZo=; b=uqD5HUk5aeaz8SEPj84WTxVECcM5hzR9OiZBOTj9feLw7KrCGBqqU9tuuigl5dibGU aG+pUE5rY5c9w49U0r8yWmRPT9IHcDYkWD2lU7xIydy3RCzh9gwsrTvuhf3F9fjoQ7Xb +XuH5oC3Afn8JYrnOHypZ4mPzvKzz/udfxVWWMWJdH3Y4BcUXy2t0lGd9ORrm49oAtZb +HYwsraytlbCEqHgwWrXit5yXoiz/Q+x5afxeJPw33fqyp/Q2Hge1/2ZoF5H4RdpC5hT AY06zp5ZpE9pXYIQFTQON0bWornkfAqNnjc2jBXz3tg1rGMvgJEiFUWxlDhDulJd5jdo +i2g== 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 g33-v6si24342067plb.297.2018.05.25.02.54.39; Fri, 25 May 2018 02:54: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 S966165AbeEYJuo (ORCPT + 99 others); Fri, 25 May 2018 05:50:44 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:57602 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965702AbeEYJuk (ORCPT ); Fri, 25 May 2018 05:50:40 -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 C798A169F; Fri, 25 May 2018 02:50:39 -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 7CF123F25D; Fri, 25 May 2018 02:50:37 -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 , Thomas Gleixner , Jason Cooper Subject: [PATCH v4 18/26] irqchip/gic-v3: Do not overwrite PMR value Date: Fri, 25 May 2018 10:49:24 +0100 Message-Id: <1527241772-48007-19-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 If the architecture is using ICC_PMR_EL1 to mask IRQs, do not overwrite that value. Signed-off-by: Julien Thierry Cc: Thomas Gleixner Cc: Jason Cooper Cc: Marc Zyngier --- drivers/irqchip/irq-gic-v3.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 13d283d..fc477e2 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -226,6 +226,11 @@ static void gic_unmask_irq(struct irq_data *d) gic_poke_irq(d, GICD_ISENABLER); } +static inline bool arch_uses_gic_prios(void) +{ + return IS_ENABLED(CONFIG_USE_ICC_SYSREGS_FOR_IRQFLAGS); +} + static int gic_irq_set_irqchip_state(struct irq_data *d, enum irqchip_irq_state which, bool val) { @@ -404,6 +409,9 @@ static u32 gic_get_pribits(void) static bool gic_has_group0(void) { u32 val; + u32 old_pmr; + + old_pmr = gic_read_pmr(); /* * Let's find out if Group0 is under control of EL3 or not by @@ -419,6 +427,8 @@ static bool gic_has_group0(void) gic_write_pmr(BIT(8 - gic_get_pribits())); val = gic_read_pmr(); + gic_write_pmr(old_pmr); + return val != 0; } @@ -580,7 +590,8 @@ static void gic_cpu_sys_reg_init(void) group0 = gic_has_group0(); /* Set priority mask register */ - write_gicreg(DEFAULT_PMR_VALUE, ICC_PMR_EL1); + if (!arch_uses_gic_prios()) + write_gicreg(DEFAULT_PMR_VALUE, ICC_PMR_EL1); /* * Some firmwares hand over to the kernel with the BPR changed from -- 1.9.1