参考
软件版本
Qemu:8.0.0
Linux:6.5
GCC: 13.2.1
内核配置
参考arch/arm64/Kconfig:
- CONFIG_ARM64_AS_HAS_MTE: 当编译器支持memtag时,这个宏辉自动设置
- CONFIG_ARM64_MTE: 需要手动配置,默认就是y
Qemu启动参数
示例:
sudo /home/pengdl/work/Qemu_env/qemu-8.0.0/build/bin/qemu-system-aarch64 \
-M virt,gic-version=3,virtualization=on,type=virt,mte=on \
-cpu max -nographic -m 16G \
-smp 16 \
-object memory-backend-ram,id=mem0,size=8G \
-object memory-backend-ram,id=mem1,size=8G \
-numa node,memdev=mem0,cpus=0-7,nodeid=0 \
-numa node,memdev=mem1,cpus=8-15,nodeid=1 \
-kernel ./linux-6.5/arch/arm64/boot/Image.gz \
-append "noinitrd root=/dev/vda rootfstype=ext4 rw console=ttyAMA0 crashkernel=256M" \
-nographic \
-netdev user,id=eth0,hostfwd=tcp::8080-:22 -device virtio-net-device,netdev=eth0 \
-fsdev local,security_model=passthrough,id=fsdev0,path=/home/pengdl/work/Qemu_env/aarch64/share \
-device virtio-9p-pci,id=fs1,fsdev=fsdev0,mount_tag=hostshare \
-drive if=none,format=qcow2,file=/home/pengdl/work/Qemu_env/aarch64/qcow2/slave1.qcow2,id=hd0 \
-device virtio-blk-device,drive=hd0 \
在内核启动日志中可以看到:
[ 0.000000][ T0] Detected PIPT I-cache on CPU0
[ 0.000000][ T0] CPU features: detected: Address authentication (architected QARMA5 algorithm)
[ 0.000000][ T0] CPU features: detected: GIC system register CPU interface
[ 0.000000][ T0] CPU features: detected: HCRX_EL2 register
[ 0.000000][ T0] CPU features: detected: Virtualization Host Extensions
[ 0.000000][ T0] CPU features: detected: Hardware dirty bit management
[ 0.000000][ T0] CPU features: detected: Memory Tagging Extension
[ 0.000000][ T0] CPU features: detected: Asymmetric MTE Tag Check Fault
[ 0.000000][ T0] CPU features: detected: Spectre-v4
[ 0.000000][ T0] MTE: enabled in synchronous mode at EL1
[ 0.000000][ T0] alternatives: applying boot alternatives
[ 0.000000][ T0] kasan: KernelAddressSanitizer initialized (hw-tags, mode=sync, vmalloc=on, stacktrace=on)
# cat /proc/cpuinfo
...
processor : 15
BogoMIPS : 125.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit ilrcpc flagm ssbs sb paca pacg dcpodp sve2 sveaes svepmull svebitperm svesha3 svesm4 flagm2 frint svei8mm svef32mm svef64mm svebf16 i8mm bf16 dgh rng bti mte mte3 sme smei16i64 smef64f64 smei8i32 smef16f32 smeb16f32 smef32f32 smefa64
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x051
CPU revision : 0
标签:features,0.000000,开启,T0,id,detected,ARM64,CPU,MTE
From: https://www.cnblogs.com/pengdonglin137/p/18031444