Skip to contentSkip to conversation

target/riscv: Add arch= CPU property for ISA configuration

PATCH In review Kito Cheng 3 participants 10 messages Jan 5

Subsystems (2)
lore
Share & tools
lore

Kito Cheng

author
#0 lore raw

cover target/riscv: Add arch= CPU property for ISA configuration

Motivation
==========

Here is the motivation for this patch set. Please try to answer the following 3 questions without checking QEMU source code:

1. How do you run RISC-V QEMU with a specific extension configuration? Please try to configure an rv64im user mode QEMU before you answer this question.
2. How do you know which extensions are supported in RISC-V QEMU?
3. How do you know which extensions are enabled in the current RISC-V QEMU?

And here are my answers to those 3 questions:

1. It's hard to configure RISC-V QEMU with a specific extension. The correct way to configure rv64im is:

     qemu-riscv64 -cpu rv64,a=false,d=false,f=false,zfa=false,zawrs=false,\
       c=false,zifencei=false,zicsr=false,zihintntl=false,zihintpause=false,\
       zbb=false,zba=false,zbs=false,zbc=false,zicbom=false,zicbop=false,\
       zicboz=false

I've seen 4 different QEMU wrappers to handle arch string to QEMU CPU
option: 3 in-house scripts, 1 open source script in riscv-gnu-toolchain, and I guess some vendors/developers may have their own scripts to do that as well...

2. I don't know a better way other than reading the QEMU source code.

3. I don't really know the answer...

So how do other tools/simulators address these problems? Toolchains like Clang and GCC use -march with an arch string to configure, and Spike uses --isa=<ISA-string> to configure.

Could we introduce a similar way to configure QEMU? Yes, I think we can. That's what this patch set does.

-cpu rv64,arch=<ISA-string>

to configure QEMU. And also introduce arch=help and arch=dump to show which extensions are supported, and which extensions are enabled/disabled.

Also supported:

arch=<profile>["_"optional-ext]*

to specify configuration with RISC-V profiles like the toolchain convention[1].

[1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/blob/main/src/toolchain-conventions.adoc#specifying-the-target-profile-with--march

Overview
========

This patch series introduces the arch= CPU property for RISC-V, providing a convenient interface to configure ISA extensions similar to GCC/Clang's -march option.

The arch= property supports the following modes:

1. arch=dump
Print the current ISA configuration and exit. Shows the full ISA string and the status of all supported extensions.

Example:

     $ qemu-riscv64 -cpu rv64,v=true,arch=dump /bin/true

2. arch=help
Print a list of all supported ISA extensions and exit. Lists standard single-letter extensions, multi-letter extensions, vendor extensions, profiles, and vector length extensions.

Example:

     $ qemu-riscv64 -cpu rv64,arch=help /bin/true

3. arch=<ISA-STRING>
Configure extensions using a standard RISC-V ISA string. The format is rv{32|64}[single-letter-exts][_multi-letter-ext]*.

Key features:
- First extension must be i, e, or g (base ISA requirement)
- Single-letter extensions can be concatenated (rv64imafdc)
- Single-letter extensions can use underscore separators (rv64i_m_a_f_d_c)
- Multi-letter extensions are separated by underscores (_zba_zbb)
- Single-letter can transition directly to multi-letter (rv64imazba)
- Extensions i, e, g can only appear as the first extension
- When arch= is specified, all extensions are first reset to disabled
- G expands to imafd_zicsr_zifencei
- B expands to zba_zbb_zbs

Examples:

     $ qemu-riscv64 -cpu rv64,arch=rv64gc_zba_zbb /bin/true
     $ qemu-riscv64 -cpu rv64,arch=rv64imafdc_zba_zbb_zbc /bin/true

4. arch=<PROFILE>[_extension]*
Configure the CPU using a standard RISC-V profile, optionally with additional extensions. Available profiles (64-bit only):
- rva22u64, rva22s64, rva23u64, rva23s64

Examples:

     $ qemu-riscv64 -cpu rv64,arch=rva23u64 /bin/true
     $ qemu-riscv64 -cpu rv64,arch=rva23u64_zbkb_zkne /bin/true

5. zvl*b extensions
Specify vector length (VLEN) in bits using zvl<N>b where N is a power of 2 (32-65536). Requires v or zve* extension.

Examples:

     $ qemu-riscv64 -cpu rv64,arch=rv64gcv_zvl256b /bin/true
     $ qemu-riscv64 -cpu rv64,arch=rv64i_zve64f_zvl128b /bin/true

Individual extension properties (e.g., zba=true) can be combined with arch= and will override the ISA string settings when specified after arch=.

Kito Cheng (5):
target/riscv: Add arch=dump CPU property for ISA introspection target/riscv: Add arch=help to list supported ISA extensions target/riscv: Add arch=ISA-STRING to configure extensions via ISA
string
target/riscv: Add arch=PROFILE to configure CPU using RISC-V profiles target/riscv: Add zvl*b extension support in arch= property

 docs/system/target-riscv.rst              | 144 ++++++++
 target/riscv/cpu.c                        | 226 ++++++++++++
 target/riscv/cpu.h                        |   1 +
 target/riscv/cpu_cfg_fields.h.inc         |   3 +
 target/riscv/tcg/tcg-cpu.c                | 424 ++++++++++++++++++++++
 tests/functional/riscv32/meson.build      |   4 +
 tests/functional/riscv32/test_cpu_arch.py |  94 +++++
 tests/functional/riscv64/meson.build      |   4 +
 tests/functional/riscv64/test_cpu_arch.py | 411 +++++++++++++++++++++
 9 files changed, 1311 insertions(+)
 create mode 100644 tests/functional/riscv32/test_cpu_arch.py
 create mode 100644 tests/functional/riscv64/test_cpu_arch.py

--
2.52.0

author
#1 lore raw

PATCH 1/5 target/riscv: Add arch=dump CPU property for ISA introspection

---
 docs/system/target-riscv.rst              |  60 ++++++++++
 target/riscv/cpu.c                        | 128 ++++++++++++++++++++++
 target/riscv/cpu_cfg_fields.h.inc         |   3 +
 target/riscv/tcg/tcg-cpu.c                |  33 ++++++
 tests/functional/riscv32/meson.build      |   4 +
 tests/functional/riscv32/test_cpu_arch.py |  61 +++++++++++
 tests/functional/riscv64/meson.build      |   4 +
 tests/functional/riscv64/test_cpu_arch.py |  80 ++++++++++++++
 8 files changed, 373 insertions(+)
 create mode 100644 tests/functional/riscv32/test_cpu_arch.py
 create mode 100644 tests/functional/riscv64/test_cpu_arch.py
docs/system/target-riscv.rst +60 -0
index 89b2cb732c2..3ec53dbf9e5 100644
@@ -73,6 +73,66 @@ undocumented; you can get a complete list by running
    riscv/virt
    riscv/xiangshan-kunminghu
 
+RISC-V CPU options
+------------------
+
+RISC-V CPUs support various options to configure ISA extensions and other
+features. These options can be specified using the ``-cpu`` command line
+option.
+
+ISA extension configuration
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Individual ISA extensions can be enabled or disabled using boolean properties::
+
+  $ qemu-system-riscv64 -M virt -cpu rv64,v=true,zba=false
+
+The ``arch`` property
+^^^^^^^^^^^^^^^^^^^^^
+
+The ``arch`` property provides a convenient way to inspect the current ISA
+configuration:
+
+* ``arch=dump``
+
+  Print the current ISA configuration and exit. This shows the full ISA string
+  and the status of all supported extensions::
+
+    $ qemu-system-riscv64 -M virt -cpu rv64,arch=dump
+    $ qemu-riscv64 -cpu rv64,v=true,arch=dump /bin/true
+
+  The dump shows the final configuration after all CPU properties are applied,
+  regardless of where ``arch=dump`` appears in the option list. For example,
+  both of the following commands show the same result with vector extension
+  enabled::
+
+    $ qemu-riscv64 -cpu rv64,v=true,arch=dump /bin/true
+    $ qemu-riscv64 -cpu rv64,arch=dump,v=true /bin/true
+
+Privilege-implied extensions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Some RISC-V extensions cannot be individually enabled or disabled. These
+extensions are automatically enabled based on the privilege specification
+version configured for the CPU. Examples include:
+
+- ``shcounterenw``, ``shgatpa``, ``shtvala``, ``shvsatpa``, ``shvstvala``,
+  ``shvstvecd`` - Enabled when privilege spec 1.12 or later is supported
+- ``ssccptr``, ``sscounterenw``, ``ssstrict``, ``sstvala``, ``sstvecd``,
+  ``ssu64xl`` - Enabled when privilege spec 1.12 or later is supported
+- ``ziccamoa``, ``ziccif``, ``zicclsm``, ``za64rs`` - Enabled when
+  privilege spec 1.12 or later is supported
+
+These extensions appear in the ``arch=dump`` output under "Privilege Implied
+Extensions" section. To control these extensions, use the ``priv_spec``
+property to set the privilege specification version::
+
+  $ qemu-riscv64 -cpu rv64,h=false,priv_spec=v1.11.0,arch=dump /bin/true
+
+Note: Some extensions like H (Hypervisor) require a minimum privilege spec
+version. When lowering the privilege spec, you may need to disable such
+extensions first.
+
 RISC-V CPU firmware
 -------------------
 
target/riscv/cpu.c +128 -0

140 lines not on this page · raw message

target/riscv/cpu_cfg_fields.h.inc +3 -0
index a154ecdc792..87ef228a17d 100644
@@ -155,6 +155,9 @@ BOOL_FIELD(misa_w)
 
 BOOL_FIELD(short_isa_string)
 
+/* arch= property flags */
+BOOL_FIELD(arch_dump_requested)
+
 TYPED_FIELD(uint32_t, mvendorid, 0)
 TYPED_FIELD(uint64_t, marchid, 0)
 TYPED_FIELD(uint64_t, mimpid, 0)
target/riscv/tcg/tcg-cpu.c +33 -0
index bb03f8dc0ca..f7187472cd2 100644
@@ -1551,6 +1551,37 @@ static void riscv_cpu_add_multiext_prop_array(Object *obj,
     }
 }
 
+/*
+ * arch= property handler for ISA string configuration.
+ * This is a write-only property used to trigger actions like arch=dump.
+ */
+static void cpu_set_arch(Object *obj, Visitor *v, const char *name,
+                         void *opaque, Error **errp)
+{
+    RISCVCPU *cpu = RISCV_CPU(obj);
+    g_autofree char *value = NULL;
+
+    if (!visit_type_str(v, name, &value, errp)) {
+        return;
+    }
+
+    if (g_strcmp0(value, "dump") == 0) {
+        cpu->cfg.arch_dump_requested = true;
+    } else {
+        error_setg(errp, "unknown arch option '%s'. "
+                   "Supported options: dump", value);
+    }
+}
+
+static void riscv_cpu_add_arch_property(Object *obj)
+{
+    object_property_add(obj, "arch", "str",
+                        NULL, cpu_set_arch,
+                        NULL, NULL);
+    object_property_set_description(obj, "arch",
+        "ISA configuration string (write-only). Use 'dump' to print ISA config.");
+}
+
 /*
  * Add CPU properties with user-facing flags.
  *
@@ -1570,6 +1601,8 @@ static void riscv_cpu_add_user_properties(Object *obj)
     riscv_cpu_add_multiext_prop_array(obj, riscv_cpu_experimental_exts);
 
     riscv_cpu_add_profiles(obj);
+
+    riscv_cpu_add_arch_property(obj);
 }
 
 /*
tests/functional/riscv32/meson.build +4 -0
index f3ebbb8db5d..a3f7a3dffce 100644
@@ -8,3 +8,7 @@ tests_riscv32_system_quick = [
 tests_riscv32_system_thorough = [
   'tuxrun',
 ]
+
+tests_riscv32_linuxuser_quick = [
+  'cpu_arch',
+]
tests/functional/riscv32/test_cpu_arch.py new file +61 -0

61 lines not on this page · raw message

tests/functional/riscv64/meson.build +4 -0
index c1704d92751..82a29dcc974 100644
@@ -13,3 +13,7 @@ tests_riscv64_system_thorough = [
   'sifive_u',
   'tuxrun',
 ]
+
+tests_riscv64_linuxuser_quick = [
+  'cpu_arch',
+]
tests/functional/riscv64/test_cpu_arch.py new file +80 -0

80 lines not on this page · raw message

Signature · 1 line
2.52.0
author
#2 lore raw

PATCH 2/5 target/riscv: Add arch=help to list supported ISA extensions

In reply to Kito Cheng
---
 docs/system/target-riscv.rst              | 14 ++++-
 target/riscv/cpu.c                        | 69 +++++++++++++++++++++++
 target/riscv/cpu.h                        |  1 +
 target/riscv/tcg/tcg-cpu.c                |  7 ++-
 tests/functional/riscv32/test_cpu_arch.py | 12 ++++
 tests/functional/riscv64/test_cpu_arch.py | 25 ++++++++
 6 files changed, 124 insertions(+), 4 deletions(-)
docs/system/target-riscv.rst +12 -2
index 3ec53dbf9e5..9acc51fbc2b 100644
@@ -90,8 +90,18 @@ Individual ISA extensions can be enabled or disabled using boolean properties::
 The ``arch`` property
 ^^^^^^^^^^^^^^^^^^^^^
 
-The ``arch`` property provides a convenient way to inspect the current ISA
-configuration:
+The ``arch`` property provides convenient ways to discover and inspect ISA
+extensions:
+
+* ``arch=help``
+
+  Print a list of all supported ISA extensions and exit::
+
+    $ qemu-system-riscv64 -M virt -cpu rv64,arch=help
+    $ qemu-riscv64 -cpu rv64,arch=help /bin/true
+
+  This lists standard single-letter extensions (with descriptions), multi-letter
+  extensions, vendor extensions, and experimental extensions.
 
 * ``arch=dump``
 
target/riscv/cpu.c +69 -0

81 lines not on this page · raw message

target/riscv/cpu.h +1 -0
index 90b3e951053..5c08c2ca4d6 100644
@@ -986,4 +986,5 @@ const char *satp_mode_str(uint8_t satp_mode, bool is_32_bit);
 extern const RISCVCSR th_csr_list[];
 
 const char *priv_spec_to_str(int priv_version);
+G_NORETURN void riscv_cpu_list_supported_extensions(void);
 #endif /* RISCV_CPU_H */
target/riscv/tcg/tcg-cpu.c +5 -2
index f7187472cd2..c9600a52e1c 100644
@@ -1567,9 +1567,11 @@ static void cpu_set_arch(Object *obj, Visitor *v, const char *name,
 
     if (g_strcmp0(value, "dump") == 0) {
         cpu->cfg.arch_dump_requested = true;
+    } else if (g_strcmp0(value, "help") == 0) {
+        riscv_cpu_list_supported_extensions();
     } else {
         error_setg(errp, "unknown arch option '%s'. "
-                   "Supported options: dump", value);
+                   "Supported options: dump, help", value);
     }
 }
 
@@ -1579,7 +1581,8 @@ static void riscv_cpu_add_arch_property(Object *obj)
                         NULL, cpu_set_arch,
                         NULL, NULL);
     object_property_set_description(obj, "arch",
-        "ISA configuration string (write-only). Use 'dump' to print ISA config.");
+        "ISA configuration (write-only). "
+        "Use 'help' to list extensions, 'dump' to show current config.");
 }
 
 /*
tests/functional/riscv32/test_cpu_arch.py +12 -0
index 7b2f87cad88..b2042f1e5d8 100644
@@ -47,6 +47,18 @@ def test_arch_dump_shows_enabled_extensions(self):
         self.assertRegex(res.stdout, r'd\s+enabled')
         self.assertRegex(res.stdout, r'c\s+enabled')
 
+    def test_arch_help(self):
+        """Test arch=help prints list of supported extensions and exits"""
+        res = self.run_qemu('rv32,arch=help')
+
+        self.assertEqual(res.returncode, 0,
+                         f"arch=help should exit with 0, got {res.returncode}")
+
+        # Check for expected output sections
+        self.assertIn('Supported RISC-V ISA Extensions', res.stdout)
+        self.assertIn('Standard Extensions (single-letter):', res.stdout)
+        self.assertIn('Standard Extensions (multi-letter):', res.stdout)
+
     def test_arch_invalid_option(self):
         """Test invalid arch= option shows error with supported options"""
         res = self.run_qemu('rv32,arch=invalid')
tests/functional/riscv64/test_cpu_arch.py +25 -0
index b0af8991397..4ec807b7276 100644
@@ -66,6 +66,31 @@ def test_arch_dump_position_independence(self):
         self.assertRegex(res1.stdout, r'v\s+enabled')
         self.assertRegex(res2.stdout, r'v\s+enabled')
 
+    def test_arch_help(self):
+        """Test arch=help prints list of supported extensions and exits"""
+        res = self.run_qemu('rv64,arch=help')
+
+        self.assertEqual(res.returncode, 0,
+                         f"arch=help should exit with 0, got {res.returncode}")
+
+        # Check for expected output sections
+        self.assertIn('Supported RISC-V ISA Extensions', res.stdout)
+        self.assertIn('Standard Extensions (single-letter):', res.stdout)
+        self.assertIn('Standard Extensions (multi-letter):', res.stdout)
+        self.assertIn('Vendor Extensions:', res.stdout)
+
+    def test_arch_help_shows_extensions(self):
+        """Test arch=help lists common extensions"""
+        res = self.run_qemu('rv64,arch=help')
+
+        # Check single-letter extensions with descriptions
+        self.assertIn('Base integer instruction set', res.stdout)
+        self.assertIn('Vector operations', res.stdout)
+
+        # Check multi-letter extensions are listed
+        self.assertIn('zba', res.stdout)
+        self.assertIn('zbb', res.stdout)
+
     def test_arch_invalid_option(self):
         """Test invalid arch= option shows error with supported options"""
         res = self.run_qemu('rv64,arch=invalid')
Signature · 1 line
2.52.0
author
#3 lore raw

PATCH 3/5 target/riscv: Add arch=ISA-STRING to configure extensions via ISA string

In reply to Kito Cheng

Add support for configuring RISC-V ISA extensions using standard ISA strings with the arch= property. The format is:

rv{32|64}[single-letter-exts][_multi-letter-ext]*

Examples:
-cpu rv64,arch=rv64gc_zba_zbb
-cpu rv64,arch=rv64imafdc_zba_zbb_zbc
-cpu rv32,arch=rv32gc

Key features:
- First extension after rv{32|64} must be 'i', 'e', or 'g' (base ISA)
- Single-letter extensions can be concatenated (rv64imafdc)
- Single-letter extensions can also use underscore separators (rv64i_m_a_f_d_c)
- Multi-letter extensions are separated by underscores (_zba_zbb)
- Single-letter extensions can transition directly to multi-letter (rv64imazba is equivalent to rv64ima_zba)
- Extensions i, e, g can only appear as the first extension
- When arch= is specified, all extensions are first reset to disabled, then only the specified extensions are enabled
- G expands to imafd_zicsr_zifencei
- B expands to zba_zbb_zbs
- ISA string XLEN must match CPU type (rv32 for 32-bit, rv64 for 64-bit)

Individual extension properties (e.g., zba=true) can be combined with arch= and will override the ISA string settings when specified after arch=.

---
 docs/system/target-riscv.rst              |  48 ++++++
 target/riscv/tcg/tcg-cpu.c                | 187 +++++++++++++++++++++-
 tests/functional/riscv32/test_cpu_arch.py |  21 +++
 tests/functional/riscv64/test_cpu_arch.py | 166 +++++++++++++++++++
 4 files changed, 418 insertions(+), 4 deletions(-)
docs/system/target-riscv.rst +48 -0
index 9acc51fbc2b..a16c17a22c2 100644
@@ -119,6 +119,54 @@ extensions:
     $ qemu-riscv64 -cpu rv64,v=true,arch=dump /bin/true
     $ qemu-riscv64 -cpu rv64,arch=dump,v=true /bin/true
 
+* ``arch=<ISA-STRING>``
+
+  Configure extensions using a standard RISC-V ISA string. The format is
+  ``rv{32|64}[single-letter-exts][_multi-letter-ext]*``. Examples::
+
+    $ qemu-riscv64 -cpu rv64,arch=rv64gc_zba_zbb /bin/true
+    $ qemu-riscv64 -cpu rv64,arch=rv64imafdc_zba_zbb_zbc /bin/true
+
+  Single-letter extensions are specified immediately after the base ISA
+  (e.g., ``rv64gc`` enables G and C extensions). Multi-letter extensions
+  are separated by underscores.
+
+  Special extensions:
+
+  - ``g`` expands to ``imafd_zicsr_zifencei`` (General purpose)
+
+  The ISA string must match the CPU's XLEN. For example, ``arch=rv32i`` will
+  fail on a 64-bit CPU.
+
+  **Important behavioral notes:**
+
+  - When ``arch=<ISA-STRING>`` is specified, all extensions are first reset
+    to disabled, then only the extensions in the ISA string are enabled.
+    For example, ``-cpu rv64,zba=true,arch=rv64gc`` will have ``zba`` disabled
+    because ``arch=`` resets extensions before applying the ISA string.
+
+  - Extensions can be specified in any order and can be repeated. For example,
+    ``rv64gc_zba_zbb`` and ``rv64gc_zbb_zba`` produce the same result.
+
+  - Single-letter extensions can appear anywhere in the string separated by
+    underscores. For example, ``rv64im_zba_afc`` is equivalent to
+    ``rv64imafc_zba``.
+
+  - The individual extension properties (e.g., ``zba=true``) still work and
+    can be combined with ``arch=``. Properties specified after ``arch=`` will
+    override the ISA string settings::
+
+      $ qemu-riscv64 -cpu rv64,arch=rv64gc,zba=true /bin/true
+
+  - Some extensions are controlled by the privilege specification version
+    and cannot be enabled or disabled via ``arch=``. See the
+    "Privilege-implied extensions" section below for details.
+
+  You can combine ``arch=<ISA-STRING>`` with ``arch=dump`` to verify the
+  configuration::
+
+    $ qemu-riscv64 -cpu rv64,arch=rv64gc_zba_zbb,arch=dump /bin/true
+
 Privilege-implied extensions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
target/riscv/tcg/tcg-cpu.c +183 -4

207 lines not on this page · raw message

tests/functional/riscv32/test_cpu_arch.py +21 -0
index b2042f1e5d8..f5526cd1e1b 100644
@@ -68,6 +68,27 @@ def test_arch_invalid_option(self):
         self.assertIn("unknown arch option 'invalid'", res.stderr)
         self.assertIn("Supported options:", res.stderr)
 
+    def test_arch_isa_string_basic(self):
+        """Test arch=ISA-STRING enables specified extensions"""
+        res = self.run_qemu('rv32,arch=rv32gc_zba_zbb,arch=dump')
+
+        self.assertEqual(res.returncode, 0)
+
+        # Check single-letter extensions from 'gc'
+        self.assertRegex(res.stdout, r'g\s+enabled')
+        self.assertRegex(res.stdout, r'c\s+enabled')
+
+        # Check multi-letter extensions
+        self.assertRegex(res.stdout, r'zba\s+enabled')
+        self.assertRegex(res.stdout, r'zbb\s+enabled')
+
+    def test_arch_isa_string_xlen_mismatch(self):
+        """Test arch=ISA-STRING rejects XLEN mismatch"""
+        res = self.run_qemu('rv32,arch=rv64i')
+
+        self.assertNotEqual(res.returncode, 0)
+        self.assertIn("RV64 but CPU is RV32", res.stderr)
+
 
 if __name__ == '__main__':
     QemuUserTest.main()
tests/functional/riscv64/test_cpu_arch.py +166 -0

172 lines not on this page · raw message

Signature · 1 line
2.52.0
author
#4 lore raw

PATCH 4/5 target/riscv: Add arch=PROFILE to configure CPU using RISC-V profiles

In reply to Kito Cheng

Add support for configuring RISC-V CPUs using standard RISC-V profiles with the arch= property. The format is:

arch=<profile-name>[_extension]*

Examples:
-cpu rv64,arch=rva23u64
-cpu rv64,arch=rva22s64
-cpu rv64,arch=rva23u64_zbkb_zkne

Key features:
- Profiles are detected by prefix matching (case-insensitive)
- Additional extensions can be appended after the profile name
- Profiles are only available for 64-bit CPUs

Available profiles:
- rva22u64 - RVA22 User-mode profile
- rva22s64 - RVA22 Supervisor-mode profile
- rva23u64 - RVA23 User-mode profile (includes mandatory vector)
- rva23s64 - RVA23 Supervisor-mode profile

Profiles automatically enable all mandatory extensions defined by the RISC-V profile specification. Additional extensions can be appended after the profile name using underscores (following the RISC-V toolchain convention).

The arch=help command now lists available profiles in addition to extensions.

---
 docs/system/target-riscv.rst              |  24 +++++
 target/riscv/cpu.c                        |   8 ++
 target/riscv/tcg/tcg-cpu.c                | 103 +++++++++++++++++++++-
 tests/functional/riscv64/test_cpu_arch.py |  72 +++++++++++++++
 4 files changed, 203 insertions(+), 4 deletions(-)
docs/system/target-riscv.rst +24 -0
index a16c17a22c2..12807974a8a 100644
@@ -167,6 +167,30 @@ extensions:
 
     $ qemu-riscv64 -cpu rv64,arch=rv64gc_zba_zbb,arch=dump /bin/true
 
+* ``arch=<PROFILE-NAME>[_extension]*``
+
+  Configure the CPU using a standard RISC-V profile, optionally with additional
+  extensions. Profiles define sets of mandatory extensions for specific use
+  cases. Available profiles (64-bit only):
+
+  - ``rva22u64`` - RVA22 User-mode profile
+  - ``rva22s64`` - RVA22 Supervisor-mode profile
+  - ``rva23u64`` - RVA23 User-mode profile (includes mandatory vector)
+  - ``rva23s64`` - RVA23 Supervisor-mode profile
+
+  Examples::
+
+    $ qemu-riscv64 -cpu rv64,arch=rva23u64 /bin/true
+    $ qemu-riscv64 -cpu rv64,arch=rva22s64,arch=dump /bin/true
+    $ qemu-riscv64 -cpu rv64,arch=rva23u64_zbkb_zkne /bin/true
+
+  Profiles automatically enable all mandatory extensions defined by the RISC-V
+  profile specification. For example, RVA23 profiles enable the vector extension
+  (V) which was optional in RVA22. Additional extensions can be appended after
+  the profile name using underscores (following the RISC-V toolchain convention).
+
+  Use ``arch=help`` to see all available profiles.
+
 Privilege-implied extensions
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
target/riscv/cpu.c +8 -0
index b1d8438cd14..092635b1050 100644
@@ -1028,7 +1028,15 @@ G_NORETURN void riscv_cpu_list_supported_extensions(void)
     riscv_cpu_help_multiext("Experimental Extensions",
                             riscv_cpu_experimental_exts);
 
+    /* Print available profiles */
+    qemu_printf("Profiles (64-bit only):\n");
+    for (int i = 0; riscv_profiles[i] != NULL; i++) {
+        qemu_printf("  %s\n", riscv_profiles[i]->name);
+    }
+    qemu_printf("\n");
+
     qemu_printf("Use '-cpu <cpu>,<ext>=true' to enable an extension.\n");
+    qemu_printf("Use '-cpu <cpu>,arch=<profile>' to enable a profile.\n");
     qemu_printf("Use '-cpu <cpu>,arch=dump' to show current configuration.\n");
 
     exit(0);
target/riscv/tcg/tcg-cpu.c +99 -4

128 lines not on this page · raw message

tests/functional/riscv64/test_cpu_arch.py +72 -0

78 lines not on this page · raw message

Signature · 1 line
2.52.0
author
#5 lore raw

PATCH 5/5 target/riscv: Add zvl*b extension support in arch= property

In reply to Kito Cheng

Add support for specifying vector length (VLEN) using zvl*b extensions in the arch= property. This allows explicit VLEN configuration when using ISA strings or profiles.

Examples:

  -cpu rv64,arch=rv64gcv_zvl256b       # V with VLEN=256
  -cpu rv64,arch=rv64i_zve64f_zvl128b  # Zve64f with VLEN=128
  -cpu rv64,arch=rva23u64_zvl512b      # RVA23 profile with VLEN=512

Key features:
- zvl<N>b where N is VLEN in bits (must be power of 2, 32-65536)
- Valid extensions: zvl32b, zvl64b, zvl128b, zvl256b, zvl512b, etc.
- zvl*b requires v or zve* extension to also be specified
- Multiple zvl*b extensions take the maximum value
- Extensions imply minimum VLEN: v implies 128, zve64* implies 64, zve32* implies 32

The arch=dump output now shows:
- Vector length configuration (VLEN=N bits)
- zvl<N>b in the full ISA string

The arch=help output now lists available zvl*b extensions with documentation.

---
 docs/system/target-riscv.rst              |   2 +
 target/riscv/cpu.c                        |  23 ++++-
 target/riscv/tcg/tcg-cpu.c                | 116 +++++++++++++++++++++-
 tests/functional/riscv64/test_cpu_arch.py |  68 +++++++++++++
 4 files changed, 207 insertions(+), 2 deletions(-)
docs/system/target-riscv.rst +2 -0
index 12807974a8a..6734c86848a 100644
@@ -134,6 +134,8 @@ extensions:
   Special extensions:
 
   - ``g`` expands to ``imafd_zicsr_zifencei`` (General purpose)
+  - ``zvl<N>b`` specifies vector length (VLEN) in bits, where N must
+    be a power of 2 (e.g., ``zvl128b``, ``zvl256b``, ``zvl512b``)
 
   The ISA string must match the CPU's XLEN. For example, ``arch=rv32i`` will
   fail on a 64-bit CPU.
target/riscv/cpu.c +22 -1
index 092635b1050..8c3a0c94483 100644
@@ -1028,6 +1028,11 @@ G_NORETURN void riscv_cpu_list_supported_extensions(void)
     riscv_cpu_help_multiext("Experimental Extensions",
                             riscv_cpu_experimental_exts);
 
+    /* Print vector length extensions */
+    qemu_printf("Vector Length Extensions (zvl*b):\n");
+    qemu_printf("  zvl32b, zvl64b, zvl128b, zvl256b, zvl512b, zvl1024b, ...\n");
+    qemu_printf("  (Specifies VLEN in bits, must be power of 2)\n\n");
+
     /* Print available profiles */
     qemu_printf("Profiles (64-bit only):\n");
     for (int i = 0; riscv_profiles[i] != NULL; i++) {
@@ -1062,7 +1067,14 @@ static G_NORETURN void riscv_cpu_dump_isa_config(RISCVCPU *cpu)
 
     /* Print base information */
     qemu_printf("Base: RV%d\n", xlen);
-    qemu_printf("Privilege spec: %s\n\n", priv_spec_to_str(env->priv_ver));
+    qemu_printf("Privilege spec: %s\n", priv_spec_to_str(env->priv_ver));
+
+    /* Print vector length configuration */
+    if (cpu->cfg.vlenb > 0) {
+        uint16_t vlen = cpu->cfg.vlenb << 3;
+        qemu_printf("Vector length: VLEN=%u bits (zvl%ub)\n", vlen, vlen);
+    }
+    qemu_printf("\n");
 
     /* Print single-letter extensions */
     qemu_printf("Standard Extensions (single-letter):\n");
@@ -3053,6 +3065,15 @@ static void riscv_isa_string_ext(RISCVCPU *cpu, char **isa_str,
         }
     }
 
+    /* Add zvl*b if vector length is configured */
+    if (cpu->cfg.vlenb > 0) {
+        uint16_t vlen = cpu->cfg.vlenb << 3;
+        g_autofree char *zvl_ext = g_strdup_printf("zvl%ub", vlen);
+        new = g_strconcat(old, "_", zvl_ext, NULL);
+        g_free(old);
+        old = new;
+    }
+
     *isa_str = new;
 }
 
target/riscv/tcg/tcg-cpu.c +115 -1

158 lines not on this page · raw message

tests/functional/riscv64/test_cpu_arch.py +68 -0

80 lines not on this page · raw message

Signature · 1 line
2.52.0
#6 lore raw
In reply to Kito Cheng
Quoted 9 lines · Kito Cheng

Motivation
==========

Here is the motivation for this patch set. Please try to answer the following 3 questions without checking QEMU source code:

1. How do you run RISC-V QEMU with a specific extension configuration? Please try to configure an rv64im user mode QEMU before you answer this question.

I would use the 'rv64i' bare CPU that we introduced a few releases ago and enable just 'm':

qemu-riscv64 -cpu rv64i,m=on

It gives you a bare bones CPU with only "RVI" enabled. We added this CPU specifically to support the use case you mentioned: users that want to have full control of what is enabled in the CPU.

Quoted 1 line

2. How do you know which extensions are supported in RISC-V QEMU?

You mean all available extensions? We don't have an user friendly way of knowing that. I usually grep the code.

Quoted 1 line

3. How do you know which extensions are enabled in the current RISC-V QEMU?

We can fetch them using query-cpu-model-expansion from QMP. But that's not exactly user friendly.

Quoted 10 lines

And here are my answers to those 3 questions:

1. It's hard to configure RISC-V QEMU with a specific extension. The

    correct way to configure rv64im is:

      qemu-riscv64 -cpu rv64,a=false,d=false,f=false,zfa=false,zawrs=false,\
        c=false,zifencei=false,zicsr=false,zihintntl=false,zihintpause=false,\
        zbb=false,zba=false,zbs=false,zbc=false,zicbom=false,zicbop=false,\
        zicboz=false

As I said above:

qemu-riscv64 -cpu rv64i,m=on

Quoted 5 lines

I've seen 4 different QEMU wrappers to handle arch string to QEMU CPU
option: 3 in-house scripts, 1 open source script in riscv-gnu-toolchain, and I guess some vendors/developers may have their own scripts to do that as well...

We can't control how riscv-gnu-toolchain and others implement their scripts and wrappers. These are the kind of thing that people write once and never look it back, and that's fine.

That said, we have 'rv64i' and other bare CPUs since QEMU 9.0, released in April
24. We don't need to do this kind of massive extension disablement to get a clean CPU for almost 2 years.

I advise to not take QEMU wrappers, scripts and etc from other projects as a sort of proof of what QEMU is currently capable. They're usually outdated.

Quoted 5 lines

2. I don't know a better way other than reading the QEMU source code.

3. I don't really know the answer...

Quoted 8 lines

So how do other tools/simulators address these problems? Toolchains like Clang and GCC use -march with an arch string to configure, and Spike uses --isa=<ISA-string> to configure.

Could we introduce a similar way to configure QEMU? Yes, I think we can. That's what this patch set does.

   -cpu rv64,arch=<ISA-string>

I don't mind the 'arch' property if users find it easier to enable extensions with it rather than the boolean properties, but it should be used on top of bare CPUs only. Otherwise the 'arch' property would include the already enabled extensions from 'rv64' and others.

And we would need to be okay with the fact that this is redundant to what we already can do with bare CPUs + manual extension enablement.

Quoted 3 lines

to configure QEMU. And also introduce arch=help and arch=dump to show which extensions are supported, and which extensions are enabled/disabled.

arch=help and arch=dump is indeed a nice addition.

Quoted 6 lines

Also supported:

   arch=<profile>["_"optional-ext]*

to specify configuration with RISC-V profiles like the toolchain convention[1].

We have profile CPUs for this use case:

$ ./qemu-riscv64 -cpu help
Available CPUs:
  max
  rv64
  rv64e
  rv64i
  rva22s64
  rva22u64
  rva23s64
  rva23u64
(...)

So 'qemu-riscv64 -cpu rva23u64' creates an user mode QEMU with RVA23.

Quoted 55 lines

[1] https://github.com/riscv-non-isa/riscv-toolchain-conventions/blob/main/src/toolchain-conventions.adoc#specifying-the-target-profile-with--march

Overview
========

This patch series introduces the arch= CPU property for RISC-V, providing a convenient interface to configure ISA extensions similar to GCC/Clang's -march option.

The arch= property supports the following modes:

1. arch=dump
Print the current ISA configuration and exit. Shows the full ISA string and the status of all supported extensions.

Example:
$ qemu-riscv64 -cpu rv64,v=true,arch=dump /bin/true

2. arch=help
Print a list of all supported ISA extensions and exit. Lists standard single-letter extensions, multi-letter extensions, vendor extensions, profiles, and vector length extensions.

Example:
$ qemu-riscv64 -cpu rv64,arch=help /bin/true

3. arch=<ISA-STRING>
Configure extensions using a standard RISC-V ISA string. The format is rv{32|64}[single-letter-exts][_multi-letter-ext]*.

Key features:
- First extension must be i, e, or g (base ISA requirement)
- Single-letter extensions can be concatenated (rv64imafdc)
- Single-letter extensions can use underscore separators (rv64i_m_a_f_d_c)
- Multi-letter extensions are separated by underscores (_zba_zbb)
- Single-letter can transition directly to multi-letter (rv64imazba)
- Extensions i, e, g can only appear as the first extension
- When arch= is specified, all extensions are first reset to disabled
- G expands to imafd_zicsr_zifencei
- B expands to zba_zbb_zbs

Examples:
$ qemu-riscv64 -cpu rv64,arch=rv64gc_zba_zbb /bin/true $ qemu-riscv64 -cpu rv64,arch=rv64imafdc_zba_zbb_zbc /bin/true

4. arch=<PROFILE>[_extension]*
Configure the CPU using a standard RISC-V profile, optionally with additional extensions. Available profiles (64-bit only):
- rva22u64, rva22s64, rva23u64, rva23s64

Examples:
$ qemu-riscv64 -cpu rv64,arch=rva23u64 /bin/true $ qemu-riscv64 -cpu rv64,arch=rva23u64_zbkb_zkne /bin/true

Quoted 7 lines

5. zvl*b extensions

    Specify vector length (VLEN) in bits using zvl<N>b where N is a power
    of 2 (32-65536). Requires v or zve* extension.

    Examples:
      $ qemu-riscv64 -cpu rv64,arch=rv64gcv_zvl256b /bin/true
      $ qemu-riscv64 -cpu rv64,arch=rv64i_zve64f_zvl128b /bin/true

We already have vlen and elen properties. Not sure if we need another way to set the same stuff.

I'll give a closer look later at the first 2 patches (arch=dump and arch=help) since these are nice additions for the user experience.

I would like to hear other opinions about arch=<ISA_STRING> because it would be just another way (probably an easier way) of doing what we already support with bare CPUs + manual extension enablement.

I don't see the need to support arch=PROFILE given that we have profile CPUs that does exactly that. Same thing for the 'vlen' setting.

Quoted 28 lines

Individual extension properties (e.g., zba=true) can be combined with arch= and will override the ISA string settings when specified after arch=.

Kito Cheng (5):
target/riscv: Add arch=dump CPU property for ISA introspection target/riscv: Add arch=help to list supported ISA extensions target/riscv: Add arch=ISA-STRING to configure extensions via ISA
string
target/riscv: Add arch=PROFILE to configure CPU using RISC-V profiles target/riscv: Add zvl*b extension support in arch= property

  docs/system/target-riscv.rst              | 144 ++++++++
  target/riscv/cpu.c                        | 226 ++++++++++++
  target/riscv/cpu.h                        |   1 +
  target/riscv/cpu_cfg_fields.h.inc         |   3 +
  target/riscv/tcg/tcg-cpu.c                | 424 ++++++++++++++++++++++
  tests/functional/riscv32/meson.build      |   4 +
  tests/functional/riscv32/test_cpu_arch.py |  94 +++++
  tests/functional/riscv64/meson.build      |   4 +
  tests/functional/riscv64/test_cpu_arch.py | 411 +++++++++++++++++++++
  9 files changed, 1311 insertions(+)

create mode 100644 tests/functional/riscv32/test_cpu_arch.py create mode 100644 tests/functional/riscv64/test_cpu_arch.py

--
2.52.0

author
#7 lore raw

Hi Daniel:

Thanks for your reply, and here is my response :)

Quoted 7 lines
Quoted 3 lines

1. How do you run RISC-V QEMU with a specific extension configuration? Please try to configure an rv64im user mode QEMU before you answer this question.

I would use the 'rv64i' bare CPU that we introduced a few releases ago and enable just 'm':

Quoted 6 lines

qemu-riscv64 -cpu rv64i,m=on

It gives you a bare bones CPU with only "RVI" enabled. We added this CPU specifically to support the use case you mentioned: users that want to have full control of what is enabled in the CPU.

Oh, thanks for this info, my impression of this is stuck in my memory of 2022, which is the time I wrote the qemu wrapper for riscv-gnu-toolchain, So I'm still using a rather clumsy way to play with qemu.

It's really good to know this, and I definitely need to update the script in riscv-gnu-toolchain :)

Quoted 10 lines

We can't control how riscv-gnu-toolchain and others implement their scripts and wrappers. These are the kind of thing that people write once and never look it back, and that's fine.

That said, we have 'rv64i' and other bare CPUs since QEMU 9.0, released in April
24. We don't need to do this kind of massive extension disablement to get a clean CPU for almost 2 years.

I advise to not take QEMU wrappers, scripts and etc from other projects as a sort of proof of what QEMU is currently capable. They're usually outdated.

Yeah, I admit that, I always spend time updating the script for mapping extension to
extension to qemu option...and it's hard to always be up to date.

Quoted 9 lines
Quoted 8 lines

So how do other tools/simulators address these problems? Toolchains like Clang and GCC use -march with an arch string to configure, and Spike uses --isa=<ISA-string> to configure.

Could we introduce a similar way to configure QEMU? Yes, I think we can. That's what this patch set does.

   -cpu rv64,arch=<ISA-string>
Quoted 7 lines

I don't mind the 'arch' property if users find it easier to enable extensions with it rather than the boolean properties, but it should be used on top of bare CPUs only. Otherwise the 'arch' property would include the already enabled extensions from 'rv64' and others.

And we would need to be okay with the fact that this is redundant to what we already can do with bare CPUs + manual extension enablement.

One point here is that the ISA string is the official way to represent the ISA configuration in RISC-V, it would be simpler if we can use the same string to set up every tool.

Quoted 15 lines

We have profile CPUs for this use case:

$ ./qemu-riscv64 -cpu help
Available CPUs:
   max
   rv64
   rv64e
   rv64i
   rva22s64
   rva22u64
   rva23s64
   rva23u64
(...)
Quoted 1 line

So 'qemu-riscv64 -cpu rva23u64' creates an user mode QEMU with RVA23.

To be honest, I was a little hesitant about adding the arch=<profile> syntax, because as you said, -cpu is already supported.

My final decision was to add it for alignment with the toolchain interface, but that's because I'm a toolchain developer.

Quoted 8 lines
Quoted 7 lines

5. zvl*b extensions

    Specify vector length (VLEN) in bits using zvl<N>b where N is a power
    of 2 (32-65536). Requires v or zve* extension.

    Examples:
      $ qemu-riscv64 -cpu rv64,arch=rv64gcv_zvl256b /bin/true
      $ qemu-riscv64 -cpu rv64,arch=rv64i_zve64f_zvl128b /bin/true
Quoted 5 lines

We already have vlen and elen properties. Not sure if we need another way to set the same stuff.

I'll give a closer look later at the first 2 patches (arch=dump and arch=help) since these are nice additions for the user experience.

The first two patches should be less controversial, so I'm okay with that if we decide to get the first two first :)

Quoted 7 lines

I would like to hear other opinions about arch=<ISA_STRING> because it would be just another way (probably an easier way) of doing what we already support with bare CPUs + manual extension enablement.

I don't see the need to support arch=PROFILE given that we have profile CPUs that does exactly that. Same thing for the 'vlen' setting.

The primary motivation for supporting zvl*b/VLEN syntax is to align with the toolchain interface, allowing users to process both qemu and the toolchain using a single string, and again, that is the official way to describe that info in RISC-V ISA spec, so I adding this syntax sugar in arch=<isa-str>.

#8 lore raw
Quoted 106 lines · Kito Cheng

Hi Daniel:

Thanks for your reply, and here is my response :)

Quoted 7 lines
Quoted 3 lines

1. How do you run RISC-V QEMU with a specific extension configuration? Please try to configure an rv64im user mode QEMU before you answer this question.

I would use the 'rv64i' bare CPU that we introduced a few releases ago and enable just 'm':

Quoted 6 lines

qemu-riscv64 -cpu rv64i,m=on

It gives you a bare bones CPU with only "RVI" enabled. We added this CPU specifically to support the use case you mentioned: users that want to have full control of what is enabled in the CPU.

Oh, thanks for this info, my impression of this is stuck in my memory of 2022, which is the time I wrote the qemu wrapper for riscv-gnu-toolchain, So I'm still using a rather clumsy way to play with qemu.

It's really good to know this, and I definitely need to update the script in riscv-gnu-toolchain :)

Quoted 10 lines

We can't control how riscv-gnu-toolchain and others implement their scripts and wrappers. These are the kind of thing that people write once and never look it back, and that's fine.

That said, we have 'rv64i' and other bare CPUs since QEMU 9.0, released in April
24. We don't need to do this kind of massive extension disablement to get a clean CPU for almost 2 years.

I advise to not take QEMU wrappers, scripts and etc from other projects as a sort of proof of what QEMU is currently capable. They're usually outdated.

Yeah, I admit that, I always spend time updating the script for mapping extension to
extension to qemu option...and it's hard to always be up to date.

Quoted 9 lines
Quoted 8 lines

So how do other tools/simulators address these problems? Toolchains like Clang and GCC use -march with an arch string to configure, and Spike uses --isa=<ISA-string> to configure.

Could we introduce a similar way to configure QEMU? Yes, I think we can. That's what this patch set does.

    -cpu rv64,arch=<ISA-string>
Quoted 7 lines

I don't mind the 'arch' property if users find it easier to enable extensions with it rather than the boolean properties, but it should be used on top of bare CPUs only. Otherwise the 'arch' property would include the already enabled extensions from 'rv64' and others.

And we would need to be okay with the fact that this is redundant to what we already can do with bare CPUs + manual extension enablement.

One point here is that the ISA string is the official way to represent the ISA configuration in RISC-V, it would be simpler if we can use the same string to set up every tool.

Quoted 15 lines

We have profile CPUs for this use case:

$ ./qemu-riscv64 -cpu help
Available CPUs:
    max
    rv64
    rv64e
    rv64i
    rva22s64
    rva22u64
    rva23s64
    rva23u64
(...)
Quoted 1 line

So 'qemu-riscv64 -cpu rva23u64' creates an user mode QEMU with RVA23.

To be honest, I was a little hesitant about adding the arch=<profile> syntax, because as you said, -cpu is already supported.

My final decision was to add it for alignment with the toolchain interface, but that's because I'm a toolchain developer.

Quoted 8 lines
Quoted 7 lines

5. zvl*b extensions

     Specify vector length (VLEN) in bits using zvl<N>b where N is a power
     of 2 (32-65536). Requires v or zve* extension.

     Examples:
       $ qemu-riscv64 -cpu rv64,arch=rv64gcv_zvl256b /bin/true
       $ qemu-riscv64 -cpu rv64,arch=rv64i_zve64f_zvl128b /bin/true
Quoted 5 lines

We already have vlen and elen properties. Not sure if we need another way to set the same stuff.

I'll give a closer look later at the first 2 patches (arch=dump and arch=help) since these are nice additions for the user experience.

The first two patches should be less controversial, so I'm okay with that if we decide to get the first two first :)

Quoted 5 lines

I would like to hear other opinions about arch=<ISA_STRING> because it would be just another way (probably an easier way) of doing what we already support with bare CPUs + manual extension enablement.

Quoted 8 lines
Quoted 2 lines

I don't see the need to support arch=PROFILE given that we have profile CPUs that does exactly that. Same thing for the 'vlen' setting.

The primary motivation for supporting zvl*b/VLEN syntax is to align with the toolchain interface, allowing users to process both qemu and the toolchain using a single string, and again, that is the official way to describe that info in RISC-V ISA spec, so I adding this syntax sugar in arch=<isa-str>.

I see.

Maybe there's an argument for supporting arch=ISA_STR in its entirely instead of cherry-picking what we want.

In the end the discussion you're prompting here is whether do we want/need to implement and support an alternative way of enabling extensions, and in this case one that is more compatible with the rest of the SW stack we use in the RISC-V land.

The implementation per se isn't the hard part: the hard part is how to deal with the upkeep of supporting both the ISA_STR and our current extension enable/disable code in the long run. I'm not entirely sure also whether we can use this new arch=ISA_STR as just a superficial layer to do what we already do or if this would require additional changes in QMP and what not. Drew, care to comment?

Daniel

#9 lore raw

On Mon, Jan 05, 2026 at 11:13:50AM -0300, Daniel Henrique Barboza wrote:
...

Quoted 2 lines

Maybe there's an argument for supporting arch=ISA_STR in its entirely instead of cherry-picking what we want.

I don't think so. Focusing on adopting profiles to describe large extension sets is the way to go in order to reduce extension management pain. The toolchains should be doing the same.

Quoted 5 lines

In the end the discussion you're prompting here is whether do we want/need to implement and support an alternative way of enabling extensions, and in this case one that is more compatible with the rest of the SW stack we use in the RISC-V land.

riscv qemu should be striving to have a single consistent interface for enabling extensions (cpufeatures) across all architectures. I don't think we should support multiple description mechanisms nor anything that is riscv unique. We also want boolean properties whenever possible as that simplifies interfaces like cpu-model-expansion.

Users that prefer the ISA string are always free to write an ISA string to qemu cpu property conversion script. qemu should never rename an extension, so it should be a simple 's/_/,/g' and additions of '=on'. If we do have special cases for naming, then I suggest we immediately add the correct names and deprecate the incorrect ones.

Thanks,
drew