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

Yanhong Zhu yzhu at openjdk.java.net
Fri Nov 19 04:57:47 UTC 2021


> 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)

Yanhong Zhu has updated the pull request incrementally with one additional commit since the last revision:

  keep extension order same as HWCAP_ISA

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

Changes:
  - all: https://git.openjdk.java.net/riscv-port/pull/10/files
  - new: https://git.openjdk.java.net/riscv-port/pull/10/files/9c06b3df..492ca943

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=riscv-port&pr=10&range=02
 - incr: https://webrevs.openjdk.java.net/?repo=riscv-port&pr=10&range=01-02

  Stats: 32 lines in 2 files changed: 16 ins; 16 del; 0 mod
  Patch: https://git.openjdk.java.net/riscv-port/pull/10.diff
  Fetch: git fetch https://git.openjdk.java.net/riscv-port pull/10/head:pull/10

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


More information about the riscv-port-dev mailing list