public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 07/13] arm64: Add new routine local_disable
Date: Mon, 15 Sep 2014 19:56:26 +0100	[thread overview]
Message-ID: <20140915185625.GB14191@leverpostej> (raw)
In-Reply-To: <8db284c1443918ca692a5c2e30a0c7f13b37428f.1410302383.git.geoff@infradead.org>

Hi Geoff,

On Tue, Sep 09, 2014 at 11:49:04PM +0100, Geoff Levand wrote:
> Add the new arm64 routine local_disable() to allow the masking of several DAIF
> flags in one operation.  Currently, we only have routines to mask individual
> flags, and to mask several flags multiple calls to daifset are required.
>
> Signed-off-by: Geoff Levand <geoff@infradead.org>
> ---
>  arch/arm64/include/asm/irqflags.h | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/irqflags.h b/arch/arm64/include/asm/irqflags.h
> index 11cc941..28521d4 100644
> --- a/arch/arm64/include/asm/irqflags.h
> +++ b/arch/arm64/include/asm/irqflags.h
> @@ -113,5 +113,18 @@ static inline int arch_irqs_disabled_flags(unsigned long flags)
>  #define local_dbg_enable()	asm("msr	daifclr, #8" : : : "memory")
>  #define local_dbg_disable()	asm("msr	daifset, #8" : : : "memory")
>  
> +enum daif_flag {

Is there any reason for this to be an enum rather than a set of
#defines?

It would be nice to be able to use these in asm.

> +	DAIF_FIQ   = (1UL << 6),
> +	DAIF_IRQ   = (1UL << 7),
> +	DAIF_ASYNC = (1UL << 8),
> +	DAIF_DBG   = (1UL << 9),
> +	DAIF_ALL   = (0xffUL << 6),

Not 0xf?

It would be nicer to OR the other flags.

> +};
> +
> +static inline void local_disable(unsigned long daif_flags)
> +{
> +	arch_local_irq_restore(daif_flags | arch_local_save_flags());

If we knew the value was a constant (which we could check with
__builting_constant_p) we could use daifset here, rather than having a
RMW sequence.

With that, the other local_*_{enable,disable} calls could be rewritten
in terms of this, without affecting the generated code. That would
require some shifting to account for the difference between pstate and
daif{clr,set} layout, but for constants that shouldn't be a problem.

Thanks,
Mark.

  reply	other threads:[~2014-09-15 18:56 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 22:51 [PATCH 00/13] arm64 kexec kernel patches V2 Geoff Levand
2014-09-09 22:49 ` [PATCH 06/13] arm64: Add new routine read_cpu_properties Geoff Levand
2014-09-15 18:42   ` Mark Rutland
2014-09-25  0:23     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 05/13] arm64: Add EL2 switch to soft_restart Geoff Levand
2014-09-09 22:49 ` [PATCH 01/13] arm64: Add ESR_EL2_EC macros to hyp-stub Geoff Levand
2014-09-15 16:10   ` Mark Rutland
2014-09-22 21:45     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 04/13] arm64: Add new hcall HVC_CALL_FUNC Geoff Levand
2014-09-10 17:07   ` Will Deacon
2014-09-10 17:23     ` Geoff Levand
2014-09-10 17:35       ` Will Deacon
2014-09-10 18:11   ` [PATCH V2 " Geoff Levand
2014-09-15 18:11   ` [PATCH " Mark Rutland
2014-09-25  0:24     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 03/13] arm64: Convert hcalls to use ISS field Geoff Levand
2014-09-11 16:14   ` Arun Chandran
2014-09-15 17:57   ` Mark Rutland
2014-09-22 21:46     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 07/13] arm64: Add new routine local_disable Geoff Levand
2014-09-15 18:56   ` Mark Rutland [this message]
2014-09-25  0:24     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 02/13] arm64/kvm: Fix assembler compatibility of macros Geoff Levand
2014-09-10  8:40   ` Ard Biesheuvel
2014-09-10 16:35     ` Geoff Levand
2014-09-10 17:09       ` Ard Biesheuvel
2014-09-15 16:14         ` Mark Rutland
2014-09-10 18:04   ` [PATCH V2 " Geoff Levand
2014-09-09 22:49 ` [PATCH 13/13] arm64/kexec: Add kexec_ignore_compat_check param Geoff Levand
2014-09-09 22:49 ` [PATCH 09/13] arm64/kexec: Kexec expects cpu_die Geoff Levand
2014-09-15 19:10   ` Mark Rutland
2014-09-09 22:49 ` [PATCH 11/13] arm64/kexec: Add core kexec support Geoff Levand
2014-09-18  1:13   ` Mark Rutland
2014-09-25  0:25     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 08/13] arm64: Use cpu_ops for smp_stop Geoff Levand
2014-09-15 19:06   ` Mark Rutland
2014-09-25  0:24     ` Geoff Levand
2014-09-09 22:49 ` [PATCH 10/13] arm64/kexec: Revert change to machine_shutdown() Geoff Levand
2014-09-15 19:20   ` Mark Rutland
2014-09-09 22:49 ` [PATCH 12/13] arm64/kexec: Enable kexec in the arm64 defconfig Geoff Levand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140915185625.GB14191@leverpostej \
    --to=mark.rutland@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox