Commit 788b8f6a authored by Jinjie Ruan's avatar Jinjie Ruan Committed by Will Deacon
Browse files

arm64: ptrace: Replace interrupts_enabled() with regs_irqs_disabled()



The generic entry code expects architecture code to provide
regs_irqs_disabled(regs) function, but arm64 does not have this and
provides interrupts_enabled(regs), which has the opposite polarity.

In preparation for moving arm64 over to the generic entry code,
relace arm64's interrupts_enabled() with regs_irqs_disabled() and
update its callers under arch/arm64.

For the moment, a definition of interrupts_enabled() is provided for
the GICv3 driver. Once arch/arm implement regs_irqs_disabled(), this
can be removed.

Delete the fast_interrupts_enabled() macro as it is unused and we
don't want any new users to show up.

No functional changes.

Reviewed-by: default avatarAda Couprie Diaz <ada.coupriediaz@arm.com>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
Suggested-by: default avatarMark Rutland <mark.rutland@arm.com>
Signed-off-by: default avatarJinjie Ruan <ruanjinjie@huawei.com>
Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Signed-off-by: default avatarWill Deacon <will@kernel.org>
parent 8f5ae30d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static inline void local_daif_inherit(struct pt_regs *regs)
{
	unsigned long flags = regs->pstate & DAIF_MASK;

	if (interrupts_enabled(regs))
	if (!regs_irqs_disabled(regs))
		trace_hardirqs_on();

	if (system_uses_irq_prio_masking())
+5 −4
Original line number Diff line number Diff line
@@ -214,11 +214,12 @@ static inline void forget_syscall(struct pt_regs *regs)
		(regs)->pmr == GIC_PRIO_IRQON :				\
		true)

#define interrupts_enabled(regs)			\
	(!((regs)->pstate & PSR_I_BIT) && irqs_priority_unmasked(regs))
static __always_inline bool regs_irqs_disabled(const struct pt_regs *regs)
{
	return (regs->pstate & PSR_I_BIT) || !irqs_priority_unmasked(regs);
}

#define fast_interrupts_enabled(regs) \
	(!((regs)->pstate & PSR_F_BIT))
#define interrupts_enabled(regs)	(!regs_irqs_disabled(regs))

static inline unsigned long user_stack_pointer(struct pt_regs *regs)
{
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ enum ipi_vector {

static inline int xen_irqs_disabled(struct pt_regs *regs)
{
	return !interrupts_enabled(regs);
	return regs_irqs_disabled(regs);
}

#define xchg_xen_ulong(ptr, val) xchg((ptr), (val))
+1 −1
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ int apei_claim_sea(struct pt_regs *regs)
	return_to_irqs_enabled = !irqs_disabled_flags(arch_local_save_flags());

	if (regs)
		return_to_irqs_enabled = interrupts_enabled(regs);
		return_to_irqs_enabled = !regs_irqs_disabled(regs);

	/*
	 * SEA can interrupt SError, mask it and describe this as an NMI so
+1 −1
Original line number Diff line number Diff line
@@ -167,7 +167,7 @@ static void send_user_sigtrap(int si_code)
	if (WARN_ON(!user_mode(regs)))
		return;

	if (interrupts_enabled(regs))
	if (!regs_irqs_disabled(regs))
		local_irq_enable();

	arm64_force_sig_fault(SIGTRAP, si_code, instruction_pointer(regs),
Loading