summaryrefslogtreecommitdiff
path: root/sys/arch/riscv/include
AgeCommit message (Collapse)Author
2023-07-04riscv: Fix (U)INT64_C suffix to match gcc's built-in idea of types.riastradh
XXX pullup-10
2023-06-23Pad the trapframe so it's a multiple of 16 bytes so that when a trapframeskrll
is created on the stack SP remains 16-byte aligned as per the ABI requirements. Patch from Rin with some updates from me.
2023-06-12risc-v: MULTIPROCESSOR supportskrll
Add MULTIPROCESSOR support for RISC-V, but leave disabled for the moment as it's not 100% stable. Some other improvements to spl and cpu identification / reporting.
2023-05-25Fix CLKF_INTR so that not all time is shown as being spent in interrupts.skrll
2023-05-08Don't expose vaddr_t or register_t to userland. The gdb configure scriptskrll
needs this so it can detect struct lwp correctly.
2023-05-08Remove some #if 0'ed codeskrll
2023-05-08KNFskrll
2023-05-07RISC-V support that works on QEMU with a single hart.skrll
Thanks for Simon Burge for plic(4).
2023-04-22G/C pte_indexskrll
2022-12-23Fix RV buildsskrll
2022-12-13KNFskrll
2022-12-03leading whitespace... oopsskrll
2022-12-03Correct some pre-existing relocations and add some new ones.skrll
2022-11-19Fix some typesskrll
2022-11-18Fix SR_WPRI.skrll
Tweak csr_cycle_read and csr_asid_write for code style, and add some KNF whitespace.
2022-11-17Document lots of bits.simonb
Remove bits no longer in the RISC-V supervisor spec. Update defines for the user-mode sstatus value.
2022-11-17Use better types and struct member names in the clockframe.simonb
Avoid a magic number in CLKF_USERMODE().
2022-11-15Use similar macro-magic to aarch64 armreg.h to add per-csrsimonb
read/write/set-bits/clear-bits inline functions. Keep the open-coded 32-bit version of riscvreg_cycle_read() than reads a 64-bit cycle counter values. Added benefit of fixing these so that the inline asm uses __volatile and aren't opmtimised to nops by the compiler.
2022-11-13Comment fixskrll
2022-11-12Note some SV39 PTE bits defined in extensions.skrll
Fix pte_nv_entry for the kernel. Fix pte_pde_ptpage. PTE.{X,W,R} must be zero for pointer to next level.
2022-11-12Use uintptr_t consistently rather than register_tskrll
2022-11-11The supervisor status register is the native word width, not fixedsimonb
at 32 bits.
2022-11-08Parentheses police.simonb
2022-11-08Add cause register trap types, and some macros to access cause registersimonb
fields.
2022-11-08Add a #define for XLEN, the RISC-V native base integer ISA width.simonb
2022-11-08whitepsace nitskrll
2022-10-20Add the "memory" clobber in two places that it's needed.skrll
2022-10-18VSXLEN=64 supports 16-bit ASID space so change tlb_asid_t to be bigskrll
enough. Spotted by Simon.
2022-10-18Some fixes from Simon.skrll
2022-10-18Correct XSEGSHIFT for RV32 caseskrll
2022-10-16Map the DTB using VM_KERNEL_DTB_BASE and CONSADDR using VM_KERNEL_IO_BASEskrll
2022-10-15Fix typo in SATP_MODE_SV64skrll
2022-10-15Consistency nit: use "__volatile" instead of "volatile" with asm()s.simonb
2022-10-15Add SATP modes for bare, SV57 and SV64.simonb
2022-10-15Use __volatile so the compiler doesn't optimise out successive callssimonb
to cpu_counter(). Add a 64-bit cycle counter on _LP64.
2022-10-15#define<tab>simonb
2022-10-15Update a commentskrll
2022-10-12Set RISCV_DIRECTMAP_SIZE to 2^64-PAGESIZE, since 2^64 is effectively 0simonb
for a 64bit constant. Bump VM_PHYSSEG_MAX from 1 to 16.
2022-10-12Fix a tyop regname in a comment.simonb
2022-10-12NKMEMPAGES_MIN_DEFAULT is in pages not bytes (hint is in the name).simonb
Also set NKMEMPAGES_MAX_UNLIMITED while we're here.
2022-09-30Don't set A, D in page table pointers, but do set them in leaf entries.skrll
Beagle-v now boots to the msgbufaddr panic same as qemu
2022-09-28Use legacy SBI Console GetChar for earlycons. It works on qemu.skrll
2022-09-27Basic ddb and backtrace support.skrll
[ 1.0000000] panic: kernel diagnostic assertion "msgbufaddr != 0" failed: file "/home/nick/netbsd/nbcvs/src/sys/arch/riscv/riscv/riscv_machdep.c", line 564 [ 1.0000000] cpu0: Begin traceback... [ 1.0000000] trace fp ffffffc000801dd0 [ 1.0000000] fp ffffffc000801e10 ?() at ffffffc0001eee98 [ 1.0000000] fp ffffffc000801e30 ?() at ffffffc0002ad984 [ 1.0000000] fp ffffffc000801ee0 ?() at ffffffc000005430 [ 1.0000000] cpu0: End traceback... [ 1.0000000] Trapframe @ 0xffffffc000801cb0 (cause=3 (breakpoint), status=0x100, pc=0xffffffc0000007e4, va=0): [ 1.0000000] ra =0xffffffc0001eee9c, sp =0xffffffc000801dd0, gp =0xffffffc0006a8f40, tp = 0 [ 1.0000000] s0 =0xffffffc000600ac0, s1 = 0x1000, s2 =0xffffffc000438df0, s3 =0xffffffc000801d80 [ 1.0000000] s4 =0xffffffc0001eed78, s5 =0xffffffc0006d55f8, s6 =0xffffffc000801d88, s7 =0xffffffc0006dfdb8 [ 1.0000000] s8 =0xffffffc000428c18, s9 =0xffffffc000801dd0, s10=0xffffffc0000a3822, s11=0xffffffc0006d55f8 [ 1.0000000] a0 = 0x17, a1 = 0xa, a2 = 0, a3 =0xffffffc00041f658 [ 1.0000000] a4 = 0, a5 = 0x1, a5 = 0, a7 = 0x1 [ 1.0000000] t0 =0xffffffc0006dfe30, t1 =0xffffffc000801bb8, t2 =0xffffffc000803000, t3 = 0x75 [ 1.0000000] t4 = 0, t5 = 0x63, t6 = 0x1 [ 1.0000000] kernel: breakpoint Stopped in pid 0.0 (system) at ffffffc0000007e4: c.ebreak db>
2022-09-21Use c99 types. NFC.skrll
2022-09-20Checkpoint WIP.skrll
QEMU RV64 virt can boot into virtual mode OpenSBI v1.0 ____ _____ ____ _____ / __ \ / ____| _ \_ _| | | | |_ __ ___ _ __ | (___ | |_) || | | | | | '_ \ / _ \ '_ \ \___ \| _ < | | | |__| | |_) | __/ | | |____) | |_) || |_ \____/| .__/ \___|_| |_|_____/|____/_____| | | |_| Platform Name : riscv-virtio,qemu Platform Features : medeleg Platform HART Count : 1 Platform IPI Device : aclint-mswi Platform Timer Device : aclint-mtimer @ 10000000Hz Platform Console Device : uart8250 Platform HSM Device : --- Platform Reboot Device : sifive_test Platform Shutdown Device : sifive_test Firmware Base : 0x80000000 Firmware Size : 252 KB Runtime SBI Version : 0.3 Domain0 Name : root Domain0 Boot HART : 0 Domain0 HARTs : 0* Domain0 Region00 : 0x0000000002000000-0x000000000200ffff (I) Domain0 Region01 : 0x0000000080000000-0x000000008003ffff () Domain0 Region02 : 0x0000000000000000-0xffffffffffffffff (R,W,X) Domain0 Next Address : 0x0000000080200000 Domain0 Next Arg1 : 0x00000000bfe00000 Domain0 Next Mode : S-mode Domain0 SysReset : yes Boot HART ID : 0 Boot HART Domain : root Boot HART ISA : rv64imafdcsuh Boot HART Features : scounteren,mcounteren,mcountinhibit,time Boot HART PMP Count : 16 Boot HART PMP Granularity : 4 Boot HART PMP Address Bits: 54 Boot HART MHPM Count : 16 Boot HART MIDELEG : 0x0000000000001666 Boot HART MEDELEG : 0x0000000000f0b509 ------------ NetBSD start sp: 0x0000_0000_80a0_2000 pc: 0x0000_0000_8020_0090 hart: 0x0000_0000_0000_0000 dtb: 0x0000_0000_bfe0_0000 l1: 0x0000_0000_80a0_2000 l2: 0x0000_0000_80a0_3000 uspace: 0x0000_0000_80a0_0000 bootstk: 0x0000_0000_80a0_2000 vtopdiff:0xffff_ffbf_7fe0_0000 bss: 0x0000_0000_808a_8bdc - 0x0000_0000_80a0_4000 0x0000_0000_80a0_3800: 0x0000_0000_2028_0821 kern 0x0000_0000_80a0_2000: 0x0000_0000_2008_002f kern 0x0000_0000_80a0_2008: 0x0000_0000_2010_002f kern 0x0000_0000_80a0_2010: 0x0000_0000_2018_002f kern 0x0000_0000_80a0_2018: 0x0000_0000_2020_002f kern 0x0000_0000_80a0_2020: 0x0000_0000_2028_002f kern 0x0000_0000_80a0_2028: 0x0000_0000_2030_002f kern 0x0000_0000_80a0_2030: 0x0000_0000_2038_002f kern 0x0000_0000_80a0_2038: 0x0000_0000_2040_002f kern 0x0000_0000_80a0_2040: 0x0000_0000_2048_002f kern 0x0000_0000_80a0_2048: 0x0000_0000_2050_002f kern 0x0000_0000_80a0_2050: 0x0000_0000_2058_002f kern 0x0000_0000_80a0_2058: 0x0000_0000_2060_002f kern 0x0000_0000_80a0_2060: 0x0000_0000_2068_002f kern 0x0000_0000_80a0_2068: 0x0000_0000_2070_002f kern 0x0000_0000_80a0_2070: 0x0000_0000_2078_002f kern 0x0000_0000_80a0_2078: 0x0000_0000_2080_002f dtb 0x0000_0000_80a0_2080: 0x0000_0000_2ff8_0027 PM [ 1.0000000] FDT<0xffffffc002000000> [ 1.0000000] consinit ok [ 1.0000000] NetBSD/riscv (fdt) booting ... [ 1.0000000] FDT /memory @ 0x80000000 size 0x40000000 [ 1.0000000] init_riscv: memory start 80000000 end c0000000 (len 40000000) [ 1.0000000] bootargs: root=ld4a -v -x [ 1.0000000] bootflag 'r' not recognised [ 1.0000000] bootflag 'o' not recognised [ 1.0000000] bootflag 'o' not recognised [ 1.0000000] bootflag 't' not recognised [ 1.0000000] bootflag '=' not recognised [ 1.0000000] bootflag 'l' not recognised [ 1.0000000] bootflag ' ' not recognised [ 1.0000000] bootflag ' ' not recognised [ 1.0000000] ------------------------------------------ [ 1.0000000] kern_vtopdiff = 0xffffffbf7fe00000 [ 1.0000000] memory_start = 0x 80000000 [ 1.0000000] memory_end = 0x c0000000 [ 1.0000000] memory_size = 0x 40000000 [ 1.0000000] kernstart_phys = 0x 80200000 [ 1.0000000] kernend_phys = 0x 80a00000 [ 1.0000000] VM_MIN_KERNEL_ADDRESS = 0xffffffc000000000 [ 1.0000000] kernstart_mega = 0xffffffc000000000 [ 1.0000000] kernstart = 0xffffffc000000000 [ 1.0000000] kernend = 0xffffffc000800000 [ 1.0000000] kernend_mega = 0xffffffc000800000 [ 1.0000000] VM_MAX_KERNEL_ADDRESS = 0xffffffd000000000 [ 1.0000000] ------------------------------------------ [ 1.0000000] panic: kernel diagnostic assertion "msgbufaddr != 0" failed: file "/home/nick/netbsd/nbcvs/src/sys/arch/riscv/riscv/riscv_machdep.c", line 564
2022-09-11Add some bus_space(9), bus_dma(9) and FDT infrastructure. Baby steps.skrll
Remove the RISC-V Host Target Interface (HTIF) Emulation code.
2022-09-10Remove unnecessary cast.skrll
2022-05-24s/dosen't/doesn't/ in copy pasted comment.andvar
2021-10-05#define<tab>jmcneill
2021-10-05Fix riscv32 GENERIC buildskrll