Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

th.vlenb Illegal Instruction Exception #52

Open
charlie-rivos opened this issue May 16, 2024 · 0 comments
Open

th.vlenb Illegal Instruction Exception #52

charlie-rivos opened this issue May 16, 2024 · 0 comments

Comments

@charlie-rivos
Copy link

I have a Allwinner Nezha which contains a T-Head c906 core. Attempting to read th.vlenb from S-mode raises an illegal instruction exception. The spec says:

The XTheadVector extension adds 32 vector registers, and six unprivileged CSRs (th.vstart, th.vxsat, th.vxrm, th.vl, th.vtype and th.vlenb) , which also overlap with those of the V extension (vstart, vxsat, vxrm, vl, vtype and vlenb)

I tested this on a toolchain that does not support xtheadvector, but the patch in binutils simply sets an alias of th.vlenb to the standard vlenb [1] so I used the same encoding of vlenb,

My c906 has not had any issues executing any other other supported xtheadvector operations. Is th.vlenb supposed to be supported on the c906 chips?

There is some discussion on lkml [2]. I have a patch to support xtheadvector in Linux, but because of this issue with vlenb I have opted to put the vlenb in the device tree.

[1] https://github.com/bminor/binutils-gdb/blob/3e61a22ce7bce793db9bc52ef2c30fd9070a1dd8/include/opcode/riscv-opc.h#L4557
[2] https://lore.kernel.org/linux-riscv/20240516-sleek-wound-f835b3bf23cf@spud/T/#mfc016f748de703b1f0ea9f79d1c368740cf6e0dd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant