linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 0/2] HWCAP for FEAT_LSE128
@ 2023-10-03 12:45 Joey Gouly
  2023-10-03 12:45 ` [PATCH v1 1/2] arm64: add FEAT_LSE128 HWCAP Joey Gouly
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Joey Gouly @ 2023-10-03 12:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, joey.gouly, will

Hi,

Here's a small patch set to add a HWCAP for FEAT_LSE128.

Non-sequential HWCAP number since I have other HWCAP patches on the ML (LRCPC3, POE).

Thanks,
Joey

Joey Gouly (2):
  arm64: add FEAT_LSE128 HWCAP
  kselftest/arm64: add FEAT_LSE128 to hwcap test

 Documentation/arch/arm64/elf_hwcaps.rst   |  3 +++
 arch/arm64/include/asm/hwcap.h            |  1 +
 arch/arm64/include/uapi/asm/hwcap.h       |  1 +
 arch/arm64/kernel/cpufeature.c            |  1 +
 arch/arm64/kernel/cpuinfo.c               |  1 +
 arch/arm64/tools/sysreg                   |  1 +
 tools/testing/selftests/arm64/abi/hwcap.c | 21 +++++++++++++++++++++
 7 files changed, 29 insertions(+)

-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] arm64: add FEAT_LSE128 HWCAP
  2023-10-03 12:45 [PATCH v1 0/2] HWCAP for FEAT_LSE128 Joey Gouly
@ 2023-10-03 12:45 ` Joey Gouly
  2023-10-03 12:45 ` [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test Joey Gouly
  2023-10-13 18:44 ` [PATCH v1 0/2] HWCAP for FEAT_LSE128 Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Joey Gouly @ 2023-10-03 12:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, joey.gouly, will

Add HWCAP for FEAT_LSE128 (128-bit Atomic instructions).

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 Documentation/arch/arm64/elf_hwcaps.rst | 3 +++
 arch/arm64/include/asm/hwcap.h          | 1 +
 arch/arm64/include/uapi/asm/hwcap.h     | 1 +
 arch/arm64/kernel/cpufeature.c          | 1 +
 arch/arm64/kernel/cpuinfo.c             | 1 +
 arch/arm64/tools/sysreg                 | 1 +
 6 files changed, 8 insertions(+)

diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst
index 76ff9d7398fd..2b8a79f91275 100644
--- a/Documentation/arch/arm64/elf_hwcaps.rst
+++ b/Documentation/arch/arm64/elf_hwcaps.rst
@@ -308,6 +308,9 @@ HWCAP2_MOPS
 HWCAP2_HBC
     Functionality implied by ID_AA64ISAR2_EL1.BC == 0b0001.
 
+HWCAP2_LSE128
+    Functionality implied by ID_AA64ISAR0_EL1.Atomic == 0b0011.
+
 4. Unused AT_HWCAP bits
 -----------------------
 
diff --git a/arch/arm64/include/asm/hwcap.h b/arch/arm64/include/asm/hwcap.h
index 521267478d18..bb3b8dce21a8 100644
--- a/arch/arm64/include/asm/hwcap.h
+++ b/arch/arm64/include/asm/hwcap.h
@@ -139,6 +139,7 @@
 #define KERNEL_HWCAP_SME_F16F16		__khwcap2_feature(SME_F16F16)
 #define KERNEL_HWCAP_MOPS		__khwcap2_feature(MOPS)
 #define KERNEL_HWCAP_HBC		__khwcap2_feature(HBC)
+#define KERNEL_HWCAP_LSE128		__khwcap2_feature(LSE128)
 
 /*
  * This yields a mask that user programs can use to figure out what
diff --git a/arch/arm64/include/uapi/asm/hwcap.h b/arch/arm64/include/uapi/asm/hwcap.h
index 53026f45a509..8641ebe0a106 100644
--- a/arch/arm64/include/uapi/asm/hwcap.h
+++ b/arch/arm64/include/uapi/asm/hwcap.h
@@ -104,5 +104,6 @@
 #define HWCAP2_SME_F16F16	(1UL << 42)
 #define HWCAP2_MOPS		(1UL << 43)
 #define HWCAP2_HBC		(1UL << 44)
+#define HWCAP2_LSE128		(1UL << 47)
 
 #endif /* _UAPI__ASM_HWCAP_H */
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index 444a73c2e638..0589363e2d2c 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -2787,6 +2787,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
 	HWCAP_CAP(ID_AA64ISAR0_EL1, SHA2, SHA512, CAP_HWCAP, KERNEL_HWCAP_SHA512),
 	HWCAP_CAP(ID_AA64ISAR0_EL1, CRC32, IMP, CAP_HWCAP, KERNEL_HWCAP_CRC32),
 	HWCAP_CAP(ID_AA64ISAR0_EL1, ATOMIC, IMP, CAP_HWCAP, KERNEL_HWCAP_ATOMICS),
+	HWCAP_CAP(ID_AA64ISAR0_EL1, ATOMIC, FEAT_LSE128, CAP_HWCAP, KERNEL_HWCAP_LSE128),
 	HWCAP_CAP(ID_AA64ISAR0_EL1, RDM, IMP, CAP_HWCAP, KERNEL_HWCAP_ASIMDRDM),
 	HWCAP_CAP(ID_AA64ISAR0_EL1, SHA3, IMP, CAP_HWCAP, KERNEL_HWCAP_SHA3),
 	HWCAP_CAP(ID_AA64ISAR0_EL1, SM3, IMP, CAP_HWCAP, KERNEL_HWCAP_SM3),
diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
index 98fda8500535..52d2589aa1d1 100644
--- a/arch/arm64/kernel/cpuinfo.c
+++ b/arch/arm64/kernel/cpuinfo.c
@@ -127,6 +127,7 @@ static const char *const hwcap_str[] = {
 	[KERNEL_HWCAP_SME_F16F16]	= "smef16f16",
 	[KERNEL_HWCAP_MOPS]		= "mops",
 	[KERNEL_HWCAP_HBC]		= "hbc",
+	[KERNEL_HWCAP_LSE128]		= "lse128",
 };
 
 #ifdef CONFIG_COMPAT
diff --git a/arch/arm64/tools/sysreg b/arch/arm64/tools/sysreg
index 76ce150e7347..fb8aaee9e0d9 100644
--- a/arch/arm64/tools/sysreg
+++ b/arch/arm64/tools/sysreg
@@ -1235,6 +1235,7 @@ EndEnum
 UnsignedEnum	23:20	ATOMIC
 	0b0000	NI
 	0b0010	IMP
+	0b0011	FEAT_LSE128
 EndEnum
 UnsignedEnum	19:16	CRC32
 	0b0000	NI
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test
  2023-10-03 12:45 [PATCH v1 0/2] HWCAP for FEAT_LSE128 Joey Gouly
  2023-10-03 12:45 ` [PATCH v1 1/2] arm64: add FEAT_LSE128 HWCAP Joey Gouly
@ 2023-10-03 12:45 ` Joey Gouly
  2023-10-09 14:52   ` Mark Brown
  2023-10-13 18:44 ` [PATCH v1 0/2] HWCAP for FEAT_LSE128 Catalin Marinas
  2 siblings, 1 reply; 5+ messages in thread
From: Joey Gouly @ 2023-10-03 12:45 UTC (permalink / raw)
  To: linux-arm-kernel; +Cc: catalin.marinas, joey.gouly, will

Add test of a 128-bit atomic instruction for FEAT_LSE128.

Signed-off-by: Joey Gouly <joey.gouly@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
---
 tools/testing/selftests/arm64/abi/hwcap.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
index e3d262831d91..dd9a1cdfd294 100644
--- a/tools/testing/selftests/arm64/abi/hwcap.c
+++ b/tools/testing/selftests/arm64/abi/hwcap.c
@@ -46,6 +46,20 @@ static void atomics_sigill(void)
 	asm volatile(".inst 0xb82003ff" : : : );
 }
 
+static void lse128_sigill(void)
+{
+	u64 __attribute__ ((aligned (16))) mem[2] = { 10, 20 };
+	register u64 *memp asm ("x0") = mem;
+	register u64 val0 asm ("x1") = 5;
+	register u64 val1 asm ("x2") = 4;
+
+	/* SWPP X1, X2, [X0] */
+	asm volatile(".inst 0x19228001"
+		     : "+r" (memp), "+r" (val0), "+r" (val1)
+		     :
+		     : "cc", "memory");
+}
+
 static void crc32_sigill(void)
 {
 	/* CRC32W W0, W0, W1 */
@@ -364,6 +378,13 @@ static const struct hwcap_data {
 		.sigbus_fn = uscat_sigbus,
 		.sigbus_reliable = true,
 	},
+	{
+		.name = "LSE128",
+		.at_hwcap = AT_HWCAP2,
+		.hwcap_bit = HWCAP2_LSE128,
+		.cpuinfo = "lse128",
+		.sigill_fn = lse128_sigill,
+	},
 	{
 		.name = "MOPS",
 		.at_hwcap = AT_HWCAP2,
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test
  2023-10-03 12:45 ` [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test Joey Gouly
@ 2023-10-09 14:52   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-10-09 14:52 UTC (permalink / raw)
  To: Joey Gouly; +Cc: linux-arm-kernel, catalin.marinas, will


[-- Attachment #1.1: Type: text/plain, Size: 586 bytes --]

On Tue, Oct 03, 2023 at 01:45:44PM +0100, Joey Gouly wrote:
> Add test of a 128-bit atomic instruction for FEAT_LSE128.
> 
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> ---
>  tools/testing/selftests/arm64/abi/hwcap.c | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)

>  	asm volatile(".inst 0xb82003ff" : : : );
>  }
>  
> +static void lse128_sigill(void)
> +{

...

> +}
> +
>  static void crc32_sigill(void)
>  {

Please keep things sorted alphabetically.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 0/2] HWCAP for FEAT_LSE128
  2023-10-03 12:45 [PATCH v1 0/2] HWCAP for FEAT_LSE128 Joey Gouly
  2023-10-03 12:45 ` [PATCH v1 1/2] arm64: add FEAT_LSE128 HWCAP Joey Gouly
  2023-10-03 12:45 ` [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test Joey Gouly
@ 2023-10-13 18:44 ` Catalin Marinas
  2 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2023-10-13 18:44 UTC (permalink / raw)
  To: linux-arm-kernel, Joey Gouly; +Cc: Will Deacon

On Tue, 03 Oct 2023 13:45:42 +0100, Joey Gouly wrote:
> Here's a small patch set to add a HWCAP for FEAT_LSE128.
> 
> Non-sequential HWCAP number since I have other HWCAP patches on the ML (LRCPC3, POE).
> 
> Thanks,
> Joey
> 
> [...]

Applied to arm64 (for-next/feat_lse128), thanks!

[1/2] arm64: add FEAT_LSE128 HWCAP
      https://git.kernel.org/arm64/c/94d0657f9f0d
[2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test
      https://git.kernel.org/arm64/c/72e301956dbb

-- 
Catalin


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-10-13 18:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-03 12:45 [PATCH v1 0/2] HWCAP for FEAT_LSE128 Joey Gouly
2023-10-03 12:45 ` [PATCH v1 1/2] arm64: add FEAT_LSE128 HWCAP Joey Gouly
2023-10-03 12:45 ` [PATCH v1 2/2] kselftest/arm64: add FEAT_LSE128 to hwcap test Joey Gouly
2023-10-09 14:52   ` Mark Brown
2023-10-13 18:44 ` [PATCH v1 0/2] HWCAP for FEAT_LSE128 Catalin Marinas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).