diff mbox series

[v1,2/2] selftests/arm64: add HWCAP2_HBC test

Message ID 20230801100008.3125054-3-joey.gouly@arm.com (mailing list archive)
State New, archived
Headers show
Series HWCAP for FEAT_HBC | expand

Commit Message

Joey Gouly Aug. 1, 2023, 10 a.m. UTC
Add a test for the newly added HWCAP2_HBC.

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 | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Will Deacon Aug. 1, 2023, 3:09 p.m. UTC | #1
On Tue, Aug 01, 2023 at 11:00:08AM +0100, Joey Gouly wrote:
> Add a test for the newly added HWCAP2_HBC.
> 
> 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 | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
> index d4ad813fed10..296102cd9192 100644
> --- a/tools/testing/selftests/arm64/abi/hwcap.c
> +++ b/tools/testing/selftests/arm64/abi/hwcap.c
> @@ -208,6 +208,13 @@ static void svebf16_sigill(void)
>  	asm volatile(".inst 0x658aa000" : : : "z0");
>  }
>  
> +static void hbc_sigill(void)
> +{
> +	/* BC.EQ +4 */
> +	asm volatile("cmp xzr, xzr\n"
> +		     ".inst 0x54000030" : : :);
> +}

Do you need a "cc" clobber here, or is that implicit somehow?

Will
Joey Gouly Aug. 1, 2023, 3:26 p.m. UTC | #2
On Tue, Aug 01, 2023 at 04:09:14PM +0100, Will Deacon wrote:
> On Tue, Aug 01, 2023 at 11:00:08AM +0100, Joey Gouly wrote:
> > Add a test for the newly added HWCAP2_HBC.
> > 
> > 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 | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
> > index d4ad813fed10..296102cd9192 100644
> > --- a/tools/testing/selftests/arm64/abi/hwcap.c
> > +++ b/tools/testing/selftests/arm64/abi/hwcap.c
> > @@ -208,6 +208,13 @@ static void svebf16_sigill(void)
> >  	asm volatile(".inst 0x658aa000" : : : "z0");
> >  }
> >  
> > +static void hbc_sigill(void)
> > +{
> > +	/* BC.EQ +4 */
> > +	asm volatile("cmp xzr, xzr\n"
> > +		     ".inst 0x54000030" : : :);
> > +}
> 
> Do you need a "cc" clobber here, or is that implicit somehow?

I do, thanks for pointing that out. 

Thanks,
Joey
diff mbox series

Patch

diff --git a/tools/testing/selftests/arm64/abi/hwcap.c b/tools/testing/selftests/arm64/abi/hwcap.c
index d4ad813fed10..296102cd9192 100644
--- a/tools/testing/selftests/arm64/abi/hwcap.c
+++ b/tools/testing/selftests/arm64/abi/hwcap.c
@@ -208,6 +208,13 @@  static void svebf16_sigill(void)
 	asm volatile(".inst 0x658aa000" : : : "z0");
 }
 
+static void hbc_sigill(void)
+{
+	/* BC.EQ +4 */
+	asm volatile("cmp xzr, xzr\n"
+		     ".inst 0x54000030" : : :);
+}
+
 static const struct hwcap_data {
 	const char *name;
 	unsigned long at_hwcap;
@@ -386,6 +393,14 @@  static const struct hwcap_data {
 		.hwcap_bit = HWCAP2_SVE_EBF16,
 		.cpuinfo = "sveebf16",
 	},
+	{
+		.name = "HBC",
+		.at_hwcap = AT_HWCAP2,
+		.hwcap_bit = HWCAP2_HBC,
+		.cpuinfo = "hbc",
+		.sigill_fn = hbc_sigill,
+		.sigill_reliable = true,
+	},
 };
 
 static bool seen_sigill;