dde_rump: add RISC-V support

This commit adds RISC-V file-system support through the backport
originally provided by ARMv8.

fixes #4800
This commit is contained in:
Sebastian Sumpf 2023-03-29 12:43:50 +02:00 committed by Christian Helmuth
parent 7be915a185
commit e27737a0a5
10 changed files with 224 additions and 18 deletions

View File

@ -19,7 +19,11 @@ endif
ifeq ($(filter-out $(SPECS),arm_64),)
INC_DIR := $(RUMP_PORT_DIR)/src/sys/rump/include $(INC_DIR)
INC_DIR += $(REP_DIR)/src/lib/rump/spec/arm_64
INC_DIR += $(RUMP_PORT_DIR)/../dde_rump_aarch64_backport/aarch64/include
INC_DIR += $(RUMP_PORT_DIR)/../dde_rump_backport/aarch64/include
endif
ifeq ($(filter-out $(SPECS),riscv),)
INC_DIR += $(RUMP_PORT_DIR)/../dde_rump_backport/riscv/include
endif
INC_DIR += $(LIBGCC_INC_DIR) \

View File

@ -14,10 +14,10 @@ INC_DIR += $(REP_DIR)/src/lib/rump/spec/arm_64
include $(REP_DIR)/lib/mk/rump.inc
vpath %.S $(RUMP_PORT_DIR)/../libc
vpath %.S $(RUMP_PORT_DIR)/../libc/aarch64/atomic
vpath %.c $(RUMP_PORT_DIR)/src/common/lib/libc/gen
vpath %.c $(RUMP_PORT_DIR)/../dde_rump_aarch64_backport/aarch64/aarch64
vpath %.c $(RUMP_PORT_DIR)/../dde_rump_aarch64_backport/arm/arm32
vpath %.c $(RUMP_PORT_DIR)/../dde_rump_backport/aarch64/aarch64
vpath %.c $(RUMP_PORT_DIR)/../dde_rump_backport/arm/arm32
vpath %.c $(RUMP_PORT_DIR)/src/sys/rump/librump/rumpkern/arch/generic
CC_CXX_WARN_STRICT =

View File

@ -2,7 +2,7 @@ ifeq ($(called_from_lib_mk),yes)
include $(REP_DIR)/lib/mk/rump_common.inc
BACKPORT := $(call select_from_ports,dde_rump)/src/lib/dde_rump_aarch64_backport
BACKPORT := $(call select_from_ports,dde_rump)/src/lib/dde_rump_backport
$(RUMP_BASE):
mkdir -p $@

View File

@ -0,0 +1,19 @@
SRC_NOLINK += atomic_add_32.S atomic_add_64.S atomic_and_32.S atomic_and_64.S \
atomic_cas_32.S atomic_cas_64.S atomic_nand_32.S atomic_nand_64.S \
atomic_or_32.S atomic_or_64.S atomic_sub_32.S atomic_sub_64.S \
atomic_swap_32.S atomic_swap_64.S atomic_xor_32.S atomic_xor_64.S \
membar_ops.S
SRC_NOLINK += rump_generic_cpu.c rump_generic_pmap.c
INC_DIR += $(RUMP_PORT_DIR)/src/sys/rump/include
#INC_DIR += $(REP_DIR)/src/lib/rump/spec/arm_64
include $(REP_DIR)/lib/mk/rump.inc
vpath %.S $(RUMP_PORT_DIR)/../libc/riscv/atomic
vpath %.c $(RUMP_PORT_DIR)/src/common/lib/libc/gen
vpath %.c $(RUMP_PORT_DIR)/../dde_rump_backport/riscv/riscv
vpath %.c $(RUMP_PORT_DIR)/src/sys/rump/librump/rumpkern/arch/generic
CC_CXX_WARN_STRICT =

View File

@ -0,0 +1,22 @@
ifeq ($(called_from_lib_mk),yes)
include $(REP_DIR)/lib/mk/rump_common.inc
BACKPORT := $(call select_from_ports,dde_rump)/src/lib/dde_rump_backport
$(RUMP_BASE):
mkdir -p $@
$(RUMP_BASE)/include/machine: $(RUMP_BASE)
$(VERBOSE_MK)mkdir -p $(RUMP_BASE)/include
$(VERBOSE_MK)ln -sf $(BACKPORT)/riscv/include $(RUMP_BASE)/include/machine
$(VERBOSE_MK)ln -sf $(BACKPORT)/riscv/include $(RUMP_BASE)/include/riscv
$(VERBOSE_MK)touch -a $(RUMP_BASE)/include/pthread_types.h
all: $(RUMP_BASE)/include/machine
endif
# vi:set ft=make :
CC_CXX_WARN_STRICT =

View File

@ -1,7 +1,7 @@
diff --git a/arm/arm32/kobj_machdep.c b/arm/arm32/kobj_machdep.c
index 6fc772f..146f580 100644
--- src/lib/dde_rump_aarch64_backport/arm/arm32/kobj_machdep.c
+++ src/lib/dde_rump_aarch64_backport/arm/arm32/kobj_machdep.c
--- src/lib/dde_rump_backport/arm/arm32/kobj_machdep.c
+++ src/lib/dde_rump_backport/arm/arm32/kobj_machdep.c
@@ -66,6 +66,7 @@ __KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.10 2014/11/07 21:28:32 martin Exp
#include <sys/kobj_impl.h>

View File

@ -0,0 +1,157 @@
diff --git a/src/lib/dde_rump_backport/riscv/include/cpu.h b/src/lib/dde_rump_backport/riscv/include/cpu.h
deleted file mode 100644
index 2b6f036..0000000
--- src/lib/dde_rump_backport/riscv/include/cpu.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* $NetBSD: cpu.h,v 1.4 2015/04/01 21:55:03 matt Exp $ */
-
-/*-
- * Copyright (c) 2014 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Matt Thomas of 3am Software Foundry.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef _RISCV_CPU_H_
-#define _RISCV_CPU_H_
-
-#if defined(_KERNEL) || defined(_KMEMUSER)
-
-struct clockframe {
- uintptr_t cf_pc;
- uint32_t cf_sr;
- int cf_intr_depth;
-};
-
-#define CLKF_USERMODE(cf) (((cf)->cf_sr & 1) == 0)
-#define CLKF_PC(cf) ((cf)->cf_pc)
-#define CLKF_INTR(cf) ((cf)->cf_intr_depth > 0)
-
-#include <sys/cpu_data.h>
-#include <sys/device_if.h>
-#include <sys/evcnt.h>
-#include <sys/intr.h>
-
-struct cpu_info {
- struct cpu_data ci_data;
- device_t ci_dev;
- cpuid_t ci_cpuid;
- struct lwp *ci_curlwp;
- struct lwp *ci_softlwps[SOFTINT_COUNT];
- struct trapframe *ci_ddb_regs;
-
- uint64_t ci_lastintr;
-
- int ci_mtx_oldspl;
- int ci_mtx_count;
-
- int ci_want_resched;
- int ci_cpl;
- u_int ci_softints;
- volatile u_int ci_intr_depth;
-
- tlb_asid_t ci_pmap_asid_cur;
-#if 0
- union pmap_pdetab *ci_pmap_user_pdetab;
-#ifdef _LP64
- union pmap_pdetab *ci_pmap_user_pde0tab;
-#endif
-#endif
-
- struct evcnt ci_ev_fpu_saves;
- struct evcnt ci_ev_fpu_loads;
- struct evcnt ci_ev_fpu_reenables;
-};
-
-#endif /* _KERNEL || _KMEMUSER */
-
-#ifdef _KERNEL
-
-extern struct cpu_info cpu_info_store;
-
-// This is also in <sys/lwp.h>
-struct lwp;
-static inline struct cpu_info *lwp_getcpu(struct lwp *);
-
-register struct lwp *riscv_curlwp __asm("tp");
-#define curlwp riscv_curlwp
-#define curcpu() lwp_getcpu(curlwp)
-
-static inline cpuid_t
-cpu_number(void)
-{
-#ifdef MULTIPROCESSOR
- return curcpu()->ci_cpuid;
-#else
- return 0;
-#endif
-}
-
-void cpu_set_curpri(int);
-void cpu_proc_fork(struct proc *, struct proc *);
-void cpu_signotify(struct lwp *);
-void cpu_need_proftick(struct lwp *l);
-void cpu_boot_secondary_processors(void);
-
-#define CPU_INFO_ITERATOR cpuid_t
-#ifdef MULTIPROCESSOR
-#define CPU_INFO_FOREACH(cii, ci) \
- (cii) = 0; ((ci) = cpu_infos[cii]) != NULL; (cii)++
-#else
-#define CPU_INFO_FOREACH(cii, ci) \
- (cii) = 0, (ci) = curcpu(); (cii) == 0; (cii)++
-#endif
-
-#define CPU_INFO_CURPMAP(ci) (curlwp->l_proc->p_vmspace->vm_map.pmap)
-
-static inline void
-cpu_dosoftints(void)
-{
- extern void dosoftints(void);
- struct cpu_info * const ci = curcpu();
- if (ci->ci_intr_depth == 0
- && (ci->ci_data.cpu_softints >> ci->ci_cpl) > 0)
- dosoftints();
-}
-
-static inline bool
-cpu_intr_p(void)
-{
- return curcpu()->ci_intr_depth > 0;
-}
-
-#define LWP_PC(l) cpu_lwp_pc(l)
-
-vaddr_t cpu_lwp_pc(struct lwp *);
-
-static inline void
-cpu_idle(void)
-{
-}
-
-#endif /* _KERNEL */
-
-#endif /* _RISCV_CPU_H_ */

View File

@ -1 +1 @@
bb358512dc48cc6c2221de4e3fe105ed0a3ed847
3138648e26b680c38a2ddfcc54bf8a939e3c6065

View File

@ -1,17 +1,21 @@
LICENSE := BSD
VERSION := git
DOWNLOADS := rump.git aarch64.svn libc.svn
DOWNLOADS := rump.git backport.svn libc_aarch64.svn libc_riscv.svn
URL(rump) := https://github.com/ssumpf/rump.git
DIR(rump) := src/lib/dde_rump
REV(rump) := 206ffa06cedd0779af0043997fd182b00ff4688c
REV(rump) := 28945d1af5f66c98a3884453adf84ede4ca1b702
URL(aarch64) := https://github.com/justincormack/netbsd-src/trunk/src/sys/arch
REV(aarch64) := HEAD
DIR(aarch64) := src/lib/dde_rump_aarch64_backport
URL(backport) := https://github.com/justincormack/netbsd-src/trunk/src/sys/arch
REV(backport) := HEAD
DIR(backport) := src/lib/dde_rump_backport
URL(libc) := https://github.com/justincormack/netbsd-src/trunk/src/common/lib/libc/arch/aarch64/atomic
REV(libc) := HEAD
DIR(libc) := src/lib/libc
URL(libc_aarch64) := https://github.com/justincormack/netbsd-src/trunk/src/common/lib/libc/arch/aarch64/atomic
REV(libc_aarch64) := HEAD
DIR(libc_aarch64) := src/lib/libc/aarch64/atomic
PATCHES := patches/rump.patch patches/aarch64.patch patches/sync.patch
URL(libc_riscv) := https://github.com/justincormack/netbsd-src/trunk/src/common/lib/libc/arch/riscv/atomic
REV(libc_riscv) := HEAD
DIR(libc_riscv) := src/lib/libc/riscv/atomic
PATCHES := patches/rump.patch patches/aarch64.patch patches/riscv.patch patches/sync.patch

View File

@ -18,7 +18,7 @@ MIRROR_FROM_REP_DIR := $(LIB_MK) \
MIRROR_FROM_PORT_DIR := src/lib/dde_rump/src \
src/lib/libc \
src/lib/dde_rump_aarch64_backport
src/lib/dde_rump_backport
content: $(MIRROR_FROM_REP_DIR) $(MIRROR_FROM_PORT_DIR)