Skip to content

Instantly share code, notes, and snippets.

@pcotret
Created June 4, 2025 20:38
Show Gist options
  • Save pcotret/475b8d7f8e0582de5c58645689bb3f08 to your computer and use it in GitHub Desktop.
Save pcotret/475b8d7f8e0582de5c58645689bb3f08 to your computer and use it in GitHub Desktop.

Revisions

  1. pcotret created this gist Jun 4, 2025.
    302 changes: 302 additions & 0 deletions keystone_cva6.log
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,302 @@
    Hello World!
    init SPI
    status: 0x0000000000000025
    status: 0x0000000000000025
    SPI initialized!
    initializing SD...
    SD command cmd0 response : 01
    SD command cmd55 response : 01
    SD command cmd41 response : 01
    SD command cmd55 response : 01
    SD command cmd41 response : 00
    sd initialized!
    gpt partition table header:
    signature: 5452415020494645
    revision: 00010000
    size: 0000005C
    crc_header: 73104072
    reserved: 00000000
    current lba: 0000000000000001
    backup lda: 0000000001CD7FFF
    partition entries lba: 0000000000000002
    number partition entries: 00000080
    size partition entries: 00000080
    gpt partition entry 00
    partition type guid: D5F7127456A1134B81DC867174929325
    partition guid: BEB69529758CC140BBD1B11913F67246
    first lba: 0000000000000800
    last lba: 0000000000002000
    attributes: 0000000000000000
    name: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    gpt partition entry 01
    partition type guid: AF3DC60F838472478E793D69D8477DE4
    partition guid: 45F118429109354AA7FA9E79955CD433
    first lba: 0000000000100000
    last lba: 0000000001CD7FDE
    attributes: 0000000000000000
    name: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    gpt partition entry 02
    partition type guid: 00000000000000000000000000000000
    partition guid: 00000000000000000000000000000000
    first lba: 0000000000000000
    last lba: 0000000000000000
    attributes: 0000000000000000
    name: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    gpt partition entry 03
    partition type guid: 00000000000000000000000000000000
    partition guid: 00000000000000000000000000000000
    first lba: 0000000000000000
    last lba: 0000000000000000
    attributes: 0000000000000000
    name: 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    copying boot image ...... done!

    OpenSBI v1.1
    ____ _____ ____ _____
    / __ \ / ____| _ \_ _|
    | | | |_ __ ___ _ __ | (___ | |_) || |
    | | | | '_ \ / _ \ '_ \ \___ \| _ < | |
    | |__| | |_) | __/ | | |____) | |_) || |_
    \____/| .__/ \___|_| |_|_____/|____/_____|
    | |
    |_|

    [SM] Initializing ... hart [0]
    [SM] Keystone security monitor has been initialized!
    00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    Platform Name : ARIANE RISC-V
    Platform Features : medeleg
    Platform HART Count : 1
    Platform IPI Device : aclint-mswi
    Platform Timer Device : aclint-mtimer @ 1000000Hz
    Platform Console Device : uart8250
    Platform HSM Device : ---
    Platform Reboot Device : ---
    Platform Shutdown Device : ---
    Firmware Base : 0x80000000
    Firmware Size : 364 KB
    Runtime SBI Version : 1.0

    Domain0 Name : root
    Domain0 Boot HART : 0
    Domain0 HARTs : 0*
    Domain0 Region00 : 0x0000000002008000-0x000000000200bfff (I)
    Domain0 Region01 : 0x0000000002000000-0x0000000002007fff (I)
    Domain0 Region02 : 0x0000000080000000-0x000000008007ffff ()
    Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
    Domain0 Next Address : 0x0000000080200000
    Domain0 Next Arg1 : 0x0000000082200000
    Domain0 Next Mode : S-mode
    Domain0 SysReset : yes

    Boot HART ID : 0
    Boot HART Domain : root
    Boot HART Priv Version : v1.11
    Boot HART Base ISA : rv64imafdc
    Boot HART ISA Extensions : none
    Boot HART PMP Count : 8
    Boot HART PMP Granularity : 8
    Boot HART PMP Address Bits: 54
    Boot HART MHPM Count : 6
    Boot HART MIDELEG : 0x0000000000000222
    Boot HART MEDELEG : 0x000000000000b109


    U-Boot 2021.07-rc4 (Apr 23 2025 - 17:50:03 +0200)

    CPU: rv64imafdc
    DRAM: 1 GiB
    MMC: xps-spi@20000000:mmc@0: 0
    Loading Environment from nowhere... OK
    In: uart@10000000
    Out: uart@10000000
    Err: uart@10000000
    Net: LOWRISC-ETH: 30000000, phyaddr 0
    eth0: lowrisc-eth@30000000
    Hit any key to stop autoboot: 0
    Device: xps-spi@20000000:mmc@0
    Manufacturer ID: 27
    OEM: 5048
    Name: SD16G
    Bus Speed: 12500000
    Mode: MMC legacy
    Rd Block Len: 512
    SD version 2.0
    High Capacity: Yes
    Capacity: 14.4 GiB
    Bus Width: 1-bit
    Erase Group Size: 512 Bytes

    MMC read: dev # 0, block # 1048576, count 65536 ... 65536 blocks read: OK
    ## Booting kernel from Legacy Image at 90000000 ...
    Image Name: CV64A6Linux
    Image Type: RISC-V Linux Kernel Image (gzip compressed)
    Data Size: 9153088 Bytes = 8.7 MiB
    Load Address: 80200000
    Entry Point: 80200000
    Verifying Checksum ... OK
    ## Flattened Device Tree blob at bffdf940
    Booting using the fdt blob at 0xbffdf940
    Uncompressing Kernel Image
    Using Device Tree in place at 00000000bffdf940, end 00000000bffe460e

    Starting kernel ...

    [ 0.000000] Linux version 6.1.32 (cotretpa@tdell5825) (riscv64-buildroot-linux-gnu-gcc.br_real (Buildroot 2023.02.2) 11.4.0, GNU ld (GNU Binutils) 2.38) #2 SMP Wed Apr 23 17:59:25 CEST 25
    [ 0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
    [ 0.000000] Machine model: eth,cva6-bare
    [ 0.000000] efi: UEFI not found.
    [ 0.000000] cma: Reserved 128 MiB at 0x00000000b7c00000
    [ 0.000000] Zone ranges:
    [ 0.000000] DMA32 [mem 0x0000000080200000-0x00000000bfffffff]
    [ 0.000000] Normal empty
    [ 0.000000] Movable zone start for each node
    [ 0.000000] Early memory node ranges
    [ 0.000000] node 0: [mem 0x0000000080200000-0x00000000bfffffff]
    [ 0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000bfffffff]
    [ 0.000000] SBI specification v1.0 detected
    [ 0.000000] SBI implementation ID=0x1 Version=0x10001
    [ 0.000000] SBI TIME extension detected
    [ 0.000000] SBI IPI extension detected
    [ 0.000000] SBI RFENCE extension detected
    [ 0.000000] SBI HSM extension detected
    [ 0.000000] riscv: base ISA extensions acdfim
    [ 0.000000] riscv: ELF capabilities acdfim
    [ 0.000000] percpu: Embedded 15 pages/cpu s22440 r8192 d30808 u61440
    [ 0.000000] Built 1 zonelists, mobility grouping on. Total pages: 258055
    [ 0.000000] Kernel command line: cma=128M
    [ 0.000000] Dentry cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
    [ 0.000000] Inode-cache hash table entries: 65536 (order: 7, 524288 bytes, linear)
    [ 0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
    [ 0.000000] Memory: 879008K/1046528K available (4967K kernel code, 3773K rwdata, 2048K rodata, 7199K init, 389K bss, 36448K reserved, 131072K cma-reserved)
    [ 0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    [ 0.000000] rcu: Hierarchical RCU implementation.
    [ 0.000000] rcu: RCU event tracing is enabled.
    [ 0.000000] rcu: RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=1.
    [ 0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
    [ 0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
    [ 0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
    [ 0.000000] riscv-intc: 64 local interrupts mapped
    [ 0.000000] plic: interrupt-controller@c000000: mapped 30 interrupts with 1 handlers for 2 contexts.
    [ 0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
    [ 0.000000] riscv-timer: riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
    [ 0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x5c40939b5, max_idle_ns: 440795202646 ns
    [ 0.000104] sched_clock: 64 bits at 25MHz, resolution 40ns, wraps every 4398046511100ns
    [ 0.003598] Calibrating delay loop (skipped), value calculated using timer frequency.. 50.00 BogoMIPS (lpj=250000)
    [ 0.004289] pid_max: default: 32768 minimum: 301
    [ 0.013131] Mount-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
    [ 0.014396] Mountpoint-cache hash table entries: 2048 (order: 2, 16384 bytes, linear)
    [ 0.099863] riscv: ELF compat mode unsupported
    [ 0.100831] ASID allocator using 16 bits (65536 entries)
    [ 0.108709] rcu: Hierarchical SRCU implementation.
    [ 0.109002] rcu: Max phase no-delay instances is 1000.
    [ 0.122592] EFI services will not be available.
    [ 0.130984] smp: Bringing up secondary CPUs ...
    [ 0.131290] smp: Brought up 1 node, 1 CPU
    [ 0.148183] devtmpfs: initialized
    [ 0.191247] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    [ 0.192743] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
    [ 0.363998] NET: Registered PF_NETLINK/PF_ROUTE protocol family
    [ 0.738811] usbcore: registered new interface driver usbfs
    [ 0.740872] usbcore: registered new interface driver hub
    [ 0.743396] usbcore: registered new device driver usb
    [ 0.747637] pps_core: LinuxPPS API ver. 1 registered
    [ 0.747963] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
    [ 0.749163] PTP clock support registered
    [ 0.779776] clocksource: Switched to clocksource riscv_clocksource
    [ 0.841258] NET: Registered PF_INET protocol family
    [ 0.854521] IP idents hash table entries: 16384 (order: 5, 131072 bytes, linear)
    [ 0.926647] tcp_listen_portaddr_hash hash table entries: 512 (order: 1, 8192 bytes, linear)
    [ 0.927763] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
    [ 0.928421] TCP established hash table entries: 8192 (order: 4, 65536 bytes, linear)
    [ 0.932785] TCP bind hash table entries: 8192 (order: 6, 262144 bytes, linear)
    [ 0.944363] TCP: Hash tables configured (established 8192 bind 8192)
    [ 0.952193] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
    [ 0.953498] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
    [ 0.960304] NET: Registered PF_UNIX/PF_LOCAL protocol family
    [ 0.992749] RPC: Registered named UNIX socket transport module.
    [ 0.993127] RPC: Registered udp transport module.
    [ 0.993360] RPC: Registered tcp transport module.
    [ 0.993559] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [ 1.048664] workingset: timestamp_bits=62 max_order=18 bucket_order=0
    [ 1.710631] NFS: Registering the id_resolver key type
    [ 1.714793] Key type id_resolver registered
    [ 1.715131] Key type id_legacy registered
    [ 1.720255] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
    [ 1.720675] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
    [ 3.507595] io scheduler mq-deadline registered
    [ 3.508394] io scheduler kyber registered
    [ 9.514698] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
    [ 9.606887] printk: console [ttyS0] disabled
    [ 9.609228] 10000000.uart: ttyS0 at MMIO 0x10000000 (irq = 1, base_baud = 3125000) is a TI16750
    [ 11.063610] printk: console [ttyS0] enabled
    [ 11.183147] xilinx_spi 20000000.xps-spi: at [mem 0x20000000-0x20000fff], irq=2
    [ 11.247968] lowrisc-digilent-ethernet: Lowrisc ethernet platform (30000000-30007FFF) mapped to ffffffc804100000
    [ 15.813470] Probing lowrisc-0:01 (address 1)
    [ 15.843315] RTL8211E Gigabit Ethernet lowrisc-0:01: attached PHY driver (mii_bus:phy_addr=lowrisc-0:01, irq=POLL)
    [ 15.872788] lowrisc-eth 30000000.lowrisc-eth: Lowrisc Ether100MHz registered
    [ 15.942530] mmc_spi spi0.0: SD/MMC host mmc0, no WP, no poweroff, cd polling
    [ 15.961632] usbcore: registered new interface driver usbhid
    [ 15.968063] usbhid: USB HID core driver
    [ 16.020704] NET: Registered PF_INET6 protocol family
    [ 16.063704] mmc0: host does not support reading read-only switch, assuming write-enable
    [ 16.073916] mmc0: new SDHC card on SPI
    [ 16.128796] mmcblk0: mmc0:0000 SD16G 14.4 GiB
    [ 16.192544] Segment Routing with IPv6
    [ 16.200569] In-situ OAM (IOAM) with IPv6
    [ 16.207652] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    [ 16.240464] NET: Registered PF_PACKET protocol family
    [ 16.684271] mmcblk0: p1 p2
    [ 16.696000] Key type dns_resolver registered
    [ 17.260881] Freeing unused kernel image (initmem) memory: 7196K[ 17.281508] Run /init as init process
    Starting syslogd: OK
    Starting klogd: OK
    Running sysctl: OK
    Saving 256 bits of non-creditable seed for next boot
    Starting network: [ 29.655215] lowrisc-eth 30000000.lowrisc-eth eth0: Current addr [ 29.663441] lowrisc-eth 30000000.lowrisc-eth eth0: Expected add [ 29.671327] ------------[ cut he-
    [ 29.676632] netdevice: eth0: Incorrect netdev->dev_addr
    [ 29.685231] WARNING: CPU: 0 PID: 99 at net/core/dev_addr_lists.[ 29.692203] Modules linked in:
    [ 29.696025] CPU: 0 PID: 99 Comm: ip Not tainted 6.1.32 #2
    [ 29.702230] Hardware name: eth,cva6-bare (DT)
    [ 29.707171] epc : dev_addr_check+0xa4/0x100
    [ 29.712208] ra : dev_addr_check+0xa4/0x100
    [ 29.717221] epc : ffffffff80387478 ra : ffffffff80387478 sp : f[ 29.723715] gp : ffffffff812b6e38 tp : ffffffd802014280 t0 : 6[ 29.730201] t1 : 000000000000006e t2 : 656369766564748
    [ 29.787915] status: 0000000200000120 badaddr: 0000000000009002 [ 29.794409] [<ffffffff80387478>] dev_addr_check+0xa4/0x100
    [ 29.800840] [<ffffffff80384662>] __dev_open+0x2c/0x134
    [ 29.807100] [<ffffffff80384ae4>] __dev_change_flags+0x178/0x1e4[ 29.813854] [<ffffffff80384b6e>] dev_change_flags+0x1e/0x52
    [ 29.820408] [<ffffffff8040b7b0>] devinet_ioctl+0x1cc/0x5b2
    [ 29.826911] [<ffffffff8040d06a>] inet_ioctl+0xc4/0x13c
    [ 29.832995] [<ffffffff8035efde>] sock_do_ioctl+0x2c/0xac
    [ 29.839196] [<ffffffff8035fcac>] sock_ioctl+0x12e/0x2bc
    [ 29.845282] [<ffffffff800ee85c>] sys_ioctl+0x76/0x88
    [ 29.851293] [<ffffffff800033aa>] ret_from_syscall+0x0/0x2
    [ 29.857592] ---[ end trace 0000000000000000 ]---
    [ 29.875986] Open device, request interrupt 3
    udhcpc: started, v1.36.0
    udhcpc: broadcasting discover
    udhcpc: no lease, forking to background
    OK
    Starting dropbear sshd: OK

    Welcome to Buildroot
    buildroot login: root
    Password:
    # modprobe keystone-driver
    [ 56.491986] keystone_driver: loading out-of-tree module taints [ 56.576970] keystone_enclave: keystone enclave v1.0.0
    # cat /proc/cpuinfo

    processor : 0
    hart : 0
    isa : rv64imafdc
    mmu : sv39
    uarch : eth, cva6
    mvendorid : 0x602
    marchid : 0x3
    mimpid : 0x0

    #
    # /usr/share/keystone/examples/hello.ke

    Verifying archive integrity... MD5 checksums are OK. All good.
    Uncompressing Keystone Enclave Package
    hello, world!