Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8522003imu; Tue, 4 Dec 2018 09:37:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/XNJF5Am9a8ZC4JvQOv1l2uHn2nuvkINL4FxP5lGsP9rE01m2QrN4fdUWyAt+bGsnEtjlYB X-Received: by 2002:a63:a51b:: with SMTP id n27mr17841661pgf.17.1543945058391; Tue, 04 Dec 2018 09:37:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543945058; cv=none; d=google.com; s=arc-20160816; b=Z48KCnJu9zutsAywbQU5tbTK7idbaKOOiMaXxTm5zXDCZ2WI9Zv7xQRQDj6GLB5h+2 p8vLyqB4ovROCHNE6rEiFG3DUYKYSl7HHtU7lr2fdO7jreGtPsxud7rWHkPiC7PDkx7/ hEYggU0zj2GEZZkvNt3k/+UflwUv9gOSpuyx7F/iSsTHy845Kdvwj1Wy2D5oG4L4Aq+o yJE+bhLqkDDxjmMqL9v7ulRpMVgL8+F7dIBP+QhgUCtVJuzvP1ju9tnEjwQYm6qmmes5 L7oKunCm8T9eQeE7YIRkzfNMCVkwSnUGEEvnHu3HYy/gOcExVZQ65gAs5ZvyaJFHULdS gA+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1uZANQaNvXpavhzXmMbfD62zNDwHVsCOge1AedSYqsM=; b=yzAaSs8dOrvKxgOFi+0yrpgJ9kJ12khn57G1iNUmzAquEEQorwswcPX/6CrRkh5d/M usojJ/6ek9Wjwzn+2BGv1mhxaif2viq1m0UoNxdWY1ON9hvC8c5Qw9Ty0oeGLLlOknzY 6dmHUcNaaf9AmqrMYzBd9L5AofTkgbieTFSjT+Vbll1uiWwKFK6vYx/ff2zEemahzqSP BG+TAqHSY10prxlaXZ5CH12nBEZMzJBXm++X75I77rImJCxn350LzEPAG5T3vbaUGGCi NA1MOi2ooZwf47dJas+xFiYFpYCwpqXYRARuS1FZZa2ZHbkcRoH4fRMwJgVAXGC/6G8s gDxg== 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 l14si15698983pgi.147.2018.12.04.09.37.23; Tue, 04 Dec 2018 09:37:38 -0800 (PST) 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 S1727301AbeLDRgQ (ORCPT + 99 others); Tue, 4 Dec 2018 12:36:16 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:37840 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726056AbeLDRgP (ORCPT ); Tue, 4 Dec 2018 12:36:15 -0500 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 36368A78; Tue, 4 Dec 2018 09:36:15 -0800 (PST) Received: from arrakis.emea.arm.com (arrakis.cambridge.arm.com [10.1.196.113]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 459533F59C; Tue, 4 Dec 2018 09:36:13 -0800 (PST) Date: Tue, 4 Dec 2018 17:36:10 +0000 From: Catalin Marinas To: Julien Thierry Cc: linux-arm-kernel@lists.infradead.org, daniel.thompson@linaro.org, marc.zyngier@arm.com, Ard Biesheuvel , will.deacon@arm.com, linux-kernel@vger.kernel.org, christoffer.dall@arm.com, james.morse@arm.com, Oleg Nesterov , joel@joelfernandes.org Subject: Re: [PATCH v6 10/24] arm64: irqflags: Use ICC_PMR_EL1 for interrupt masking Message-ID: <20181204173610.GC19210@arrakis.emea.arm.com> References: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> <1542023835-21446-11-git-send-email-julien.thierry@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1542023835-21446-11-git-send-email-julien.thierry@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 12, 2018 at 11:57:01AM +0000, Julien Thierry wrote: > diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h > index 24692ed..e0a32e4 100644 > --- a/arch/arm64/include/asm/irqflags.h > +++ b/arch/arm64/include/asm/irqflags.h > @@ -18,7 +18,27 @@ > > #ifdef __KERNEL__ > > +#include > +#include > #include > +#include > + > + > +/* > + * When ICC_PMR_EL1 is used for interrupt masking, only the bit indicating > + * whether the normal interrupts are masked is kept along with the daif > + * flags. > + */ > +#define ARCH_FLAG_PMR_EN 0x1 > + > +#define MAKE_ARCH_FLAGS(daif, pmr) \ > + ((daif) | (((pmr) >> GIC_PRIO_STATUS_SHIFT) & ARCH_FLAG_PMR_EN)) > + > +#define ARCH_FLAGS_GET_PMR(flags) \ > + ((((flags) & ARCH_FLAG_PMR_EN) << GIC_PRIO_STATUS_SHIFT) \ > + | GIC_PRIO_IRQOFF) > + > +#define ARCH_FLAGS_GET_DAIF(flags) ((flags) & ~ARCH_FLAG_PMR_EN) I wonder whether we could just use the PSR_I_BIT here to decide whether to set the GIC_PRIO_IRQ{ON,OFF}. We could clear the PSR_I_BIT in _restore_daif() with an alternative. > +/* > + * CPU interrupt mask handling. > + */ > static inline void arch_local_irq_enable(void) > { > - asm volatile( > - "msr daifclr, #2 // arch_local_irq_enable" > - : > + unsigned long unmasked = GIC_PRIO_IRQON; > + > + asm volatile(ALTERNATIVE( > + "msr daifclr, #2 // arch_local_irq_enable\n" > + "nop", > + "msr_s " __stringify(SYS_ICC_PMR_EL1) ",%0\n" > + "dsb sy", > + ARM64_HAS_IRQ_PRIO_MASKING) DSB needed here as well? I guess I'd have to read the GIC spec before asking again ;). -- Catalin