[Lldb-commits] [lldb] [lldb][AArch64] Fix Apple M4 on Linux (PR #135563)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu May 29 02:58:03 PDT 2025


DavidSpickett wrote:

This situation can also be simulated by telling the kernel to hide the SME feature, which should work the same in Arm's FVP or qemu-system.

If you're using shrinkwrap:
```
diff --git a/config/arch/v9.5.yaml b/config/arch/v9.5.yaml
index 789e64f..35e2629 100644
--- a/config/arch/v9.5.yaml
+++ b/config/arch/v9.5.yaml
@@ -16,3 +16,15 @@ run:
   params:
     -C cluster0.has_arm_v9-5: 1
     -C cluster1.has_arm_v9-5: 1
+    -C cluster0.has_sve : 1
+    -C cluster1.has_sve : 1
+    -C cluster0.sve.has_sme2 : 1
+    -C cluster1.sve.has_sme2 : 1
+    -C cluster0.sve.has_sme : 1
+    -C cluster1.sve.has_sme : 1
+    -C cluster0.sve.has_sve2 : 1
+    -C cluster1.sve.has_sve2 : 1
+    -C cluster0.sve.sme_only : 0
+    -C cluster1.sve.sme_only : 0
+    -C cluster0.sve.has_sme_fa64: 1
+    -C cluster1.sve.has_sme_fa64: 1
diff --git a/config/ns-edk2-base.yaml b/config/ns-edk2-base.yaml
index 452fcec..6a1d1c4 100644
--- a/config/ns-edk2-base.yaml
+++ b/config/ns-edk2-base.yaml
@@ -31,7 +31,7 @@ run:
 
     CMDLINE:
       type: string
-      value: console=ttyAMA0 earlycon=pl011,0x1c090000 root=/dev/vda ip=dhcp
+      value: console=ttyAMA0 earlycon=pl011,0x1c090000 root=/dev/vda ip=dhcp arm64.nosve
 
     KERNEL:
       type: path
```
Do **not** use `arm64.nosve=1` because it will silently ignore it, I definitely did not get very confused by this.

Then userspace will see:
```
$ cat /proc/cmdline
Image dtb=fdt.dtb console=ttyAMA0 earlycon=pl011,0x1c090000 root=/dev/vda ip=dhcp arm64.nosve
$ cat /proc/cpuinfo | grep Features | uniq
Features	: fp asimd evtstrm crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop asimddp asimdfhm dit uscat ilrcpc flagm sb paca pacg gcs dcpodp flagm2 frint i8mm bf16 dgh rng bti ecv afp sme smei16i64 smef64f64 smei8i32 smef16f32 smeb16f32 smef32f32 smefa64 wfxt ebf16 cssc sme2 smei16i32 smebi32i32 mops hbc poe
$ LD_SHOW_AUXV=1 sleep 1
AT_SYSINFO_EHDR:      0xffff8f9e4000
AT_MINSIGSTKSZ:       4720
AT_HWCAP:             1ef91ff87
AT_PAGESZ:            4096
AT_CLKTCK:            100
AT_PHDR:              0xaaaab02f0040
AT_PHENT:             56
AT_PHNUM:             9
AT_BASE:              0xffff8f9ac000
AT_FLAGS:             0x0
AT_ENTRY:             0xaaaab02f1c80
AT_UID:               1000
AT_EUID:              1000
AT_GID:               1000
AT_EGID:              1000
AT_SECURE:            0
AT_RANDOM:            0xffffc9129a38
AT_HWCAP2:            0x800019a5ff9be181
AT_??? (0x1d): 0x0
AT_EXECFN:            /usr/bin/sleep
AT_PLATFORM:          aarch64
AT_??? (0x1b): 0x1c
AT_??? (0x1c): 0x20
```
Decoding the HWCAPs:
```
$ diff hwcap_sve_sme hwcap_sme 
16d15
< HWCAP_SVE
28,29d26
< HWCAP2_SVE2
< HWCAP2_SVEBITPERM
32,35d28
< HWCAP2_SVEI8MM
< HWCAP2_SVEF32MM
< HWCAP2_SVEF64MM
< HWCAP2_SVEBF16
53d45
< HWCAP2_SVE_EBF16
```
You'll see only the SVE/SVE2 features are removed, SME remains.

@mstorsjo you wanted a QEMU way to test this, here it is. Still system emulation but good enough to respond to bug reports on a case by case basis.

https://github.com/llvm/llvm-project/pull/135563


More information about the lldb-commits mailing list