From: Mark Rutland <mark.rutland@arm.com>
To: Liao Chang <liaochang1@huawei.com>
Cc: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org,
oliver.upton@linux.dev, james.morse@arm.com,
suzuki.poulose@arm.com, yuzenghui@huawei.com, tglx@linutronix.de,
ardb@kernel.org, broonie@kernel.org, anshuman.khandual@arm.com,
miguel.luis@oracle.com, joey.gouly@arm.com, ryan.roberts@arm.com,
jeremy.linton@arm.com, ericchancf@google.com,
kristina.martsenko@arm.com, robh@kernel.org,
scott@os.amperecomputing.com, songshuaishuai@tinylab.org,
shijie@os.amperecomputing.com, akpm@linux-foundation.org,
bhe@redhat.com, horms@kernel.org, mhiramat@kernel.org,
rmk+kernel@armlinux.org.uk, shahuang@redhat.com,
takakura@valinux.co.jp, dianders@chromium.org,
swboyd@chromium.org, sumit.garg@linaro.org, frederic@kernel.org,
reijiw@google.com, akihiko.odaki@daynix.com,
ruanjinjie@huawei.com, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev
Subject: Re: [PATCH v3 1/8] arm64/sysreg: Add definitions for immediate versions of MSR ALLINT
Date: Fri, 3 May 2024 17:00:49 +0100 [thread overview]
Message-ID: <ZjUKMWPknEhLYoK8@FVFF77S0Q05N> (raw)
In-Reply-To: <20240415064758.3250209-2-liaochang1@huawei.com>
On Mon, Apr 15, 2024 at 06:47:51AM +0000, Liao Chang wrote:
> From: Mark Brown <broonie@kernel.org>
>
> Encodings are provided for ALLINT which allow setting of ALLINT.ALLINT
> using an immediate rather than requiring that a register be loaded with
> the value to write. Since these don't currently fit within the scheme we
> have for sysreg generation add manual encodings like we currently do for
> other similar registers such as SVCR.
>
> Since it is required that these immediate versions be encoded with xzr
> as the source register provide asm wrapper which ensure this is the
> case.
>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> ---
> arch/arm64/include/asm/nmi.h | 27 +++++++++++++++++++++++++++
> arch/arm64/include/asm/sysreg.h | 2 ++
> 2 files changed, 29 insertions(+)
> create mode 100644 arch/arm64/include/asm/nmi.h
We have helpers for manipulating PSTATE bits; AFAICT we only need the three
lines below:
----8<----
diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 9e8999592f3af..5c209d07ae57e 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -94,18 +94,21 @@
#define PSTATE_PAN pstate_field(0, 4)
#define PSTATE_UAO pstate_field(0, 3)
+#define PSTATE_ALLINT pstate_field(1, 0)
#define PSTATE_SSBS pstate_field(3, 1)
#define PSTATE_DIT pstate_field(3, 2)
#define PSTATE_TCO pstate_field(3, 4)
#define SET_PSTATE_PAN(x) SET_PSTATE((x), PAN)
#define SET_PSTATE_UAO(x) SET_PSTATE((x), UAO)
+#define SET_PSTATE_ALLINT(x) SET_PSTATE((x), ALLINT)
#define SET_PSTATE_SSBS(x) SET_PSTATE((x), SSBS)
#define SET_PSTATE_DIT(x) SET_PSTATE((x), DIT)
#define SET_PSTATE_TCO(x) SET_PSTATE((x), TCO)
#define set_pstate_pan(x) asm volatile(SET_PSTATE_PAN(x))
#define set_pstate_uao(x) asm volatile(SET_PSTATE_UAO(x))
+#define set_pstate_allint(x) asm volatile(SET_PSTATE_ALLINT(x))
#define set_pstate_ssbs(x) asm volatile(SET_PSTATE_SSBS(x))
#define set_pstate_dit(x) asm volatile(SET_PSTATE_DIT(x))
---->8----
The addition of <asm/nmi.h> and refrences to <linux/cpumask.h> and
arm64_supports_nmi() don't seem like they should be part of this patch.
Mark.
>
> diff --git a/arch/arm64/include/asm/nmi.h b/arch/arm64/include/asm/nmi.h
> new file mode 100644
> index 000000000000..0c566c649485
> --- /dev/null
> +++ b/arch/arm64/include/asm/nmi.h
> @@ -0,0 +1,27 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +/*
> + * Copyright (C) 2022 ARM Ltd.
> + */
> +#ifndef __ASM_NMI_H
> +#define __ASM_NMI_H
> +
> +#ifndef __ASSEMBLER__
> +
> +#include <linux/cpumask.h>
> +
> +extern bool arm64_supports_nmi(void);
> +
> +#endif /* !__ASSEMBLER__ */
> +
> +static __always_inline void _allint_clear(void)
> +{
> + asm volatile(__msr_s(SYS_ALLINT_CLR, "xzr"));
> +}
> +
> +static __always_inline void _allint_set(void)
> +{
> + asm volatile(__msr_s(SYS_ALLINT_SET, "xzr"));
> +}
> +
> +#endif
> +
> diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
> index 9e8999592f3a..b105773c57ca 100644
> --- a/arch/arm64/include/asm/sysreg.h
> +++ b/arch/arm64/include/asm/sysreg.h
> @@ -167,6 +167,8 @@
> * System registers, organised loosely by encoding but grouped together
> * where the architected name contains an index. e.g. ID_MMFR<n>_EL1.
> */
> +#define SYS_ALLINT_CLR sys_reg(0, 1, 4, 0, 0)
> +#define SYS_ALLINT_SET sys_reg(0, 1, 4, 1, 0)
> #define SYS_SVCR_SMSTOP_SM_EL0 sys_reg(0, 3, 4, 2, 3)
> #define SYS_SVCR_SMSTART_SM_EL0 sys_reg(0, 3, 4, 3, 3)
> #define SYS_SVCR_SMSTOP_SMZA_EL0 sys_reg(0, 3, 4, 6, 3)
> --
> 2.34.1
>
_______________________________________________
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:[~2024-05-03 16:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-15 6:47 [PATCH v3 0/8] Rework the DAIF mask, unmask and track API Liao Chang
2024-04-15 6:47 ` [PATCH v3 1/8] arm64/sysreg: Add definitions for immediate versions of MSR ALLINT Liao Chang
2024-05-03 16:00 ` Mark Rutland [this message]
2024-05-06 12:12 ` Liao, Chang
2024-05-06 15:15 ` Mark Brown
2024-05-07 7:41 ` Liao, Chang
2024-05-07 14:52 ` Mark Brown
2024-06-03 3:26 ` Liao, Chang
2024-06-04 13:29 ` Mark Brown
2024-06-05 9:52 ` Liao, Chang
2024-06-14 4:00 ` Liao, Chang
2024-04-15 6:47 ` [PATCH v3 2/8] arm64/cpufeature: Detect PE support for FEAT_NMI Liao Chang
2024-04-15 6:47 ` [PATCH v3 3/8] arm64/nmi: Add Kconfig for NMI Liao Chang
2024-04-15 6:47 ` [PATCH v3 4/8] arm64: daifflags: Add logical exception masks covering DAIF + PMR + ALLINT Liao Chang
2024-04-15 6:47 ` [PATCH v3 5/8] arm64: Unify exception masking at entry and exit of exception Liao Chang
2024-04-15 6:47 ` [PATCH v3 6/8] arm64: Deprecate old local_daif_{mask,save,restore} Liao Chang
2024-04-15 6:47 ` [PATCH v3 7/8] irqchip/gic-v3: Improve the maintainability of NMI masking in GIC driver Liao Chang
2024-04-15 6:47 ` [PATCH v3 8/8] arm64: kprobe: Keep NMI maskabled while kprobe is stepping xol Liao Chang
2024-05-03 17:10 ` [PATCH v3 0/8] Rework the DAIF mask, unmask and track API Mark Rutland
2024-05-06 12:12 ` Liao, Chang
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=ZjUKMWPknEhLYoK8@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=akihiko.odaki@daynix.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=bhe@redhat.com \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=dianders@chromium.org \
--cc=ericchancf@google.com \
--cc=frederic@kernel.org \
--cc=horms@kernel.org \
--cc=james.morse@arm.com \
--cc=jeremy.linton@arm.com \
--cc=joey.gouly@arm.com \
--cc=kristina.martsenko@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=liaochang1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=mhiramat@kernel.org \
--cc=miguel.luis@oracle.com \
--cc=oliver.upton@linux.dev \
--cc=reijiw@google.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=robh@kernel.org \
--cc=ruanjinjie@huawei.com \
--cc=ryan.roberts@arm.com \
--cc=scott@os.amperecomputing.com \
--cc=shahuang@redhat.com \
--cc=shijie@os.amperecomputing.com \
--cc=songshuaishuai@tinylab.org \
--cc=sumit.garg@linaro.org \
--cc=suzuki.poulose@arm.com \
--cc=swboyd@chromium.org \
--cc=takakura@valinux.co.jp \
--cc=tglx@linutronix.de \
--cc=will@kernel.org \
--cc=yuzenghui@huawei.com \
/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