[Rpm-maint] [PATCH] RISCV 64-bit (riscv64) support.

Richard W.M. Jones rjones at redhat.com
Wed Aug 10 21:11:05 UTC 2016

On Wed, Aug 10, 2016 at 04:50:27PM -0400, Neal Gompa wrote:
> On Wed, Aug 10, 2016 at 1:52 PM, Richard W.M. Jones <rjones at redhat.com> wrote:
> > On Wed, Aug 10, 2016 at 06:51:43PM +0100, Richard W.M. Jones wrote:
> >> So this sort of works.
> >>
> >> However %{_arch} is not defined, for reasons I don't understand.
> >>
> >>   # uname -a
> >>   Linux stage3 4.1.26-01508-g592a151 #1 Sat Aug 6 08:53:06 BST 2016 riscv GNU/Linux
> >>
> >> and according to
> >>
> >>   http://www.rpm.org/max-rpm-snapshot/s1-rpm-multi-build-install-detection.html
> >>
> >> what I've done should map "riscv" from the kernel to "riscv64".
> >>
> >> /usr/lib/rpm/platform/riscv64-linux/macros is created (see attached)
> >> but apparently it is not read in by rpm.
> >
> > With the attachment this time.
> >
> > Rich.
> >
> Could you please define the full spectrum of RISC-V architectures? I
> know you only plan on doing 64-bit RISC-V, but it's much better when
> the full platform is supported. Even when Michal Toman added MIPS
> support for his MIPS bootstrap, he added all the arch variants,
> including the ones he doesn't intend to use in Fedora right now. It
> makes it much easier when someone (maybe even you!) decides to use it
> for some other arch variant later.

I don't actually know RISC-V that well, but here goes ...

There are 3 major variants (32-, 64- and 128-bit), but each of those
has several base instruction sets -- eg. RV32I is 32 bit base with
only integers, RV32E is an embedded 32 bit variant.

There are also a bunch of options.  Even integer multiplication is
optional.  See:


I don't know to what extent we would want to encode all these into rpm
at the moment, especially as it's not clear which will "win" in terms
of coming to real hardware.

For Fedora, I only care about what is technically known as
"RV64IMAFDC" (RISC-V 64 bit with Integer, Multiplication, Atomics,
single Float and Double float and Compressed instructions), which is
what GNU calls "riscv64".

Note that Linux likely wouldn't run at all without most of those

There are also varieties of the "priv-spec", that is the definition of
privileged instructions between the kernel and the platform (which as
well as instructions, also includes various platform registers,
similar to MSRs on x86).  The current priv-spec is 1.7, but they are
moving to 1.9 (don't ask me what happened to 1.8 :-)


As far as I'm aware we don't yet need to worry about this at the RPM

I don't know [or care] if RISC-V 64 bit chips will run 32 bit code.

> As for /usr/lib/rpm/platform/riscv64-linux/macros, it is actually
> used, but it's not documented properly. My understanding is that the
> /usr/lib/rpm/platform folder is supposed to be where you can
> dynamically set platforms (creating a new platform is supposed to be
> as simple as just adding the directory and defining the macros).
> However, the migration from rpmrc to normal macros and the
> /usr/lib/rpm/platform structure was never completed. So some parts of
> the platform definition are there, while the rpmrc is still required
> for the architecture enumeration itself.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.

More information about the Rpm-maint mailing list