From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
Will Deacon <will@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Valentin Schneider <valentin.schneider@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
Russell King <linux@armlinux.org.uk>,
kernel-team@android.com
Subject: Re: [PATCH 2/3] arm64: Convert cpu_do_idle() to using cpuidle context helpers
Date: Fri, 11 Jun 2021 17:48:08 +0100 [thread overview]
Message-ID: <20210611164808.GB9252@lpieralisi> (raw)
In-Reply-To: <20210608172715.2396787-3-maz@kernel.org>
On Tue, Jun 08, 2021 at 06:27:14PM +0100, Marc Zyngier wrote:
> Now that we have helpers that are aware of the pseudo-NMI
> feature, introduce them to cpu_do_idle(). This allows for
> some nice cleanup.
>
> No functional change intended.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
> arch/arm64/kernel/process.c | 41 ++++++++-----------------------------
> 1 file changed, 9 insertions(+), 32 deletions(-)
Reviewed-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
> diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c
> index b4bb67f17a2c..f99144eda8dc 100644
> --- a/arch/arm64/kernel/process.c
> +++ b/arch/arm64/kernel/process.c
> @@ -46,9 +46,9 @@
> #include <linux/prctl.h>
>
> #include <asm/alternative.h>
> -#include <asm/arch_gicv3.h>
> #include <asm/compat.h>
> #include <asm/cpufeature.h>
> +#include <asm/cpuidle.h>
> #include <asm/cacheflush.h>
> #include <asm/exec.h>
> #include <asm/fpsimd.h>
> @@ -74,33 +74,6 @@ EXPORT_SYMBOL_GPL(pm_power_off);
>
> void (*arm_pm_restart)(enum reboot_mode reboot_mode, const char *cmd);
>
> -static void noinstr __cpu_do_idle(void)
> -{
> - dsb(sy);
> - wfi();
> -}
> -
> -static void noinstr __cpu_do_idle_irqprio(void)
> -{
> - unsigned long pmr;
> - unsigned long daif_bits;
> -
> - daif_bits = read_sysreg(daif);
> - write_sysreg(daif_bits | PSR_I_BIT | PSR_F_BIT, daif);
> -
> - /*
> - * Unmask PMR before going idle to make sure interrupts can
> - * be raised.
> - */
> - pmr = gic_read_pmr();
> - gic_write_pmr(GIC_PRIO_IRQON | GIC_PRIO_PSR_I_SET);
> -
> - __cpu_do_idle();
> -
> - gic_write_pmr(pmr);
> - write_sysreg(daif_bits, daif);
> -}
> -
> /*
> * cpu_do_idle()
> *
> @@ -112,10 +85,14 @@ static void noinstr __cpu_do_idle_irqprio(void)
> */
> void noinstr cpu_do_idle(void)
> {
> - if (system_uses_irq_prio_masking())
> - __cpu_do_idle_irqprio();
> - else
> - __cpu_do_idle();
> + struct arm_cpuidle_context context;
> +
> + arm_cpuidle_save_context(&context);
> +
> + dsb(sy);
> + wfi();
> +
> + arm_cpuidle_restore_context(&context);
> }
>
> /*
> --
> 2.30.2
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2021-06-11 16:50 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-08 17:27 [PATCH 0/3] arm64: Fix cpuidle with pseudo-NMI enabled Marc Zyngier
2021-06-08 17:27 ` [PATCH 1/3] arm64: Add cpuidle context save/restore helpers Marc Zyngier
2021-06-11 16:46 ` Lorenzo Pieralisi
2021-06-12 12:04 ` Marc Zyngier
2021-06-16 12:07 ` Lorenzo Pieralisi
2021-06-08 17:27 ` [PATCH 2/3] arm64: Convert cpu_do_idle() to using cpuidle context helpers Marc Zyngier
2021-06-11 16:48 ` Lorenzo Pieralisi [this message]
2021-06-08 17:27 ` [PATCH 3/3] PSCI: Use cpuidle context helpers in psci_cpu_suspend_enter() Marc Zyngier
2021-06-08 18:20 ` Sudeep Holla
2021-06-11 16:49 ` Lorenzo Pieralisi
2021-06-09 14:46 ` [PATCH 0/3] arm64: Fix cpuidle with pseudo-NMI enabled Valentin Schneider
2021-06-09 14:58 ` Valentin Schneider
2021-06-10 16:28 ` Lorenzo Pieralisi
2021-06-10 17:43 ` Sudeep Holla
2021-06-11 8:24 ` Marc Zyngier
2021-06-11 8:19 ` Marc Zyngier
2021-06-11 9:41 ` Lorenzo Pieralisi
2021-06-11 11:32 ` Marc Zyngier
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=20210611164808.GB9252@lpieralisi \
--to=lorenzo.pieralisi@arm.com \
--cc=alexandru.elisei@arm.com \
--cc=catalin.marinas@arm.com \
--cc=kernel-team@android.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=valentin.schneider@arm.com \
--cc=will@kernel.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