i'm using the branch at https://github.com/rth7680/qemu/tree/tgt-arm-mte to test armv8.5-a mte and hope this is ok to report bugs here. i'm doing tests in qemu-system-aarch64 with linux userspace code and it seems TCO bit gets cleared after syscalls or other kernel entry, but PSTATE is expected to be restored, so i suspect it is a qemu bug. i think the architecture saves/restores PSTATE using SPSR_ELx on exceptions. i used the linux branch https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=devel/mte-v2 attached a reproducer that segfaults in qemu but should work. thanks.