Closed Liboya-CB closed 4 years ago
I update riscv-isa-sim
and riscv-gnu-toolchain
to the latest version. And the pointer adress of device tree after entering kernel is same as it is in bootloader.
However, the kernel still does not print any words in console and is halted after scheduling several times.
I checkout the branch riscv-linux-4.20
from riscv-linux.
And I have already set these configuration:
CONFIG_HVC_RISCV_SBI=y
CONFIG_SERIAL_EARLYCON=y
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_DEPRECATED_OPTIONS is not set
CONFIG_SERIAL_8250_FINTEK=y
CONFIG_SERIAL_8250_CONSOLE=y
CONFIG_SERIAL_8250_DMA=y
The Linux finally print these lines and hang.
bbl loader
{
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "ucbbar,spike-bare-dev";
model = "ucbbar,spike-bare";
cpus {
#address-cells = <0x00000001>;
#size-cells = <0x00000000>;
timebase-frequency = <0x00989680>;
cpu@0 {
device_type = "cpu";
reg = <0x00000000>;
status = "okay";
compatible = "riscv";
riscv,isa = "rv64imafdc";
mmu-type = "riscv,sv48";
clock-frequency = <0x3b9aca00>;
interrupt-controller {
#interrupt-cells = <0x00000001>;
interrupt-controller;
compatible = "riscv,cpu-intc";
linux,phandle = <0x00000001>;
phandle = <0x00000001>;
}
}
}
memory@80000000 {
device_type = "memory";
reg = <0x00000000 0x80000000 0x00000000 0x80000000>;
}
soc {
#address-cells = <0x00000002>;
#size-cells = <0x00000002>;
compatible = "ucbbar,spike-bare-soc", "simple-bus";
ranges;
}
htif {
compatible = "ucb,htif0";
}
}
[ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[ 0.000000] Linux version 4.20.0+ (liboya@M8600t) (gcc version 8.3.0 (GCC)) #18 SMP Mon Sep 23 09:49:51 CST 2019
[ 0.000000] printk: bootconsole [early0] enabled
[ 0.000000] initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000ffffffff]
[ 0.000000] Normal [mem 0x0000000100000000-0x00000fffffffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x0000000080200000-0x00000000ffffffff]
[ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff]
[ 0.000000] software IO TLB: mapped [mem 0xf9ffe000-0xfdffe000] (64MB)
[ 0.000000] elf_hwcap is 0x112d
[ 0.000000] percpu: Embedded 19 pages/cpu @(____ptrval____) s37720 r8192 d31912 u77824
[ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 515592
[ 0.000000] Kernel command line:
[ 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: 1981432K/2095104K available (6105K kernel code, 503K rwdata, 2693K rodata, 1316K init, 1179K bss, 113672K reserved, 0K cma-reserved)
[ 0.000000] random: get_random_u64 called from __kmem_cache_create+0x36/0x4e8 with crng_init=0
[ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] rcu: Hierarchical RCU implementation.
[ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[ 0.000000] Tasks RCU enabled.
[ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[ 0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x24e6a1710, max_idle_ns: 440795202120 ns
[ 0.000000] Console: colour dummy device 80x25
[ 0.000000] printk: console [tty0] enabled
[ 0.000000] printk: bootconsole [early0] disabled
Similar issues have been proposed in other sites. But it still cannot work correctly.
After setting CONFIG_VT_CONSOLE=n
while configuring linux by make ARCH=riscv menuconfig
, it works smoothly. If CONFIG_VT_CONSOLE is enabled, a default console will be used instead of SBI.
Related configuration is found in /linux/drivers/tty/vt/vt.c
static int __init con_init(void){
...
#ifdef CONFIG_VT_CONSOLE
register_console(&vt_console_driver);
#endif
return 0;
}
Do you have patchfiles, PRs, or branches I could use to try your approach to running on spike?
Hi,
I am trying to simulate latest Linux with spike on Ubuntu 16.04. But it seems that the device tree cannot be initialized successfully.
The version of related repositories as listed as belows:
After compiling the toolchain, I build the vmlinux and bbl with these commands respectively:
After executing spike bbl, no information is shown except an error.
This error information is reported in
fdt_check_header()
function. That is to say, the console is not initialized as well.I listed the address of device tree pointer in
enter_supervisor_mode
frommachine/minit.c
, which is the newset value before starting kernel. With the support of SBI function (sbi_console_putchar()
), I listed the address of device tree pointer insetup_vm
inarch/riscv/mm/init.c
, which is the first use of these pointer and is used to access the device tree.Surprisingly, I found these two addresses are different. Before entering the kernel, the pointer is:
0x80a00000
, and it turns to be0x00000100
, which is related to the error adress0x00000101
.While if I initialized the value of the pointer to
0x80a00000
manually insetup_vm
fromarch/riscv/mm/init.c
, the fdt_check_header will be executed successfully. And the information of deviced tree is same as the information listed after I add the option--enable-print-device-tree
. However, set the Linux still do not print any words in console after I set the device tree pointer manually.I do not know how to resolve this error. If there is any suggestion, please help me.
Thanks for your time.