Coder Social home page Coder Social logo

riscvarchive / riscv-linux Goto Github PK

View Code? Open in Web Editor NEW
604.0 118.0 203.0 1.54 GB

RISC-V Linux Port

Makefile 0.25% C 96.30% C++ 1.37% Assembly 1.36% Objective-C 0.31% Shell 0.13% Perl 0.13% Awk 0.01% Python 0.09% Yacc 0.02% Lex 0.01% UnrealScript 0.01% Perl 6 0.01% Gherkin 0.01% XS 0.01% Roff 0.02% Clojure 0.01% M4 0.01% sed 0.01%

riscv-linux's Introduction

riscv-linux's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

riscv-linux's Issues

When compile linux kernel got error 'Error: Instruction csrr requires absolute expression'

The error messages are

CC      arch/riscv/kernel/time.o
arch/riscv/kernel/time.c: Assembler messages:
arch/riscv/kernel/time.c:51: Error: Instruction csrr requires absolute expression
arch/riscv/kernel/time.c:15: Error: Instruction csrr requires absolute expression
scripts/Makefile.build:258: recipe for target 'arch/riscv/kernel/time.o' failed
make[1]: *** [arch/riscv/kernel/time.o] Error 1
Makefile:948: recipe for target 'arch/riscv/kernel' failed
make: *** [arch/riscv/kernel] Error 2

I have tried riscv64-unknown-linux-gnu-gcc compiled from the riscv-tools master branch and priv-1.9 branch but they all report error. The version of my kernel source code is 4.1.31.

[question] Target Privileged ISA Spec

Which version of the Privileged ISA Specification does riscv-linux currently target? Is there a branch that already targets the upcoming spec 1.9?

Running "spike bbl" command freezing in the current build

Hello,
I built the complete Linux environment by following the steps provided in this as well as the ones given in riscv-tools repository. I did the following steps.
1. Built the busybox utility with all the suggested menu-configurations. There were two ways of getting the initramfs.txt and inittab files (one in riscv-tools and the other here). I used the steps from this repository.
2. Successfully built the linux kernel image (vmlinux) and bbl (after recompiling both riscv-linux and riscv-pk).
However, When I run the command spike bbl, it just freezes instead of the debug printk's on the screen and when you try to come out (forcefully - upon ctrl+C), Spike goes to debug mode. There also seems to be a trap instruction access fault when you try to execute it in debug mode.
3. I have another build where I followed the same steps, on a previous version of the riscv-tools which seems to work fine, where the bootup process goes till the ash terminal invocation. Please help.

Corrupt SV32 page table generation in the function setup_vm

Since commit e84bcd9 the setup of the page table is broken for SV32 type page tables.
The function
https://github.com/riscv/riscv-linux/blob/priv-1.10/arch/riscv/kernel/setup.c#L78
assumes a Page Middle Directory (3 level page table) with is not available for SV32.

I have hacked a solution, which does work for me and 32-Bit Linux boots again. You might want to use is as basis for a fix. But the code ignores the other page table types.

asmlinkage void __init setup_vm(void)
{
        extern char _start;
        uintptr_t i;
        uintptr_t pa = (uintptr_t) &_start;
        uintptr_t prot = pgprot_val(PAGE_KERNEL) | _PAGE_EXEC;
        pgd_t pmd = __pgd((PFN_DOWN(pa) << _PAGE_PFN_SHIFT) | prot);
        va_pa_offset = PAGE_OFFSET - pa;
        pfn_base = PFN_DOWN(pa);
        trampoline_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD] = pmd;
        for (i = 0; i < (-PAGE_OFFSET)/PGDIR_SIZE; ++i) {
                swapper_pg_dir[(PAGE_OFFSET >> PGDIR_SHIFT) % PTRS_PER_PGD + i] =
                        __pgd((PFN_DOWN(pa) << _PAGE_PFN_SHIFT) | prot);
                pa += PGDIR_SIZE;
        }
}

Any todo list for upstream?

Hi,
I saw a lot of review and submit in the patch mailing list.
Could I know the todo list so that i could pick up some corner to help?
Thanks

RTOS support on RISCV

Dear RISCV Team,

I am wondering that if there's an Real time OS linux that would be compatible with RISCV rocket-chip core? If so, could you point me to the right direction?

Thanks!

upstream arch/riscv/configs/defconfig is empty

Based on riscvarchive/riscv-qemu#79 there are suggestions for some new default CONFIG options for arch/riscv/configs/defconfig.

When I looked into the v4.15-rc3 for the current defaults, I found none (apart what you get from Kconfig): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/arch/riscv/configs/defconfig?h=v4.15-rc3

While freedom-u-sdk has the following: https://github.com/sifive/freedom-u-sdk/blob/master/conf/linux_defconfig which probably is a good starting point, plus things from the mentioned pull request later on.

Other beneficial default things could be NFS, ext* stuff, namespaces, cgroups (basically thing to allow containers), etc. I could try to study arm64 defconfig to see what people added and why. Otherwise the kernel is very bare.

fopen return error #38

I have put a binary that contains fopen() function in the root of disk image. But it generates errno #38 when fopen() function is called and file pointer is NULL. Some other applets like cat and redirection to output file works fine in riscv linux which means that files can be read and written. Is there anything I missed in configuration or anything else?

Thank you.

Having booting kernel for buildroot

Hi
I managed to create buildroot toolchiain for riscv64 and I use riscv-next branch of Linux.
however unlike the master branch of riscv-linux the riscv-next branch fails to boot (bbl silently hangs).
I wish to use master, but it is only having the riscv arch directory.
The master readme file says Full kernel source trees, but I can't find any linux-4.6.y-riscv branch.

Please assist

build instructions slightly wrong?

[Reposted from an ucb-bar / riscv-tools issue]

Thank you so much! It's working brilliantly.

I had to make a few modifications to get it to work: first arch wants to be inside linux-3.4.76 so I did

mkdir linux-3.4.76 && mv arch linux-3.4.76

before the curl step. Also, building riscv-gcc with make linux fails for me, but the riscv-tools works great, so I instead just edited arch/riscv/configs/riscv_defconfig:CONFIG_CROSS_COMPILE to point to riscv- instead of riscv-linux-

Multicore (SMP) support?

I've been trying to build and run the kernel on a multiple core (32-1024 cores) machine, using Spike ISA Simulator. I tried to run that using QEMU as well, but that did not work as the machine_type did not support an SMP greater than 1.

Here is the console output I get when I run it using Spike ISA Simulator:

aneeshneelam@Aneesh-Ubuntu-VirtualBox:~/Developer/test$ spike +disk=root.bin bbl vmlinux -p 1024
              vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
                  vvvvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr       vvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr      vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr      vvvvvvvvvvvvvvvvvvvvvv  
rrrrrrrrrrrrr       vvvvvvvvvvvvvvvvvvvvvv    
rr                vvvvvvvvvvvvvvvvvvvvvv      
rr            vvvvvvvvvvvvvvvvvvvvvvvv      rr
rrrr      vvvvvvvvvvvvvvvvvvvvvvvvvv      rrrr
rrrrrr      vvvvvvvvvvvvvvvvvvvvvv      rrrrrr
rrrrrrrr      vvvvvvvvvvvvvvvvvv      rrrrrrrr
rrrrrrrrrr      vvvvvvvvvvvvvv      rrrrrrrrrr
rrrrrrrrrrrr      vvvvvvvvvv      rrrrrrrrrrrr
rrrrrrrrrrrrrr      vvvvvv      rrrrrrrrrrrrrr
rrrrrrrrrrrrrrrr      vv      rrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrr          rrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrr      rrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrr  rrrrrrrrrrrrrrrrrrrrrr

       INSTRUCTION SETS WANT TO BE FREE
[    0.000000] Linux version 4.1.35-g174f395-dirty (aneeshneelam@Aneesh-Ubuntu-VirtualBox) (gcc version 5.3.0 (GCC) ) #3 SMP Mon Oct 31 14:39:43 PDT 2016
[    0.000000] Available physical memory: 2044MB
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000200000-0x000000007fdfffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000200000-0x000000007fdfffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000200000-0x000000007fdfffff]
[    0.000000] PERCPU: Embedded 12 pages/cpu @ffffffff81ef0000 s16888 r0 d32264 u49152
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 516110
[    0.000000] Kernel command line: root=/dev/htifblk0
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 2058284K/2093056K available (2031K kernel code, 97K rwdata, 416K rodata, 92K init, 224K bss, 34772K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	Additional per-CPU info printed with stalls.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=32 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:2
[    0.000000] clocksource riscv_clocksource: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 191126044627 ns
[    0.150000] Calibrating delay using timer specific routine.. 20.01 BogoMIPS (lpj=100050)
[    0.150000] pid_max: default: 32768 minimum: 301
[    0.150000] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.150000] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes)
[    0.150000] Brought up 1 CPUs
[    0.150000] devtmpfs: initialized
[    0.150000] clocksource jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.150000] NET: Registered protocol family 16
[    0.150000] Switched to clocksource riscv_clocksource
[    0.150000] NET: Registered protocol family 2
[    0.150000] TCP established hash table entries: 16384 (order: 5, 131072 bytes)
[    0.150000] TCP bind hash table entries: 16384 (order: 6, 262144 bytes)
[    0.150000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.150000] UDP hash table entries: 1024 (order: 3, 32768 bytes)
[    0.150000] UDP-Lite hash table entries: 1024 (order: 3, 32768 bytes)
[    0.150000] NET: Registered protocol family 1
[    0.150000] futex hash table entries: 256 (order: 1, 8192 bytes)
[    0.150000] io scheduler noop registered
[    0.150000] io scheduler cfq registered (default)
[    0.160000] htifcon htif1: detected console
[    0.160000] console [htifcon0] enabled
[    0.160000] htifblk htif2: detected disk
[    0.160000] htifblk htif2: added htifblk0
[    0.160000] VFS: Mounted root (ext2 filesystem) readonly on device 254:0.
[    0.160000] devtmpfs: mounted
[    0.160000] Freeing unused kernel memory: 92K (ffffffff80000000 - ffffffff80017000)
[    0.170000] EXT2-fs (htifblk0): warning: mounting unchecked fs, running e2fsck is recommended
# cat /proc/cpuinfo 
hart	: 0
isa	: RV64G

I did enable SMP support and modify the max number of CPU cores in the kernel config before building it.

I can see that RCU restricts the number of CPUs to 1, I'm researching what that means currently. However, am I missing something when I'm building the kernel?

Build fails with lack of auto-generated headers

  • RISCV-Tools master from 12/27
  • RISCV-Linux master from 12/27
  • The only modification to the kernel config was to bump to max CPUs to 32 (from 8)
  • Built kernel headers from latest source above
  • Built riscv-unknown-linux-gnu-* toolchain after headers were installed
  • Built kernel using:
    $> make -j16 ARCH=riscv CROSS_COMPILE=riscv-unknown-linux-gnu-

The build errors out with the following (I also verified that the bug exists with '-j1'):

HOSTCC scripts/genksyms/lex.lex.o
In file included from ./arch/riscv/include/asm/smp.h:19:0,
from ./include/linux/smp.h:64,
from ./include/linux/percpu.h:7,
from ./include/linux/percpu-rwsem.h:7,
from ./include/linux/fs.h:33,
from /hdd/home/jleidel/dev/working/riscv-linux/scripts/gdb/linux/constants.py.in:15:
./arch/riscv/include/asm/asm-offsets.h:1:10: fatal error: generated/asm-offsets.h: No such file or directory
#include <generated/asm-offsets.h>
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
scripts/gdb/linux/Makefile:19: recipe for target 'scripts/gdb/linux/constants.py' failed
make[2]: *** [scripts/gdb/linux/constants.py] Error 1
Kbuild:81: recipe for target 'build_constants_py' failed
make[1]: *** [build_constants_py] Error 2
Makefile:1057: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2
make: *** Waiting for unfinished jobs....

Having trouble running linux on spike

I followed the instructions in the The Linux/RISC-V Installation Manual on the riscv-tools page and made it to the final step, after which I got the following output:

[    0.000000] Linux version 3.14.19-gc0f5580 (samfin@ubuntu) (gcc version 4.9.2 (GCC) ) #1 Mon Feb 16 15:01:07 EST 2015
[    0.000000] Detected 0xaec00000 bytes of physical memory
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x77ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x77ffffff]
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 244080
[    0.000000] Kernel command line: root=/dev/htifblk0
[    0.000000] PID hash table entries: 4096 (order: 2, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 262144 (order: 8, 2097152 bytes)
[    0.000000] Inode-cache hash table entries: 131072 (order: 7, 1048576 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 1946944K/1966080K available (1703K kernel code, 133K rwdata, 360K rodata, 64K init, 241K bss, 19136K reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:8
[    0.150000] Calibrating delay using timer specific routine.. 200.56 BogoMIPS (lpj=1002825)
[    0.150000] pid_max: default: 32768 minimum: 301
[    0.150000] Mount-cache hash table entries: 4096 (order: 2, 32768 bytes)
[    0.150000] Mountpoint-cache hash table entries: 4096 (order: 2, 32768 bytes)
[    0.150000] devtmpfs: initialized
[    0.150000] NET: Registered protocol family 16
[    0.150000] bio: create slab <bio-0> at 0
[    0.150000] Switched to clocksource riscv_clocksource
[    0.160000] NET: Registered protocol family 2
[    0.160000] TCP established hash table entries: 16384 (order: 4, 131072 bytes)
[    0.160000] TCP bind hash table entries: 16384 (order: 4, 131072 bytes)
[    0.160000] TCP: Hash tables configured (established 16384 bind 16384)
[    0.160000] TCP: reno registered
[    0.160000] UDP hash table entries: 1024 (order: 2, 32768 bytes)
[    0.160000] UDP-Lite hash table entries: 1024 (order: 2, 32768 bytes)
[    0.160000] NET: Registered protocol family 1
[    0.160000] futex hash table entries: 256 (order: -1, 6144 bytes)
[    0.160000] io scheduler noop registered
[    0.160000] io scheduler cfq registered (default)
[    0.220000] htifcon htif1: detected console
[    0.220000] console [htifcon0] enabled
[    0.220000] htifblk htif2: detected disk
[    0.220000] htifblk htif2: added htifblk0
[    0.220000] TCP: cubic registered
[    0.230000] VFS: Mounted root (ext2 filesystem) readonly on device 254:0.
[    0.230000] devtmpfs: mounted
[    0.230000] Freeing unused kernel memory: 64K (ffffffff80002000 - ffffffff80012000)
init: can't open '/': Function not implemented
[   78.220000] random: nonblocking pool is initialized

I suspect that the "init: can't open '/': Function not implemented" error has something to do with a bad disk image, but I don't know what would trigger this error.

Missing sys_renameat syscall

When I want to rename a file I get an kernel exception about a null pointer fetch at the jump to the syscall in <check_syscall_nr>.

The problem seems to be that some syscalls are superseded and must be activated in the kernel manually. Here is an example file:
https://github.com/torvalds/linux/blob/master/arch/openrisc/include/uapi/asm/unistd.h

Glibc thinks, that these syscalls are available which then obviously fails.
So, the syscalls must be either activated in the kernel or deactivated in Glibc.
I use the priv-1.10 branch of the 32-Bit riscv-gnu-toolchain to build Glibc and observed by using busybox.

Failed to boot linux kernel

Does spike of the current version support boot linux kernel?

I've built bbl with linux kernel as its payload, and then run spike bbl , but no kernel or user message show up, why?

Branches:

  • riscv-fesrv: master
  • riscv-isa-sim: master
  • riscv-poky: master
  • riscv-linux: riscv-next

error: implicit declaration of function 'atomic64_xor'

In file included from include/linux/spinlock.h:406:0,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
include/linux/atomic.h: In function 'atomic_andnot':
include/linux/atomic.h:464:2: error: implicit declaration of function 'atomic_and' [-Werror=implicit-function-declaration]
atomic_and(~i, v);
^~~~~~~~~~
include/linux/atomic.h: At top level:
include/linux/atomic.h:468:33: error: redefinition of 'atomic_clear_mask'
static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t v)
^~~~~~~~~~~~~~~~~
In file included from include/linux/atomic.h:4:0,
from include/linux/spinlock.h:406,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
./arch/riscv/include/asm/atomic.h:224:20: note: previous definition of 'atomic_clear_mask' was here
static inline void atomic_clear_mask(unsigned int mask, atomic_t *v)
^~~~~~~~~~~~~~~~~
In file included from include/linux/spinlock.h:406:0,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
include/linux/atomic.h:473:33: error: redefinition of 'atomic_set_mask'
static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v)
^~~~~~~~~~~~~~~
In file included from include/linux/atomic.h:4:0,
from include/linux/spinlock.h:406,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
./arch/riscv/include/asm/atomic.h:239:20: note: previous definition of 'atomic_set_mask' was here
static inline void atomic_set_mask(unsigned int mask, atomic_t *v)
^~~~~~~~~~~~~~~
In file included from include/linux/spinlock.h:406:0,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
include/linux/atomic.h: In function 'atomic_set_mask':
include/linux/atomic.h:475:2: error: implicit declaration of function 'atomic_or' [-Werror=implicit-function-declaration]
atomic_or(mask, v);
^~~~~~~~~
include/linux/atomic.h: In function 'atomic64_andnot':
include/linux/atomic.h:589:2: error: implicit declaration of function 'atomic64_and' [-Werror=implicit-function-declaration]
atomic64_and(~i, v);
^~~~~~~~~~~~
In file included from include/linux/atomic.h:593:0,
from include/linux/spinlock.h:406,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/uapi/linux/timex.h:56,
from include/linux/timex.h:56,
from include/linux/sched.h:19,
from arch/riscv/kernel/asm-offsets.c:2:
include/asm-generic/atomic-long.h: In function 'atomic_long_or':
include/asm-generic/atomic-long.h:26:28: error: implicit declaration of function 'atomic64_or' [-Werror=implicit-function-declaration]
#define ATOMIC_LONG_PFX(x) atomic64 ## x
^
include/asm-generic/atomic-long.h:121:2: note: in expansion of macro 'ATOMIC_LONG_PFX'
ATOMIC_LONG_PFX(
##op)(i, v);
^~~~~~~~~~~~~~~
include/asm-generic/atomic-long.h:127:1: note: in expansion of macro 'ATOMIC_LONG_OP'
ATOMIC_LONG_OP(or)
^~~~~~~~~~~~~~
include/asm-generic/atomic-long.h: In function 'atomic_long_xor':
include/asm-generic/atomic-long.h:26:28: error: implicit declaration of function 'atomic64_xor' [-Werror=implicit-function-declaration]
#define ATOMIC_LONG_PFX(x) atomic64 ## x
^
include/asm-generic/atomic-long.h:121:2: note: in expansion of macro 'ATOMIC_LONG_PFX'
ATOMIC_LONG_PFX(##op)(i, v);
^~~~~~~~~~~~~~~
include/asm-generic/atomic-long.h:128:1: note: in expansion of macro 'ATOMIC_LONG_OP'
ATOMIC_LONG_OP(xor)
^~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Kbuild:80: recipe for target 'arch/riscv/kernel/asm-offsets.s' failed
make[1]: *
* [arch/riscv/kernel/asm-offsets.s] Error 1
Makefile:1006: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

ERROR while building vmlinux

Hello,
I meet some errors when making vmlinux.
[jg@localhost riscv-linux]$ make CROSS_COMPILE=riscv64-unknown-linux-gnu- ARCH=riscv64 -j4 scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release WRAP arch/riscv/include/generated/asm/bugs.h WRAP arch/riscv/include/generated/asm/cacheflush.h WRAP arch/riscv/include/generated/asm/checksum.h WRAP arch/riscv/include/generated/asm/clkdev.h WRAP arch/riscv/include/generated/asm/current.h WRAP arch/riscv/include/generated/asm/cputime.h CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h WRAP arch/riscv/include/generated/asm/div64.h WRAP arch/riscv/include/generated/asm/dma.h WRAP arch/riscv/include/generated/asm/emergency-restart.h WRAP arch/riscv/include/generated/asm/errno.h WRAP arch/riscv/include/generated/asm/exec.h WRAP arch/riscv/include/generated/asm/fb.h WRAP arch/riscv/include/generated/asm/fcntl.h WRAP arch/riscv/include/generated/asm/ftrace.h WRAP arch/riscv/include/generated/asm/futex.h WRAP arch/riscv/include/generated/asm/hardirq.h WRAP arch/riscv/include/generated/asm/hash.h WRAP arch/riscv/include/generated/asm/hw_irq.h WRAP arch/riscv/include/generated/asm/ioctl.h WRAP arch/riscv/include/generated/asm/ioctls.h WRAP arch/riscv/include/generated/asm/ipcbuf.h WRAP arch/riscv/include/generated/asm/irq_regs.h WRAP arch/riscv/include/generated/asm/irq_work.h WRAP arch/riscv/include/generated/asm/kdebug.h WRAP arch/riscv/include/generated/asm/kmap_types.h WRAP arch/riscv/include/generated/asm/local.h WRAP arch/riscv/include/generated/asm/kvm_para.h WRAP arch/riscv/include/generated/asm/mm-arch-hooks.h WRAP arch/riscv/include/generated/asm/mman.h WRAP arch/riscv/include/generated/asm/module.h WRAP arch/riscv/include/generated/asm/msgbuf.h WRAP arch/riscv/include/generated/asm/mutex.h WRAP arch/riscv/include/generated/asm/param.h WRAP arch/riscv/include/generated/asm/percpu.h WRAP arch/riscv/include/generated/asm/poll.h WRAP arch/riscv/include/generated/asm/posix_types.h WRAP arch/riscv/include/generated/asm/preempt.h WRAP arch/riscv/include/generated/asm/resource.h WRAP arch/riscv/include/generated/asm/scatterlist.h WRAP arch/riscv/include/generated/asm/sections.h WRAP arch/riscv/include/generated/asm/sembuf.h WRAP arch/riscv/include/generated/asm/shmbuf.h WRAP arch/riscv/include/generated/asm/shmparam.h WRAP arch/riscv/include/generated/asm/signal.h WRAP arch/riscv/include/generated/asm/socket.h WRAP arch/riscv/include/generated/asm/sockios.h WRAP arch/riscv/include/generated/asm/stat.h WRAP arch/riscv/include/generated/asm/statfs.h WRAP arch/riscv/include/generated/asm/swab.h WRAP arch/riscv/include/generated/asm/termbits.h WRAP arch/riscv/include/generated/asm/termios.h WRAP arch/riscv/include/generated/asm/topology.h WRAP arch/riscv/include/generated/asm/trace_clock.h WRAP arch/riscv/include/generated/asm/types.h WRAP arch/riscv/include/generated/asm/user.h WRAP arch/riscv/include/generated/asm/unaligned.h WRAP arch/riscv/include/generated/asm/vga.h WRAP arch/riscv/include/generated/asm/vmlinux.lds.h WRAP arch/riscv/include/generated/asm/xor.h WRAP arch/riscv/include/generated/uapi/asm/setup.h HOSTCC scripts/dtc/dtc.o HOSTCC scripts/dtc/flattree.o CC scripts/mod/empty.o riscv64-unknown-linux-gnu-gcc: error: unrecognized command line option '-mstrict-align'; did you mean '-Wstrict-aliasing'? make[2]: *** [scripts/mod/empty.o] Error 1 make[1]: *** [scripts/mod] Error 2 make[1]: *** Waiting for unfinished jobs.... HOSTCC scripts/dtc/fstree.o HOSTCC scripts/dtc/data.o HOSTCC scripts/dtc/livetree.o HOSTCC scripts/dtc/treesource.o HOSTCC scripts/dtc/srcpos.o HOSTCC scripts/dtc/checks.o scripts/dtc/checks.c: In function ‘check_simple_bus_reg’: scripts/dtc/checks.c:876:2: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t’ [-Wformat=] snprintf(unit_addr, sizeof(unit_addr), "%zx", reg); ^ scripts/dtc/checks.c:876:2: warning: format ‘%zx’ expects argument of type ‘size_t’, but argument 4 has type ‘uint64_t’ [-Wformat=] HOSTCC scripts/dtc/util.o SHIPPED scripts/dtc/dtc-lexer.lex.c SHIPPED scripts/dtc/dtc-parser.tab.h SHIPPED scripts/dtc/dtc-parser.tab.c HOSTCC scripts/dtc/dtc-lexer.lex.o HOSTCC scripts/dtc/dtc-parser.tab.o HOSTLD scripts/dtc/dtc make: *** [scripts] Error 2 make: *** Waiting for unfinished jobs.... UPD include/config/kernel.release
It seems that riscv64-unknown-linux-gnu-gcc does not support the option '-mstrict-align', how to deal with it then?

linker issue undefined reference to __lshrti3

Hi,

I am trying to compile Linux 4.15 branch and targeting Qemu. But the linking step fails with:

  • /Users/wbrodkorb/openadk/toolchain_qemu-riscv64_glibc/usr/bin/riscv64-openadk-linux-gnu-ld -melf64lriscv --build-id -o vmlinux -T ./arch/riscv/kernel/vmlinux.lds --whole-archive built-in.o --no-whole-archive --start-group lib/lib.a arch/riscv/lib/lib.a --end-group
    kernel/sched/fair.o: In function .L21': fair.c:(.text+0xdc): undefined reference to __lshrti3'
    kernel/time/timekeeping.o: In function read_persistent_clock64': timekeeping.c:(.text+0x1b0c): undefined reference to __lshrti3'

Looks like gcc emits some symbols not provided by the internal libgcc copy?

Self compiled toolchain with gcc 7.3.0. Happens with gcc 8.1.0, too. Binutils 2.30 + glib 2.27.

./toolchain_qemu-riscv64_glibc/usr/bin/riscv64-openadk-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=./toolchain_qemu-riscv64_glibc/usr/bin/riscv64-openadk-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/Users/wbrodkorb/openadk/toolchain_qemu-riscv64_glibc/usr/libexec/gcc/riscv64-openadk-linux-gnu/7.3.0/lto-wrapper
Target: riscv64-openadk-linux-gnu
Configured with: /Users/wbrodkorb/openadk/toolchain_build_qemu-riscv64_glibc/w-gcc-7.3.0-1/gcc-7.3.0/configure --prefix=/Users/wbrodkorb/openadk/toolchain_qemu-riscv64_glibc/usr --with-bugurl=https://openadk.org --build=x86_64-apple-darwin17.5.0 --host=x86_64-apple-darwin17.5.0 --target=riscv64-openadk-linux-gnu --with-gmp=/Users/wbrodkorb/openadk/host_x86_64-apple-darwin17.5.0/usr --with-mpfr=/Users/wbrodkorb/openadk/host_x86_64-apple-darwin17.5.0/usr --disable-__cxa_atexit --with-system-zlib --with-gnu-ld --with-gnu-as --disable-libsanitizer --disable-install-libiberty --disable-libitm --disable-libmudflap --disable-libgomp --disable-libcc1 --disable-libmpx --disable-libcilkrts --disable-libquadmath --disable-libquadmath-support --disable-decimal-float --disable-libstdcxx-pch --disable-ppl-version-check --disable-cloog-version-check --without-ppl --without-cloog --without-isl --disable-werror --disable-nls --disable-lto --with-arch=rv64imafdc --with-abi=lp64d --enable-tls --enable-threads --enable-libatomic --enable-shared --enable-cxx-flags=-fPIC --disable-libssp --disable-biarch --disable-multilib --enable-languages=c --with-build-sysroot='/../../target_qemu-riscv64_glibc' --with-sysroot='/../../target_qemu-riscv64_glibc'
Thread model: posix
gcc version 7.3.0 (GCC)

Any ideas?

Support CONFIG_MMU=n

Hi,

If we don't support virtual memory in RISC-V, can we still use riscv-linux? Is there any switch while compiling Linux kernel to support non-virtual memory CPU?

Thank you.

Jim

WARNING: CPU: 0 PID: 0 at drivers/irqchip/irq-riscv-intc.c:158 irq_enable+0x32/0x58

Kernel warning when booting riscv-linux-4.15 branch in latest QEMU with SMP enabled.

static void riscv_irq_enable(struct irq_data *d)
{
        struct riscv_irq_data *data = irq_data_get_irq_chip_data(d);

        /*
         * It's only possible to write SIE on the current hart.  This jumps
         * over to the target hart if it's not the current one.  It's invalid
         * to write SIE on a hart that's not currently running.
         */
        if (data->hart == smp_processor_id())
                riscv_irq_unmask(d);
        else if (cpu_online(data->hart))
                riscv_remote_ctrl(data->hart, riscv_irq_enable_helper, d);
        else
                WARN_ON_ONCE(1); // <- this warning is triggering 
}

It warns only once, so we don't know how often it is triggering. The kernel appears stable.

$ sudo ./riscv64-softmmu/qemu-system-riscv64 -smp cpus=4 -nographic -machine virt -kernel qemu-images/bbl-4.15 -append "root=/dev/vda ro" -drive file=qemu-images/busybear.bin,format=raw,id=hd0 -device virtio-blk-device,drive=hd0 -netdev type=tap,script=./qemu-images/ifup.macos,downscript=./qemu-images/ifdown.macos,id=net0 -device virtio-net-device,netdev=net0
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 4.15.0-00050-g55f79e25d599 (mclark@minty) (gcc version 7.1.1 20170509 (GCC)) #96 SMP Mon Feb 26 09:20:44 NZDT 2018
[    0.000000] bootconsole [early0] enabled
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x0000000087ffffff]
[    0.000000]   Normal   [mem 0x0000000088000000-0x0000087fffffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x0000000087ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x0000000087ffffff]
[    0.000000] software IO TLB [mem 0x83e3b000-0x87e3b000] (64MB) mapped at [        (ptrval)-        (ptrval)]
[    0.000000] elf_hwcap is 0x112d
[    0.000000] percpu: Embedded 14 pages/cpu @        (ptrval) s24600 r0 d32744 u57344
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 31815
[    0.000000] Kernel command line: root=/dev/vda ro
[    0.000000] Dentry cache hash table entries: 16384 (order: 5, 131072 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 57404K/129024K available (2245K kernel code, 163K rwdata, 563K rodata, 124K init, 266K bss, 71620K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] riscv,cpu_intc,0: 64 local interrupts mapped
[    0.000000] riscv,cpu_intc,1: 64 local interrupts mapped
[    0.000000] riscv,cpu_intc,2: 64 local interrupts mapped
[    0.000000] riscv,cpu_intc,3: 64 local interrupts mapped
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at drivers/irqchip/irq-riscv-intc.c:158 irq_enable+0x32/0x58
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.15.0-00050-g55f79e25d599 #96
[    0.000000] Call Trace:
[    0.000000] [<        (ptrval)>] walk_stackframe+0x0/0x7e
[    0.000000] [<        (ptrval)>] dump_stack+0x5a/0x76
[    0.000000] [<        (ptrval)>] __warn+0xc0/0xda
[    0.000000] [<        (ptrval)>] irq_enable+0x2e/0x58
[    0.000000] [<        (ptrval)>] __irq_startup+0x82/0x8a
[    0.000000] [<        (ptrval)>] irq_startup+0x4c/0xf4
[    0.000000] [<        (ptrval)>] plic_irq_disable+0x6e/0x72
[    0.000000] [<        (ptrval)>] irq_set_chained_handler_and_data+0x24/0x42
[    0.000000] [<        (ptrval)>] plic_init+0x1e6/0x312
[    0.000000] [<        (ptrval)>] printk+0x1e/0x28
[    0.000000] [<        (ptrval)>] riscv_intc_init+0xc6/0xf4
[    0.000000] [<        (ptrval)>] of_irq_init+0x112/0x206
[    0.000000] [<        (ptrval)>] start_kernel+0x22c/0x354
[    0.000000] random: get_random_bytes called from print_oops_end_marker+0x36/0x4e with crng_init=0
[    0.000000] ---[ end trace 811f0666af6c5eb2 ]---
[    0.000000] riscv,plic0,c000000: mapped 10 interrupts to 4/8 handlers
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 20.00 BogoMIPS (lpj=100000)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.000000] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes)
[    0.040000] Hierarchical SRCU implementation.
[    0.050000] smp: Bringing up secondary CPUs ...
[    0.050000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.070000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.070000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[    0.080000] smp: Brought up 1 node, 4 CPUs
[    0.130000] devtmpfs: initialized
[    0.140000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.140000] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    0.150000] NET: Registered protocol family 16
[    0.170000] vgaarb: loaded
[    0.190000] clocksource: Switched to clocksource riscv_clocksource
[    0.200000] NET: Registered protocol family 2
[    0.200000] TCP established hash table entries: 1024 (order: 1, 8192 bytes)
[    0.200000] TCP bind hash table entries: 1024 (order: 2, 16384 bytes)
[    0.200000] TCP: Hash tables configured (established 1024 bind 1024)
[    0.210000] UDP hash table entries: 256 (order: 1, 8192 bytes)
[    0.220000] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
[    0.230000] NET: Registered protocol family 1
[    0.250000] workingset: timestamp_bits=62 max_order=14 bucket_order=0
[    0.300000] random: fast init done
[    0.370000] io scheduler noop registered
[    0.370000] io scheduler cfq registered (default)
[    0.380000] io scheduler mq-deadline registered
[    0.380000] io scheduler kyber registered
[    0.950000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.980000] console [ttyS0] disabled
[    0.980000] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 13, base_baud = 230400) is a 16550A
[    0.980000] console [ttyS0] enabled
[    0.980000] console [ttyS0] enabled
[    0.990000] bootconsole [early0] disabled
[    0.990000] bootconsole [early0] disabled
[    1.190000] EXT4-fs (vda): couldn't mount as ext3 due to feature incompatibilities
[    1.200000] EXT4-fs (vda): couldn't mount as ext2 due to feature incompatibilities
[    1.220000] EXT4-fs (vda): INFO: recovery required on readonly filesystem
[    1.220000] EXT4-fs (vda): write access will be enabled during recovery
[    1.370000] EXT4-fs (vda): recovery complete
[    1.380000] EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
[    1.390000] VFS: Mounted root (ext4 filesystem) readonly on device 254:0.
[    1.400000] devtmpfs: mounted
[    1.410000] Freeing unused kernel memory: 124K
[    1.410000] This architecture does not have kernel memory protection.
[    2.640000] EXT4-fs (vda): re-mounted. Opts: data=ordered
Initializing mdev...

ucbvax login: root
Password: ntpd: setting time to 2018-02-25 20:23:36.617367 (offset +1519590206.408055s)

    ____                   ____                     __    _                 
   / __ )__  _________  __/ __ )___  ____ ______   / /   (_)___  __  ___  __
  / __  / / / / ___/ / / / __  / _ \/ __ `/ ___/  / /   / / __ \/ / / / |/_/
 / /_/ / /_/ (__  ) /_/ / /_/ /  __/ /_/ / /     / /___/ / / / / /_/ />  <  
/_____/\__,_/____/\__, /_____/\___/\__,_/_/     /_____/_/_/ /_/\__,_/_/|_|  
                 /____/                                                     
root@ucbvax:~# 
root@ucbvax:~# 
root@ucbvax:~# cat /proc/cpuinfo 
hart	: 0
isa	: rv64imafdc
mmu	: sv48

hart	: 1
isa	: rv64imafdc
mmu	: sv48

hart	: 2
isa	: rv64imafdc
mmu	: sv48

hart	: 3
isa	: rv64imafdc
mmu	: sv48

root@ucbvax:~# 

Missing SFENCE.VM instructions

This port is currently missing some SFENCE.VM instructions according to version 1.7 of the supervisor spec. SFENCE.VM is needed to synchronize writes to page table entries through store instructions with later virtual address translations and hardware page table walks.

Right now SFENCE.VM is used in the local_flush_tlb_all macro and various other flush_tlb macros, but these macros aren't used when a previously invalid page table entry is updated to valid (for example see line 2602 in mm/memory.c in the full linux kernel).

The omitted SFENCE.VM instructions don't cause a bug in rocket or spike because their hardware page table walks are done in coherent memory (the required synchronization provided by SFENCE.VM in this case is a no-op). On the other hand, this omission does cause bugs in a single core processor with a write-back data cache and the hardware page table walk is performed through main memory. In this case, the required synchronization is writing back dirty lines from the data cache to main memory so the next hardware page table walk can see the newly written page table entries.

We have a RISC-V implementation with a write back cache and a hardware page table walk through main memory, and we implement SFENCE.VM as a TLB flush combined with writing back dirty lines in the data cache. When I run the current version of Linux with the default configuration, the boot process stalls right after looking at the htif block device (our root filesystem). Our processor diverges from spike with an unexpected page fault, and it seems like it hits an infinite loop of page faults.

To fix this, I added SFENCE.VM to the three function definitions below:

diff --git a/arch/riscv/include/asm/cacheflush.h b/arch/riscv/include/asm/cacheflush.h
index 56978bc..4cf9efe 100644
--- a/arch/riscv/include/asm/cacheflush.h
+++ b/arch/riscv/include/asm/cacheflush.h
@@ -11,6 +11,18 @@ static inline void local_flush_icache_all(void)
        asm volatile ("fence.i" ::: "memory");
 }

+#undef flush_cache_vmap
+static inline void flush_cache_vmap(unsigned long start, unsigned long end)
+{
+       asm volatile ("sfence.vm" ::: "memory");
+}
+
+#undef flush_cache_vunmap
+static inline void flush_cache_vunmap(unsigned long start, unsigned long end)
+{
+       asm volatile ("sfence.vm" ::: "memory");
+}
+
 #ifndef CONFIG_SMP

 #define flush_icache_range(start, end) local_flush_icache_all()
diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 74c1a29..a5a4a3e 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -265,6 +265,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 static inline void update_mmu_cache(struct vm_area_struct *vma,
        unsigned long address, pte_t *ptep)
 {
+       asm volatile ("sfence.vm" ::: "memory");
 }

 /*

I don't know how good of a solution this is. This may be adding more SFENCE.VM instructions than necessary, but my main concern for this initial fix was that it was a sufficient number of them.

For more information, there was a long discussion on the RISC-V ISA Dev mailing list about SFENCE.VM semantics:
https://groups.google.com/a/groups.riscv.org/forum/#!topic/isa-dev/jbfnJSVLcWI

I can't do "make ARCH=riscv".

I can't do "make ARCH=riscv".
Please solve this problem anyone.

$ make ARCH=riscv

CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
CC kernel/bounds.s
gcc: error: unrecognized argument in option '-mabi=lp64'
gcc: note: valid arguments to '-mabi=' are: ms sysv
gcc: error: unrecognized argument in option '-mcmodel=medany'
gcc: note: valid arguments to '-mcmodel=' are: 32 kernel large medium small
gcc: error: unrecognized command line option '-mno-save-restore'
Kbuild:21: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1112: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

SMP kernel hangs at init under spike

I built an SMP kernel (default w/ 8 cpu support) from the riscv-linux master as per the instructions on the riscv website (886e5f9). I built the kernel using the riscv-tools master with the default configs. I've tested with two different image files. One built from scratch using busybox w/ a barebones config. The other was built from my previous yocto build. Both fail hang at the same point. I've verified that both boot fine with the default 1 cpu.

When ctrl-c'ing spike, it appears that cpu 0 and 1 are in infinite loops busy waiting for something. The busywait appears to be somewhere near PC 0xffffffff8005bfa0.

Documentation/riscv

I want to get some messages from doc like those in Documentation/x86, for example, virtual memory layout, but I can't find any doc for riscv under Linux kernel sources.
Is there any docs I can find the things I want?

Stopping lo interface Oops

Hi!

Kernel 4.18
I had to implement sifive drivers from kernel 4.15 to this kernel because otherwise it do not switch bootconsole.

Now I have a strange issue when loading a kernel 4.18 natively on risc v.
One can find log down below.
Could somebody help me with it please?

INIT: Switching to runlevel: 2
INIT: Sending processes the TERM signal
[ 33.046158] Stopping udevd service: [DONE]
[ 33.350120] Stopping lo interface: [ 33.350000] Oops [#1]
[ 33.350000] CPU: 3 PID: 73 Comm: kworker/3:1 Tainted: G W 4.18.0-rc6 #20
[ 33.360000] Workqueue: rcu_gp wait_rcu_exp_gp
[ 33.360000] sepc: ffffffe000866da0 ra : ffffffe0004b8878 sp : ffffffe1f67abca0
[ 33.370000] gp : ffffffe0009f70b8 tp : ffffffe1f6654400 t0 : 0000000000000000
[ 33.380000] t1 : 0000000000006000 t2 : 0000000000000000 s0 : ffffffe1f67abcb0
[ 33.390000] s1 : ffffffe0004a5900 a0 : f597862680826161 a1 : 000000007fffffff
[ 33.390000] a2 : ffffffe0009b0f08 a3 : 0000000000000001 a4 : 0000000000000001
[ 33.400000] a5 : 000000007fffffff a6 : 8080808080808080 a7 : ffffffe1f7bd0368
[ 33.410000] s2 : ffffffe0009b0f08 s3 : ffffffe00049e0b0 s4 : 0000000000000000
[ 33.410000] s5 : 0000000000000000 s6 : ffffffe000aa3698 s7 : ffffffe0009f75f0
[ 33.420000] s8 : ffffffe00049e0b0 s9 : 0000000000000088 s10: f597862680826161
[ 33.430000] s11: ffffffe1f7a07000 t3 : ffffffe0009a17c0 t4 : ffffffe0009a17c8
[ 33.440000] t5 : 0000000000000007 t6 : 0000000000000006
[ 33.440000] sstatus: 0000000200000100 sbadaddr: 0000002680826161 scause: 000000000000000d
[ 33.450000] ---[ end trace 5cda2dd0e1ac83e3 ]---

icache not flushed correctly

It appears that the flush_icache VDSO is not working correctly on Freedom U540.
The following test program:

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
 
static void *allocate_code(void)
{
  void *addr = aligned_alloc(4096, 4096);
  mprotect(addr, 4096, PROT_EXEC | PROT_READ | PROT_WRITE);
  memset(addr, 0, 4096);
  return addr;
}
 
static void generate_code(void *p, int n)
{
  uint16_t *code = p;
 
  /* Assumes 0 <= n <= 31 */
  code[0] = 0x4501 | (n<<2); /* c.li a0, n */
  code[1] = 0x8082; /* c.jr ra */
 
  __builtin___clear_cache(code, code+16);
}
 
static int call_code(void *p)
{
  return (*(int (*)(void))p)();
}
 
int main()
{
  void *addr = allocate_code();
 
  int a, b;
 
  generate_code(addr, 3);
  a = call_code(addr);
 
  generate_code(addr, 7);
  b = call_code(addr);
 
  printf("Results: %d %d\n", a, b);
 
  return 0;
}

prints "3 3" when run on the HiFive Unleashed, but should print "3 7".

I'm building the kernel from the riscv-linux-4.15 branch.

Does linux 4.6.2 support SMP well?

Hi,
Recently,I generated a 4 Rocket core RISCV project,and changed the menuconfig to support multicore.
But when the system boot up, it only recognized one core.
I'm wondering if there is any example to boot up linux for multiple cores? Or, is there anyone who has realized multicore Linux boot could give me any advise?

Thanks!

YaoLiu

[question ]fatal error in the step of Configuring the Linux Kernel:

the fatal error problem shows as below
/////////////////////////////////////////////////////
scripts/kconfig/conf --silentoldconfig Kconfig
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CC scripts/mod/devicetable-offsets.s
In file included from include/linux/compiler.h:54:0,
from include/uapi/linux/stddef.h:1,
from include/linux/stddef.h:4,
from /home/genji/riscvCPU/linux-3.14.33/include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/mod_devicetable.h:11,
from scripts/mod/devicetable-offsets.c:2:
include/linux/compiler-gcc.h:106:30: fatal error: linux/compiler-gcc6.h: No such file or directory
#include gcc_header(GNUC)
^
compilation terminated.
scripts/Makefile.build:204: recipe for target 'scripts/mod/devicetable-offsets.s' failed
make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
scripts/Makefile.build:455: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
Makefile:527: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....
///////////////////////////////////////////////

https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.14.33.tar.xz | tar include/linux does not provide compiler-gcc6.h I don't know how to do the following jobs. Help me please,thank you very much!

riscv configuration cannot work on 32bit OS

Are there any running configuration file can be shared???Or how should I modify the configuration to make it work?
The riscv configuration file just cannot work on 32bit OS. There are so many errors, such as

In file included from arch/riscv/include/generated/asm/div64.h:1:0,
                 from include/linux/kernel.h:136,
                 from include/linux/list.h:8,
                 from include/linux/preempt.h:10,
                 from include/linux/spinlock.h:50,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/uapi/linux/timex.h:56,
                 from include/linux/timex.h:56,
                 from include/linux/clocksource.h:12,
                 from arch/riscv/kernel/time.c:1:
include/asm-generic/div64.h:224:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types]
   __rem = __div64_32(&(n), __base); \
                      ^
arch/riscv/kernel/time.c:81:2: note: in expansion of macro 'do_div'
  do_div(lpj_fine, HZ);
  ^~~~~~

the OS is

Linux ubuntu 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:59 UTC 2016 i686 i686 i686 GNU/Linux

And I try these but only errors are found.

make ARCH=riscv defconfig
make ARCH=riscv menuconfig
make -j4 ARCH=riscv vmlinux

"uname -m" reports "riscv", not "riscv64"

This causes config.{guess,sub} to fail because the upstreamed tuple is "riscv64-unknown-linux-gnu", not "riscv-unknown-linux-gnu". There's a super easy fix: apply the following patch and "make ARCH=riscv64", but since the patch touches "linux/Makefile" it can't be merged here because of how riscv-linux.git is setup.

diff --git a/Makefile b/Makefile
index 95a0e82..6e2ff96 100644
--- a/Makefile
+++ b/Makefile
@@ -263,6 +263,14 @@ ifeq ($(ARCH),x86_64)
         SRCARCH := x86
 endif

+# Additional ARCH settings for RISC-V
+ifeq ($(ARCH),riscv32)
+       SRCARCH := riscv
+endif
+ifeq ($(ARCH),riscv64)
+       SRCARCH := riscv
+endif
+
 # Additional ARCH settings for sparc
 ifeq ($(ARCH),sparc32)
        SRCARCH := sparc

This isn't so important because you can always just "./configure --build=riscv64-unknown-linux-gnu", but it is a bit of a headache...

OS support for virtual memory

What kind of support is provided by RISCV Linux OS for virtual memory?

For example,
Is page walk managed by OS?
What about TLB filling? etc.

what branch or tag is suitable for riscv-qemu

Hi, I link to here due to riscv-qemu
in the riscv-qemu's README, they used priv-1.9 branch of riscv-linux as an example for building linux image for riscv-qemu
However, there is no priv-1.9 branch of riscv-linux.
I have tried branch riscv-linux-4-14 of riscv-linux, but I got hanging after doing this command
$ ~riscv-qemu/riscv64-softmmu/qemu-system-riscv64 -kernel ~/riscv-tools/riscv-pk/build/bbl -m 1024M -nographic

is there any tutorial for building a riscv-linux for riscv-qemu? or any suggestion?
thanks!!

get_cycles() function name a misnomer.

Hey guys,

I'm not sure if this breaks a convention on Linux's side, but in trying to read the timing code, I became confused because get_cycles() is actually reading the time CSR and not the cycles CSR:

https://github.com/riscv/riscv-linux/blob/riscv-next/arch/riscv/kernel/time.c#L51
https://github.com/riscv/riscv-linux/blob/riscv-next/arch/riscv/include/asm/timex.h#L24

Likewise cycles_t:
https://github.com/riscv/riscv-linux/blob/riscv-next/arch/riscv/include/asm/timex.h#L22

Infinite loop in relocate

We are running the kernel on FPGA with Rocket Chip core.
When relocate returns with ra as a virtual address, it raises a trap that eventually ends in this loop:

	/* Set trap vector to spin forever to help debug */
	la a0, .Lsecondary_park
	csrw stvec, a0

Is this the intended behaviour? Does it mean that address translation is not performed correctly?

Error command not found

First of All, I can't speak English well.. please understand me^^
I was execute : sudo make -j16 ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu-
result :

./scripts/gcc-version.sh: line 25: riscv64-unknown-linux-gnu-gcc: command not found
./scripts/gcc-version.sh: line 26: riscv64-unknown-linux-gnu-gcc: command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
scripts/kconfig/conf --silentoldconfig Kconfig
./scripts/gcc-version.sh: line 25: riscv64-unknown-linux-gnu-gcc: command not found
./scripts/gcc-version.sh: line 26: riscv64-unknown-linux-gnu-gcc: command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
CHK include/config/kernel.release
make: riscv64-unknown-linux-gnu-gcc: Command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
CHK include/generated/uapi/linux/version.h
make: riscv64-unknown-linux-gnu-gcc: Command not found
make: riscv64-unknown-linux-gnu-gcc: Command not found
CC scripts/mod/empty.o
/bin/sh: 1: riscv64-unknown-linux-gnu-gcc: not found
scripts/Makefile.build:302: recipe for target 'scripts/mod/empty.o' failed
make[2]: *** [scripts/mod/empty.o] Error 127
scripts/Makefile.build:561: recipe for target 'scripts/mod' failed
make[1]: *** [scripts/mod] Error 2
Makefile:570: recipe for target 'scripts' failed
make: *** [scripts] Error 2
make: *** Waiting for unfinished jobs....

it seems that path of riscv64-unknown-linux-gnu-gcc does fault.
because I fixed my .bashrc file that can't read $PATH

Stack alignment broken in Linux

There is still a way to get an unaligned stack pointer in the Linux kernel under RV32. The patch shows the problem. However, you might want to correct this with compatibility under 64-Bit 😃

--- a/arch/riscv/kernel/entry.S
+++ b/arch/riscv/kernel/entry.S
@@ -37,7 +37,7 @@
 _restore_kernel_sp:
        csrr sp, sscratch
 _save_context:
-       addi sp, sp, -(PT_SIZE)
+       addi sp, sp, -144
        REG_S x1,  PT_RA(sp)
        REG_S x3,  PT_GP(sp)
        REG_S x4,  PT_TP(sp)
@@ -211,7 +211,7 @@ resume_userspace:
        bnez s1, work_pending

        /* Save unwound kernel stack pointer in sscratch */
-       addi s0, sp, PT_SIZE
+       addi s0, sp, 144
        csrw sscratch, s0
 restore_all:
        RESTORE_ALL

Cherry-pick some commits from sifive/riscv-linux:sifive

Although using the config string for linux boot seems to not be popular, there are nevertheless some commits in the sifive linux kernel branch that should probably be moved to the main linux repo.

Specifically:

  • The commit which makes VTs work via dummy terminal (needed for X/fb/etc)
  • The fix that prevents kernel panic by pressing a key during early_printk
  • The patch that adds DMA by marking risc-v as coherent (needed by PCIe)
  • The patch that adds PCI capability via ECAM, since riscv has no x86 IO space.

The device drivers for PLIC, GPIO, and Xilinx-PCIe probably can't be merged until we have a solution to provide DTS from the boot loader. But there is no reason not to merge as much as possible into one repository (this one).

Compilation problem in priv-1.9: conflicting types for 'atomic_or'

  CC      arch/riscv/kernel/asm-offsets.s
In file included from include/linux/spinlock.h:416:0,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/uapi/linux/timex.h:56,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:19,
                 from arch/riscv/kernel/asm-offsets.c:2:
include/linux/atomic.h:115:20: error: conflicting types for 'atomic_or'
 static inline void atomic_or(int i, atomic_t *v)
                    ^~~~~~~~~
In file included from include/linux/atomic.h:4:0,
                 from include/linux/spinlock.h:416,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/uapi/linux/timex.h:56,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:19,
                 from arch/riscv/kernel/asm-offsets.c:2:
./arch/riscv/include/asm/atomic.h:239:20: note: previous definition of 'atomic_or' was here
 static inline void atomic_or(unsigned int mask, atomic_t *v)
                    ^~~~~~~~~
Kbuild:61: recipe for target 'arch/riscv/kernel/asm-offsets.s' failed
make[1]: *** [arch/riscv/kernel/asm-offsets.s] Error 1
Makefile:991: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

patch for PTRACE_SETREGSET bug

This was found while trying to get a native gdb port working. There is a trivial typo in riscv_gpr_set. Compare with the code in riscv_gpr_get.

diff --git a/arch/riscv/kernel/ptrace.c b/arch/riscv/kernel/ptrace.c
index ba3e80712797..9f82a7e34c64 100644
--- a/arch/riscv/kernel/ptrace.c
+++ b/arch/riscv/kernel/ptrace.c
@@ -50,7 +50,7 @@ static int riscv_gpr_set(struct task_struct *target,
        struct pt_regs *regs;
 
        regs = task_pt_regs(target);
-       ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &regs, 0, -1);
+       ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, regs, 0, -1);
        return ret;
 }
 

Default Behavior of SR_XS Differs from Proxy Kernel

Running a program with Xcustom instructions works by default in the proxy-kernel, but not in riscv-linux. This has been brought up before (http://stackoverflow.com/questions/32980262/how-come-linux-kernel-interferes-the-execution-of-risc-v-custom0-instruction-on), but without a resolution.

This happens because the SR_XS csr is never initialized by riscv-linux. This causes any instances of Xcustom instructions (e.g., custom0) to result in an illegal instruction exception (see this line in rocket: https://github.com/ucb-bar/rocket/blob/bcf035f4e4ac6685ef811013a20b3dab5a9c9046/src/main/scala/rocket.scala#L197). This contrasts with the initialization of the proxy-kernel in mstatus_init (https://github.com/riscv/riscv-pk/blob/529a6a3a0c42468bf815255697279e0e059a22db/pk/minit.c#L9) which sets SR_XS.

While I fully understand that the usage case is much different for Linux vs. the proxy-kernel, what should the intended behavior be for attached RoCC devices? Should SR_XS be enabled globally (for both user and supervisor), should SR_XS be enabled at the user level only (like it currently is for the floating point unit), or should this be a config parameter? Note, I glanced at the configs, but didn't see a specific setting for this.

At the user level RoCC devices can be enabled with a quick modification to the start_thread function (https://github.com/riscv/riscv-linux/blob/master/arch/riscv/kernel/process.c#L53), but I'm wondering what would be the right global approach that would prevent confusion between behavior on the proxy-kernel and riscv-linux.

Unable to boot vmlinux with spike

Hi I have built the 32-bit riscv toolchain and riscv-linux using the following commands
cd riscv-tools
./build-rv32ima.sh

cd riscv-gnu-toolchain/build
../configure --prefix=$RISCV --with-arch=rv32gc --with-abi=ilp32d
make linux

cd ~/riscv-linux
make ARCH=riscv defconfig
make -j16 ARCH=riscv CROSS_COMPILE=riscv32-unknown-linux-gnu-

However, when I do "spike bbl vmlinux", spike hangs.
spike -l bbl vmlinux shows me this exception:
"core 0: exception trap_instruction_access_fault, epc 0x0000000000000000"

Also, compiling and running a hello world program with the riscv32-unknown-linux-gnu-gcc also make spike hangs but does not produce such exception.

What could be the cause of this?

kernel/sbi.S

What is the propose of this file? where are values coming from?
I can't see it in riscv-next branch, instead I see OF use of some device tree, but I can't see the DTS file

make headers_install fail

$ git branch 
* riscv-for-submission-v7
$ make defconfig ARCH=riscv
...
*** Default configuration is based on 'spike64_defconfig'
#
# configuration written to .config
#
$ make headers_install ARCH=riscv
...
scripts/Makefile.headersinst:62: *** Some mandatory headers (errno.h fcntl.h ioctl.h ioctls.h ipcbuf.h mman.h msgbuf.h param.h poll.h posix_types.h resource.h sembuf.h shmbuf.h signal.h socket.h sockios.h stat.h statfs.h swab.h termbits.h termios.h types.h) are missing in arch/riscv/include/uapi/asm.  Stop.
scripts/Makefile.headersinst:31: recipe for target 'asm' failed
make[1]: *** [asm] Error 2
Makefile:1167: recipe for target 'headers_install' failed
make: *** [headers_install] Error 2

Linux Ash Shell issue

I am trying to compile and run a linux image on FPGA.
Our system has rv64imafd architecture and does not support compressed instructions.
I have created the compilers and other necessary tools and they work fine.

I can compile and create a Linux image as explained on the riscv-tools page. I also compile busybox with the explained configuration. However, after printing out the linux opening logs, ash shell does not appear. I have also tried different configurations but none of them worked.

I use linux kernel version 4.16.10 and busybox version 1.28.3. I also tried the version from the tutorial but they also do not work.

The linux screen is below, including the dtb printed by bbl:

              vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
                  vvvvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr       vvvvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr      vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrrrr    vvvvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrrrrr      vvvvvvvvvvvvvvvvvvvvvv
rrrrrrrrrrrrr       vvvvvvvvvvvvvvvvvvvvvv
rr                vvvvvvvvvvvvvvvvvvvvvv
rr            vvvvvvvvvvvvvvvvvvvvvvvv      rr
rrrr      vvvvvvvvvvvvvvvvvvvvvvvvvv      rrrr
rrrrrr      vvvvvvvvvvvvvvvvvvvvvv      rrrrrr
rrrrrrrr      vvvvvvvvvvvvvvvvvv      rrrrrrrr
rrrrrrrrrr      vvvvvvvvvvvvvv      rrrrrrrrrr
rrrrrrrrrrrr      vvvvvvvvvv      rrrrrrrrrrrr
rrrrrrrrrrrrrr      vvvvvv      rrrrrrrrrrrrrr
rrrrrrrrrrrrrrrr      vv      rrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrr          rrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrr      rrrrrrrrrrrrrrrrrrrr
rrrrrrrrrrrrrrrrrrrrrr  rrrrrrrrrrrrrrrrrrrrrr

       INSTRUCTION SETS WANT TO BE FREE
 {
  #address-cells = <0x00000001>;
  #size-cells = <0x00000001>;
  compatible = "freechips,rocketchip-unknown-dev";
  model = "freechips,rocketchip-unknown";
  cpus {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000000>;
    timebase-frequency = <0x00002710>;
    cpu@0 {
      clock-frequency = <0x00000000>;
      compatible = "sifive,rocket0", "riscv";
      d-cache-block-size = <0x00000040>;
      d-cache-sets = <0x00000040>;
      d-cache-size = <0x00010000>;
      d-tlb-sets = <0x00000001>;
      d-tlb-size = <0x00000008>;
      device_type = "cpu";
      i-cache-block-size = <0x00000040>;
      i-cache-sets = <0x00000040>;
      i-cache-size = <0x00008000>;
      i-tlb-sets = <0x00000001>;
      i-tlb-size = <0x00000020>;
      mmu-type = "riscv,sv39";
      next-level-cache = <0x00000001 0x00000002>;
      reg = <0x00000000>;
      riscv,isa = "rv64imafd";
      status = "okay";
      tlb-split;
      interrupt-controller {
        #interrupt-cells = <0x00000001>;
        compatible = "riscv,cpu-intc";
        interrupt-controller;
        linux,phandle = <0x00000003>;
        phandle = <0x00000003>;
      }
    }
  }
  memory@80000000 {
    device_type = "memory";
    reg = <0x80000000 0x40000000>;
    linux,phandle = <0x00000002>;
    phandle = <0x00000002>;
  }
  soc {
    #address-cells = <0x00000001>;
    #size-cells = <0x00000001>;
    compatible = "freechips,rocketchip-unknown-soc", "simple-bus";
    ranges;
    error-device@3000 {
      compatible = "sifive,error0";
      reg = <0x00003000 0x00001000>;
      reg-names = "mem";
      linux,phandle = <0x00000001>;
      phandle = <0x00000001>;
    }
    interrupt-controller@c000000 {
      #interrupt-cells = <0x00000001>;
      compatible = "riscv,plic0";
      interrupt-controller;
      interrupts-extended = <0x00000003 0xffffffff 0x00000003 0x00000009>;
      reg = <0x0c000000 0x04000000>;
      reg-names = "control";
      riscv,max-priority = <0x00000007>;
      riscv,ndev = <0x00000002>;
      linux,phandle = <0x00000004>;
      phandle = <0x00000004>;
    }
    rom@10000 {
      compatible = "sifive,maskrom0";
      reg = <0x00010000 0x00002000>;
      reg-names = "mem";
    }
    serial@54000000 {
      compatible = "sifive,uart0";
      interrupt-parent = <0x00000004>;
      interrupts = <0x00000001>;
      reg = <0x54000000 0x00001000>;
      reg-names = "control";
    }
    spi@54001000 {
      compatible = "sifive,spi0";
      interrupt-parent = <0x00000004>;
      interrupts = <0x00000002>;
      reg = <0x54001000 0x00001000>;
      reg-names = "control";
    }
  }
}
[    0.000000] Linux version 4.17.0-rc5-16237-g67b8d5c-dirty (ddy@ddy-HP-Z400-Workstation) (gcc version 7.2.0 (GCC)) #121 Thu Jun 21 09:34:59 +03 2018
[    0.000000] Initial ramdisk at: 0x        (ptrval) (432672 bytes)
[    0.000000] Zone ranges:
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000080000000-0x00000000bfffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x00000000bfffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000bfffffff]
[    0.000000] elf_hwcap is 0x1129
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 258560
[    0.000000] Kernel command line:
[    0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes)
[    0.000000] Sorting __ex_table...
[    0.000000] Memory: 1026864K/1048576K available (3741K kernel code, 222K rwdata, 1007K rodata, 572K init, 238K bss, 21712K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] console [hvc0] enabled
[    0.000000] Calibrating delay loop (skipped), value calculated using timer frequency.. 0.02 BogoMIPS (lpj=40)
[    0.000000] pid_max: default: 32768 minimum: 301
[    0.000000] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes)
[    0.000000] devtmpfs: initialized
[    0.000000] cpu cpu0: Error -2 creating of_node link
[    0.000000] random: get_random_u32 called from bucket_table_alloc.isra.5+0x204/0x270 with crng_init=0
[    0.000000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.000000] futex hash table entries: 256 (order: 0, 6144 bytes)
[    0.000000] NET: Registered protocol family 16
[    0.000000] SCSI subsystem initialized
[    0.000000] usbcore: registered new interface driver usbfs
[    0.000000] usbcore: registered new interface driver hub
[    0.000000] usbcore: registered new device driver usb
[    0.000000] Unpacking initramfs...
[    0.000000] workingset: timestamp_bits=62 max_order=18 bucket_order=0
[    0.000000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    0.000000] io scheduler noop registered
[    0.000000] io scheduler deadline registered
[    0.000000] io scheduler cfq registered (default)
[    0.000000] io scheduler mq-deadline registered
[    0.000000] io scheduler kyber registered
[    0.000000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.000000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.000000] ehci-pci: EHCI PCI platform driver
[    0.000000] ehci-platform: EHCI generic platform driver
[    0.000000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.000000] ohci-pci: OHCI PCI platform driver
[    0.000000] ohci-platform: OHCI generic platform driver
[    0.000000] usbcore: registered new interface driver uas
[    0.000000] usbcore: registered new interface driver usb-storage
[    0.000000] usbcore: registered new interface driver usbhid
[    0.000000] usbhid: USB HID core driver
[    0.000000] Freeing unused kernel memory: 572K
[    0.000000] This architecture does not have kernel memory protection.

I have also attached the configuration files for the linux and busybox.

Error while building kernel on CentOS 7.3

While running 'make ARCH=riscv' on CentOS 7.3 I get the following:

  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CC      kernel/bounds.s
riscv64-unknown-linux-gnu-gcc: error: unrecognized command line option '-m64'
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.