There is some discussion of this in this thread.
https://forums.sifive.com/t/changing-clock-rate-on-new-linux-kernels/2989
The file name of the patch has changed.
https://github.com/sifive/meta-sifive/blob/master/recipes-kernel/linux/files/0006-riscv-sifive-unleashed-define-opp-table-cpufreq.patch
I don’t know if Ubuntu includes this patch or not. If you do have this patch, then you can change frequency with the cpupower command.