[PATCH] riscv: timer: Add support for an early timer

Pragnesh Patel pragnesh.patel at openfive.com
Mon Dec 21 12:15:44 CET 2020


Hi Rick,

>-----Original Message-----
>From: Rick Chen <rickchen36 at gmail.com>
>Sent: 10 December 2020 08:36
>To: Pragnesh Patel <pragnesh.patel at openfive.com>
>Cc: Simon Glass <sjg at chromium.org>; U-Boot Mailing List <u-
>boot at lists.denx.de>; Atish Patra <atish.patra at wdc.com>; Bin Meng
><bmeng.cn at gmail.com>; Paul Walmsley ( Sifive) <paul.walmsley at sifive.com>;
>Anup Patel <anup.patel at wdc.com>; Sagar Kadam
><sagar.kadam at openfive.com>; Palmer Dabbelt <palmer at dabbelt.com>; rick
><rick at andestech.com>; Alan Kao <alankao at andestech.com>; Leo Liang
><ycliang at andestech.com>
>Subject: Re: [PATCH] riscv: timer: Add support for an early timer
>
>[External Email] Do not click links or attachments unless you recognize the
>sender and know the content is safe
>
>Hi Pragnesh
>
>
>> Hi Rick,
>>
>> [...]
>> >>
>> >>Following are the configurations, steps and debug logs:
>> >>
>> >>+++ b/configs/ae350_rv64_defconfig
>> >>q+CONFIG_TRACE=y
>> >>+CONFIG_TRACE_BUFFER_SIZE=0x01000000
>> >>+CONFIG_TRACE_CALL_DEPTH_LIMIT=15
>> >>+CONFIG_CMD_TRACE=y
>> >>+CONFIG_TIMER_EARLY=y
>> >>
>> >>+++ b/configs/ae350_rv64_spl_defconfig
>> >>+CONFIG_TRACE=y
>> >>+CONFIG_TRACE_BUFFER_SIZE=0x01000000
>> >>+CONFIG_TRACE_CALL_DEPTH_LIMIT=15
>> >>+CONFIG_CMD_TRACE=y
>> >>+CONFIG_TIMER_EARLY=y
>> >>
>> >>//////////////////////////////////////////////// case 1
>> >>///////////////////////////////////////////////////
>> >>ae350_rv64_defconfig with FTRACE=1, kernel booting is ok
>> >>//////////////////////////////////////////////// case 1
>> >>///////////////////////////////////////////////////
>> >>make FTRACE=1 ae350_rv64_defconfig
>> >>make FTRACE=1
>> >>////////////////////////////////////////////////////////////////////
>> >>///
>> [...]
>> >>//////////////////////////////////////////////// case 2
>> >>///////////////////////////////////////////////////
>> >>ae350_rv64_spl_defconfig with FTRACE=1, kernel booting fail
>> >>//////////////////////////////////////////////// case 2
>> >>///////////////////////////////////////////////////
>> >>make FTRACE=1 ae350_rv64_spl_defconfig make FTRACE=1
>> >>////////////////////////////////////////////////////////////////////
>> >>///
>> >>///////////////
>> >>/////////////////////////
>> [...]
>> >>(hang here)
>> >
>> >Thanks for the logs.
>> >
>> >From logs, I can't find where it got stuck. Can you please use gdb to
>> >see where it got stuck ?
>> >
>> >Meanwhile I will give it a try on HiFive Unleashed board.
>>
>> On HiFive Unleashed it works fine with tracing.
>>
>> U-Boot 2021.01-rc2-00049-gb2a38d1d0f (Dec 01 2020 - 15:04:41 +0530)
>> CPU:   rv64imafdc
>> Model: SiFive HiFive Unleashed A00
>> DRAM:  8 GiB
>> trace: enabled
>> MMC:   spi at 10050000:mmc at 0: 0
>> Loading Environment from SPIFlash... SF: Detected is25wp256 with page
>> size 256 Bytes, erase size 4 KiB, total 32 MiB
>> *** Warning - bad CRC, using default environment
>> In:    serial at 10010000
>> Out:   serial at 10010000
>> Err:   serial at 10010000
>> Net:   eth0: ethernet at 10090000
>> Hit any key to stop autoboot:  0
>> =>
>> => trace stats
>>         178,750 function sites
>>      25,359,991 function calls
>>               1 untracked function calls
>>       1,278,927 traced function calls (24358307 dropped due to overflow)
>>              19 maximum observed call depth
>>              15 call depth limit
>>      25,238,922 calls not traced due to depth => fatload mmc 0:3
>> 0x86000000 hifive-unleashed-a00.dtb
>> 7199 bytes read in 27 ms (259.8 KiB/s) => fatload mmc 0:3 0x84000000
>> uImage
>> 21421212 bytes read in 19496 ms (1 MiB/s) => bootm 0x84000000 -
>> 0x86000000 ## Booting kernel from Legacy Image at 84000000 ...
>>    Image Name:   Linux
>>    Image Type:   RISC-V Linux Kernel Image (uncompressed)
>>    Data Size:    21421148 Bytes = 20.4 MiB
>>    Load Address: 80200000
>>    Entry Point:  80200000
>>    Verifying Checksum ... OK
>> ## Flattened Device Tree blob at 86000000
>>    Booting using the fdt blob at 0x86000000
>>    Loading Kernel Image
>>    Using Device Tree in place at 0000000086000000, end
>> 0000000086004c1e Starting kernel ...(fake run for tracing) Starting
>> kernel ...
>> [    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
>> [    0.000000] Linux version 5.8.0-rc3-16077-g9ebcfadb0610-dirty
>(pragneshp at sachinj2-OptiPlex-7010) (riscv64-unknown-linux-gnu-gcc (crosstool-
>NG 1.24.0.37-3f461da) 9.2.0, GNU ld (crosstool-NG 1.24.0.37-3f461da) 2.32) #34
>SMP Tue Jul 21 15:56:29 IST 2020
>> [    0.000000] initrd not found or empty - disabling initrd
>> [    0.000000] Zone ranges:
>> [    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
>> [    0.000000]   Normal   [mem 0x0000000100000000-0x000000027fffffff]
>> [    0.000000] Movable zone start for each node
>> [    0.000000] Early memory node ranges
>> [    0.000000]   node   0: [mem 0x0000000080200000-0x000000027fffffff]
>> [    0.000000] Initmem setup node 0 [mem 0x0000000080200000-
>0x000000027fffffff]
>> ....
>> Welcome to Buildroot
>> buildroot login: root
>> Password:
>>
>
>Please check about the CI failure item Job #95.56
>https://travis-ci.org/github/rickchen36/u-boot-riscv/jobs/748298543

This is due to 'RISCV_MMODE_TIMER_FREQ' undeclared

I will update "include/configs/qemu-riscv.h" in v2 as below,

--- a/include/configs/qemu-riscv.h
+++ b/include/configs/qemu-riscv.h
@@ -29,6 +29,11 @@

 #define CONFIG_STANDALONE_LOAD_ADDR    0x80200000

+#define RISCV_MMODE_TIMERBASE          0x2000000
+#define RISCV_MMODE_TIMER_FREQ         1000000
+
+#define RISCV_SMODE_TIMER_FREQ         1000000
+


>
>Thanks,
>Rick


More information about the U-Boot mailing list