[riscv-port] RFR: 8277036: riscv: Get CPU features from the auxiliary vector on Linux

Fei Yang fyang at openjdk.java.net
Fri Nov 19 04:00:23 UTC 2021


On Fri, 19 Nov 2021 02:39:12 GMT, Yanhong Zhu <yzhu at openjdk.org> wrote:

> Due to the lack of native environment in our early development of riscv port, we detect riscv CPU ISA extensions through checking whether simulator (e.g. QEMU) supports execution of one of the instructions in the corresponding feature spec or not. Fortunately, there are several riscv hardwares available now, we can directly get this CPU info from the auxiliary vector on Linux. Note that the aarch64 port also did the same thing on Linux platform. This also fixes some whitespace issue reported by jcheck.
> 
> This has been tested on HiFive Unleashed board (rv64imafdc) and NeZha D1 board (rv64imafdcvu):
> 
> # HiFive Unmatched
> $jdk/bin/java -XX:+UseVExt -XX:+PrintFlagsFinal -version |grep UseVExt
> OpenJDK 64-Bit Server VM warning: RVV is not supported on this CPU
>     bool UseVExt                                          = false                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)
> 
> $jdk/bin/java -XX:-UseVExt -XX:+PrintFlagsFinal -version |grep UseVExt
>     bool UseVExt                                          = false                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)
> 
> $jdk/bin/java -XX:+PrintFlagsFinal -version |grep UseVExt
>     bool UseVExt                                          = false                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)
> 
> # NeZha D1 
> $jdk/bin/java -XX:+UseVExt -XX:+PrintFlagsFinal -version |grep UseVExt
>     bool UseVExt                                          = true                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)
> 
> $jdk/bin/java -XX:-UseVExt -XX:+PrintFlagsFinal -version |grep UseVExt
>     bool UseVExt                                          = false                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)
> 
> $jdk/bin/java -XX:+PrintFlagsFinal -version |grep UseVExt
>     bool UseVExt                                          = false                             {ARCH product} {command line}
> openjdk version "18-internal" 2022-03-15
> OpenJDK Runtime Environment (build 18-internal+0-adhoc..riscv-port)
> OpenJDK 64-Bit Server VM (build 18-internal+0-adhoc..riscv-port, mixed mode)

Changes requested by fyang (Lead).

src/hotspot/os_cpu/linux_riscv/vm_version_linux_riscv.cpp line 100:

> 98:       HWCAP_ISA_I |
> 99:       HWCAP_ISA_M |
> 100:       HWCAP_ISA_V);

Please also add checking for 'B' and 'C' here.

-------------

PR: https://git.openjdk.java.net/riscv-port/pull/10


More information about the riscv-port-dev mailing list