That was a really interesting question. If you see page 137 of the SiFive U74-MC Core Complex Manual, the mimpid CSR has this information. However looking through the kernel, OpenSBI, and U-boot, surprisingly neither OpenSBI nor the Linux prints this (though they have access to it). U-boot appears to be the only one exposing this via the sbi
command, but lo and behold, the U-boot that StarFive ships doesn’t appear to have this enabled.
TL;DR: the easiest way to read mimpid currently appear to be writing a dummy kernel module which prints the result of sbi_get_mimpid()
. I didn’t go that far.
UPDATE: it looks like the sources on Debian69 aren’t complete; at least I wasn’t able to build a dummy kernel module:
make -f /lib/modules/5.15.0-starfive/build/Makefile M=$PWD hello-1.ko
ERROR: Kernel configuration is invalid.
include/generated/autoconf.h or include/config/auto.conf are missing.
Run 'make oldconfig && make prepare' on kernel src to fix it.
make: *** [/lib/modules/5.15.0-starfive/build/Makefile:737: include/config/auto.conf] Error 1