qemuriscv32: Remove the 32-bit RISC-V machine

OE-Core now has support for the 32-bit RISC-V QEMU machine, so let's
remove it from here.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Alistair Francis
2021-02-09 10:33:10 -08:00
committed by Khem Raj
parent 5da7c891be
commit 9e88baad29
9 changed files with 4 additions and 178 deletions

View File

@@ -58,12 +58,13 @@ repo rebase
## Available Machines
The three different machines you can build for are:
The different machines you can build for are:
* qemuriscv64: The 64-bit RISC-V machine
* qemuriscv32: The 32-bit RISC-V machine
* freedom-u540: The SiFive HiFive Unleashed board
Note that this layer also provides improvements and features for the
upstream qemuriscv32 and qemuriscv64 machines.
## Build Images
A console-only image for the 64-bit QEMU machine

View File

@@ -1,17 +0,0 @@
#@TYPE: Machine
#@NAME: generic riscv32 machine
#@DESCRIPTION: Machine configuration for running a generic riscv32
require conf/machine/include/riscv/qemuriscv.inc
DEFAULTTUNE = "riscv32"
PREFERRED_VERSION_openocd-native = "riscv"
PREFERRED_VERSION_openocd = "riscv"
XVISOR_PLAT = "riscv/virt32"
# u-boot doesn't compile, error: "can't link hard-float modules with soft-float modules"
EXTRA_IMAGEDEPENDS += "u-boot"
UBOOT_MACHINE = "qemu-riscv32_smode_defconfig"
UBOOT_ELF = "u-boot"

View File

@@ -1,41 +0,0 @@
From 66dfe0fa886f6289add06d1af8642ce2b5302852 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 9 Feb 2021 16:40:12 -0800
Subject: [PATCH] riscv32: Use double-float ABI for rv32
So it can use libgcc built with OE toolchain
Fixes
error: "can't link hard-float modules with soft-float modules"
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
arch/riscv/Makefile | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/arch/riscv/Makefile b/arch/riscv/Makefile
index 0b80eb8d86..7324946f48 100644
--- a/arch/riscv/Makefile
+++ b/arch/riscv/Makefile
@@ -9,7 +9,9 @@ ifeq ($(CONFIG_ARCH_RV64I),y)
endif
ifeq ($(CONFIG_ARCH_RV32I),y)
ARCH_BASE = rv32im
- ABI = ilp32
+ ABI = ilp32d
+ ARCH_D = d
+ ARCH_F = f
endif
ifeq ($(CONFIG_RISCV_ISA_A),y)
ARCH_A = a
@@ -24,7 +26,7 @@ ifeq ($(CONFIG_CMODEL_MEDANY),y)
CMODEL = medany
endif
-ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_C) -mabi=$(ABI) \
+ARCH_FLAGS = -march=$(ARCH_BASE)$(ARCH_A)$(ARCH_F)$(ARCH_D)$(ARCH_C) -mabi=$(ABI) \
-mcmodel=$(CMODEL)
PLATFORM_CPPFLAGS += $(ARCH_FLAGS)
--
2.30.0

View File

@@ -7,8 +7,6 @@ SRC_URI_append_freedom-u540_sota = " file://uEnv.txt"
DEPENDS_append_freedom-u540 = " u-boot-tools-native"
SRC_URI_append_qemuriscv32 = " file://0001-riscv32-Use-double-float-ABI-for-rv32.patch"
# Overwrite this for your server
TFTP_SERVER_IP ?= "127.0.0.1"

View File

@@ -1,58 +0,0 @@
From d1a1b797d961301fd58513e50ac5de9ad5b8bc08 Mon Sep 17 00:00:00 2001
From: Alistair Francis <alistair.francis@wdc.com>
Date: Thu, 29 Aug 2019 13:56:21 -0700
Subject: [PATCH] Add support for io_pgetevents_time64 syscall
32-bit architectures that are y2038 safe don't include syscalls that use
32-bit time_t. Instead these architectures have suffixed syscalls that
always use a 64-bit time_t. In the case of the io_getevents syscall the
syscall has been replaced with the io_pgetevents_time64 syscall instead.
This patch changes the io_getevents() function to use the correct
syscall based on the avaliable syscalls and the time_t size. We will
only use the new 64-bit time_t syscall if the architecture is using a
64-bit time_t. This is to avoid having to deal with 32/64-bit
conversions and relying on a 64-bit timespec struct on 32-bit time_t
platforms. As of Linux 5.3 there are no 32-bit time_t architectures
without __NR_io_getevents. In the future if a 32-bit time_t architecture
wants to use the 64-bit syscalls we can handle the conversion.
This fixes build failures on 32-bit RISC-V.
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Upstream-Status: Submitted [https://github.com/openssl/openssl/pull/9819]
---
engines/e_afalg.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/engines/e_afalg.c b/engines/e_afalg.c
index dacbe358cb..99516cb1bb 100644
--- a/engines/e_afalg.c
+++ b/engines/e_afalg.c
@@ -125,7 +125,23 @@ static ossl_inline int io_getevents(aio_context_t ctx, long min, long max,
struct io_event *events,
struct timespec *timeout)
{
+#if defined(__NR_io_getevents)
return syscall(__NR_io_getevents, ctx, min, max, events, timeout);
+#elif defined(__NR_io_pgetevents_time64)
+ /* Let's only support the 64 suffix syscalls for 64-bit time_t.
+ * This simplifies the code for us as we don't need to use a 64-bit
+ * version of timespec with a 32-bit time_t and handle converting
+ * between 64-bit and 32-bit times and check for overflows.
+ */
+ if (sizeof(timeout->tv_sec) == 8)
+ return syscall(__NR_io_pgetevents_time64, ctx, min, max, events, timeout, NULL);
+ else {
+ errno = ENOSYS;
+ return -1;
+ }
+#else
+# error "We require either the io_getevents syscall or __NR_io_pgetevents_time64."
+#endif
}
static void afalg_waitfd_cleanup(ASYNC_WAIT_CTX *ctx, const void *key,
--
2.23.0

View File

@@ -1,5 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI_append_riscv32 = " \
file://0001-Add-support-for-io_pgetevents_time64-syscall.patch \
"

View File

@@ -1,44 +0,0 @@
From 4965d191806c9a28bffbb157228bf42270b0008e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 16 Nov 2020 11:03:31 -0800
Subject: [PATCH] perf: Alias SYS_futex with SYS_futex_time64 on 32-bit arches
with 64bit time_t
glibc does not define SYS_futex for 32bit architectures using 64bit
time_t e.g. riscv32, therefore perf fails to compile as it does not find
SYS_futex in C library headers, define it to SYS_futex_time64 when it
exists
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
tools/perf/bench/futex.h | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/perf/bench/futex.h b/tools/perf/bench/futex.h
index 31b53cc7d5bc..33f3f3230ae1 100644
--- a/tools/perf/bench/futex.h
+++ b/tools/perf/bench/futex.h
@@ -13,6 +13,19 @@
#include <sys/types.h>
#include <linux/futex.h>
+/**
+ * SYS_futex is expected from system C library,
+ * in glibc (/usr/include/bits/syscall.h defines it in terms of of NR_futex)
+ * some newer 32bit architectures e.g. RISCV32 is using 64bit time_t from
+ * get go unlike other 32bit architectures in glibc, therefore it wont have
+ * NR_futex defined but just NR_futex_time64 this aliases it to NR_futex
+ * so that SYS_futex is then defined for rv32
+*/
+
+#if !defined(SYS_futex) && defined(SYS_futex_time64)
+#define SYS_futex SYS_futex_time64
+#endif
+
/**
* futex() - SYS_futex syscall wrapper
* @uaddr: address of first futex
--
2.29.2

View File

@@ -1 +0,0 @@
COMPATIBLE_MACHINE_append = "|qemuriscv32"

View File

@@ -1,7 +0,0 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
COMPATIBLE_MACHINE_append = "|qemuriscv32"
SRC_URI_append_riscv32 = "\
file://0001-perf-Alias-SYS_futex-with-SYS_futex_time64-on-32-bit.patch \
"