[RFC 1/4] RISC-V: Hypervisor ext: Treat as "Standard" extension

Vineet Gupta vineetg@rivosinc.com
Fri Dec 17 22:40:04 GMT 2021



On 12/17/21 8:10 AM, Nelson Chu wrote:
> On Fri, Dec 17, 2021 at 12:10 PM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>> On Thu, 16 Dec 2021 09:33:25 PST (-0800), Vineet Gupta wrote:
>>> diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
>>> index 3bd41ff2b551..7d5ae5a4657d 100644
>>> --- a/bfd/elfxx-riscv.c
>>> +++ b/bfd/elfxx-riscv.c
>>> @@ -1173,6 +1173,7 @@ static struct riscv_supported_ext riscv_supported_std_ext[] =
>>>     {"t",              ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>>>     {"p",              ISA_SPEC_CLASS_NONE, RISCV_UNKNOWN_VERSION, RISCV_UNKNOWN_VERSION, 0 },
>>>     {"v",              ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
>>> +  {"h",              PRIV_SPEC_CLASS_DRAFT,          1, 0, 0 },
>> According to
>> <https://wiki.riscv.org/display/TECH/Recently+Ratified+Extensions>, this
>> was ratified in November so we should be able to update this to
>> something like PRIV_SPEC_CLASS_1P12 (the V stuff was also ratified, but
>> that's a different issue).
> I can understand that why Vineet are doing these changes, but I had a
> quick talk with Kito this morning, and I think we also have three
> issues for now,
>
> 1. The current draft ISA spec doesn't have any related changes, so if
> we change the `h' as a single standard extension, then this will
> conflict with the spec.

Sure it does conflict, but this has implications on downstream projects 
(linux kernel, opensbi,...) as they need to add the toggles to their 
build systems. And when the spec changes we need to update the tools and 
then change the toggles downstream. This is all tricky to coordinate. 
However I do understand spec correctness argument so we'll keep 
thestatus quo and stick to multi-letter naming for "h".

So given h extension has been supported so far how is one to use it - I 
can't make gas or gcc grok any of the following
-march=rv64{h,_h,_h1p10,...}

riscv64-unknown-elf-gcc: error: '-march=rv64g_h1p10': name of hypervisor 
extension must be more than 1 letter

What am I missing ?

> 2. Even if we decide to change the `h' as a single extension rather
> than the multiple prefixed keyword, then in what order should we place
> h.  I expect the table 27.1 in the ISA spec will also mention the
> order of the single h.
>
> 3. I never considered that an extension version may be controlled by
> the privileged spec before, so in the riscv_get_default_ext_version,
>
>>>         if (strcmp (table[i].name, name) == 0
>>>          && (table[i].isa_spec_class == ISA_SPEC_CLASS_DRAFT
>>> +           || table[i].isa_spec_class == PRIV_SPEC_CLASS_DRAFT
>>>              || table[i].isa_spec_class == *default_isa_spec))
> We will need to rewrite the related code, since the isa_spec_class may
> be one of the PRIV_SPEC_CLASS_XXX in the future, so we will never
> match it to the default_isa_spec...

OK lets leave 'h' to multi-letter for now.

Thx,
-Vineet


More information about the Binutils mailing list