Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7257988imm; Tue, 28 Aug 2018 08:54:08 -0700 (PDT) X-Google-Smtp-Source: ANB0VdavLirXcwTzxFMk/FXFk4oYFENzfhE1NXNUrm+5iHRh3UKFxtQ15w2U/yhNzaWk6V8U7LuW X-Received: by 2002:a62:6711:: with SMTP id b17-v6mr2205075pfc.243.1535471648314; Tue, 28 Aug 2018 08:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471648; cv=none; d=google.com; s=arc-20160816; b=j5iI792kEQ7d3UAFhEAWiGVogdUN2gkfbl5VhbKgYVfUYHTuCqv4HYTvDN8Bf6ceqY 4a0PABshNl1Bxr2xQ0t0kPoomUZQvA18OGNNdFiaOLP51Twp3ScItP3UUsqS5s7hC28f 1mpM/jKXE0z2r5Tp1IWXd6cVg3EYZU2RRtUelWID1wEwijY0mmPxl3PhHu1wxwc5XY5R U4iFcPsOUQFoM4LgqvIhrr604wO/ZcyBIjFJSa6o4lvaEoGwpGVLrVkEwhLPPUG95prW XVaSq9IZ+5LVZ0lgQWWRim8LOlk2o7Jl5n5cwPBUq8aeVxhbExhO09BPdyq4uHAXy627 zpvQ== 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=snlkj42vaZHgjWwqkLypApry+sOOukS26eJHvuLQMsc=; b=TGrAyTPLPNvlaLccM/GG3sf/49FRpdBECikvmra0uGRboxiaX9PRwiP4lfHTR5ZR37 KY1RXbHSqARcqJsIBywmH3PbFtk7DcjAMjMQkVxLAnge/TwAwzM4lWomWPL0V8R2dW2U XBRekINqoGqLAuZ7OWcVpDOi/x5clx4P37Rtf8lvZe69neh4YFZwp7WXPjYwjTj8L9DP eMUUp+rhkByuyfztItSqN/5iW2jR1txgr/3ZAUGrmlINAENkTsdag5LeHK5YDrSpxWW4 GpAdhX8NBS+oX3HbxCOpO90jlGSWMWR6oBJTALcag9JisDIg1UYjzTWgZNtTMye/LS/e 2uDA== 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 k185-v6si1446371pgk.672.2018.08.28.08.53.53; Tue, 28 Aug 2018 08:54:08 -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 S1727742AbeH1Ton (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:43 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41076 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1Tom (ORCPT ); Tue, 28 Aug 2018 15:44:42 -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 CC74915BF; Tue, 28 Aug 2018 08:52:25 -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 DE7143F557; Tue, 28 Aug 2018 08:52:23 -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 Subject: [PATCH v5 16/27] arm64: daifflags: Include PMR in daifflags restore operations Date: Tue, 28 Aug 2018 16:51:26 +0100 Message-Id: <1535471497-38854-17-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 The addition of PMR should not bypass the semantics of daifflags. When DA_F are set, I bit is also set as no interrupts (even of higher priority) is allowed. When DA_F are cleared, I bit is cleared and interrupt enabling/disabling goes through ICC_PMR_EL1. Signed-off-by: Julien Thierry Cc: Catalin Marinas Cc: Will Deacon Cc: James Morse --- arch/arm64/include/asm/daifflags.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/daifflags.h b/arch/arm64/include/asm/daifflags.h index 8d91f22..ccd95e8 100644 --- a/arch/arm64/include/asm/daifflags.h +++ b/arch/arm64/include/asm/daifflags.h @@ -18,8 +18,14 @@ #include -#define DAIF_PROCCTX 0 -#define DAIF_PROCCTX_NOIRQ PSR_I_BIT +#include + +#define DAIF_PROCCTX MAKE_ARCH_FLAGS(0, ICC_PMR_EL1_UNMASKED) + +#define DAIF_PROCCTX_NOIRQ \ + (gic_prio_masking_enabled() ? \ + MAKE_ARCH_FLAGS(0, ICC_PMR_EL1_MASKED) : \ + MAKE_ARCH_FLAGS(PSR_I_BIT, ICC_PMR_EL1_UNMASKED)) /* mask/save/unmask/restore all exceptions, including interrupts. */ static inline void local_daif_mask(void) @@ -51,6 +57,10 @@ static inline void local_daif_unmask(void) : : : "memory"); + + /* Unmask IRQs in PMR if needed */ + if (gic_prio_masking_enabled()) + arch_local_irq_enable(); } static inline void local_daif_restore(unsigned long flags) -- 1.9.1