eal/riscv: support RISC-V architecture
authorMichal Mazurek <maz@semihalf.com>
Tue, 7 Jun 2022 10:46:10 +0000 (12:46 +0200)
committerDavid Marchand <david.marchand@redhat.com>
Wed, 8 Jun 2022 09:26:20 +0000 (11:26 +0200)
commitf22e705ebf121973662fc484dfa6b4baa6d99a5c
treeb32580a923c7b9a9163842a1d3a40eea0cc26c50
parent7c754f553e500557f322958647281d541899ed14
eal/riscv: support RISC-V architecture

Add all necessary elements for DPDK to compile and run EAL on SiFive
Freedom U740 SoC which is based on SiFive U74-MC (ISA: rv64imafdc)
core complex.

This includes:

- EAL library implementation for rv64imafdc ISA.
- meson build structure for 'riscv' architecture. RTE_ARCH_RISCV define
  is added for architecture identification.
- xmm_t structure operation stubs as there is no vector support in the
  U74 core.

Compilation was tested on Ubuntu and Arch Linux using riscv64 toolchain.
Clang compilation currently not supported due to issues with missing
relocation relaxation.

Two rte_rdtsc() schemes are provided: stable low-resolution using rdtime
(default) and unstable high-resolution using rdcycle. User can override
the scheme by defining RTE_RISCV_RDTSC_USE_HPM=1 during compile time of
both DPDK and the application. The reasoning for this is as follows.
The RISC-V ISA mandates that clock read by rdtime has to be of constant
period and synchronized between all hardware threads within 1 tick
(chapter 10.1 in version 20191213 of RISC-V spec).
However this clock may not be of high-enough frequency for dataplane
uses. I.e. on HiFive Unmatched (FU740) it is 1MHz.
There is a high-resolution alternative in form of rdcycle which is
clocked at the core clock frequency. The drawbacks are that it may be
disabled during sleep (WFI), its frequency might change due to DVFS and
it is core-local and therefore cannot be used as a wall-clock. It can
however be used for micro-benchmarking user applications, similarly to
Aarch64's PMCCNTR PMU counter.

The platform is currently marked as linux-only because rte_cycles
implementation uses the timebase-frequency device-tree node read through
the proc file system. Such approach was chosen because Linux kernel
depends on the presence of this device-tree node.

The i40e PMD driver is disabled on RISC-V as the rv64gc ISA has no vector
operations.

The compilation of following modules has been disabled by this commit
and will be re-enabled in later commits as fixes are introduced:
net/ixgbe, net/memif, net/tap, example/l3fwd.

Sponsored-by: Frank Zhao <frank.zhao@starfivetech.com>
Sponsored-by: Sam Grove <sam.grove@sifive.com>
Signed-off-by: Michal Mazurek <maz@semihalf.com>
Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
39 files changed:
MAINTAINERS
app/test/test_xmmt_ops.h
config/meson.build
config/riscv/meson.build [new file with mode: 0644]
config/riscv/riscv64_linux_gcc [new file with mode: 0644]
config/riscv/riscv64_sifive_u740_linux_gcc [new file with mode: 0644]
doc/guides/contributing/design.rst
doc/guides/linux_gsg/cross_build_dpdk_for_riscv.rst [new file with mode: 0644]
doc/guides/linux_gsg/index.rst
doc/guides/nics/features.rst
doc/guides/nics/features/default.ini
doc/guides/rel_notes/release_22_07.rst
drivers/net/i40e/meson.build
drivers/net/ixgbe/meson.build
drivers/net/memif/meson.build
drivers/net/tap/meson.build
examples/l3fwd/meson.build
lib/eal/riscv/include/meson.build [new file with mode: 0644]
lib/eal/riscv/include/rte_atomic.h [new file with mode: 0644]
lib/eal/riscv/include/rte_byteorder.h [new file with mode: 0644]
lib/eal/riscv/include/rte_cpuflags.h [new file with mode: 0644]
lib/eal/riscv/include/rte_cycles.h [new file with mode: 0644]
lib/eal/riscv/include/rte_io.h [new file with mode: 0644]
lib/eal/riscv/include/rte_mcslock.h [new file with mode: 0644]
lib/eal/riscv/include/rte_memcpy.h [new file with mode: 0644]
lib/eal/riscv/include/rte_pause.h [new file with mode: 0644]
lib/eal/riscv/include/rte_pflock.h [new file with mode: 0644]
lib/eal/riscv/include/rte_power_intrinsics.h [new file with mode: 0644]
lib/eal/riscv/include/rte_prefetch.h [new file with mode: 0644]
lib/eal/riscv/include/rte_rwlock.h [new file with mode: 0644]
lib/eal/riscv/include/rte_spinlock.h [new file with mode: 0644]
lib/eal/riscv/include/rte_ticketlock.h [new file with mode: 0644]
lib/eal/riscv/include/rte_vect.h [new file with mode: 0644]
lib/eal/riscv/meson.build [new file with mode: 0644]
lib/eal/riscv/rte_cpuflags.c [new file with mode: 0644]
lib/eal/riscv/rte_cycles.c [new file with mode: 0644]
lib/eal/riscv/rte_hypervisor.c [new file with mode: 0644]
lib/eal/riscv/rte_power_intrinsics.c [new file with mode: 0644]
meson.build