aboutsummaryrefslogtreecommitdiff
path: root/machine
AgeCommit message (Collapse)AuthorFilesLines
2020-12-15Add support for the UART interface on the LiteX SoC (#230)gsomlo5-1/+101
Tested using the RocketChip CPU option. (see https://github.com/enjoy-digital/litex) Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2020-11-23Fix emulation of misaligned access on big endian target (#224)Marcus Comstedt2-3/+32
2020-11-11fdt: Skip byteorder swap on big endianMarcus Comstedt1-0/+5
2020-10-31Disable device tree filter when load a dts from file (#219)Yan3-0/+25
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter * Remove *.dtb dependence, when the --with-dts option is not used
2020-10-30Revert "Disable device tree filter when load a dts from file (#217)"Andrew Waterman3-22/+0
This reverts commit a161e6f3ef31004e47a5b94b85c2e84b764f8637. Resolves #218
2020-10-29Disable device tree filter when load a dts from file (#217)Yan3-0/+22
* add device tree in elf, using --with-dts to add the absolute path of device tree * Disable device tree filter
2020-08-07make htif_poweroff thread-safe (#211)Howard Mao1-2/+3
2020-07-31Don't perform 64-bit accesses to the PLIC (#205)Alexander Richardson3-7/+7
Recent QEMU will fault for 8-byte accesses. Use a uint32_t instead of uintptr_t to avoid those problems.
2020-07-18Fix UART register map (#208)Nicholas O'Brien1-1/+3
While it's unused upstream, according to the SiFive FU540 document, the UART divisor register is at offset 0x18. This also maps the interrupt enable and interrupt pending register offsets.
2020-06-07Consistently use fdt_string_list for FDT compatible property (#202)Jessica Clarke3-3/+3
QEMU's finisher is "sifive,test1\0sifive,test0\0syscon" so we fail to detect it currently. Instead, search the entire list, and for completeness do the same with the HTIF and SiFive UART drivers.
2020-03-29Update encoding.h from riscv-opcodes (#194)Kito Cheng1-246/+1573
- Update to riscv-opcodes/231c5d58940113b006aa9fa22f47c18d5fac4123
2020-02-02Support manually zeroing out BSS when booting (#188)James Clarke1-1/+15
Some ELF loaders, in particular gdb's load command for dynamically loading files into memory, which is often used to load binaries onto FPGAs over JTAG, do not zero out BSS, leaving the memory in whatever state it was previously in. Thus, introduce a new --enable-zero-bss configure flag, which will include code to zero out BSS when booting.
2020-01-13Enable vector unit if present (continuation of ↵Andrew Waterman2-2/+7
77a5df569451571d608650a34183d53df99790ec)
2020-01-11Enable vector unit if presentAndrew Waterman2-0/+5
2019-12-06Only prohibit float32-only when FP emulation is enabledAndrew Waterman3-7/+22
2019-11-06Support a subset of 16750 functionality, and improve baud rate selection (#182)Jonathan Kimmitt1-3/+15
2019-10-31fdt: allow mmu type "riscv,32" on rv32 systems (#177)Gokturk Yuksek1-0/+4
SV32 is presented in RISC-V Privileged Architecture Manual (version 20190608-Priv-MSU-Ratified) Section 4.3 for RV32 systems. However, BBL responds to sv32 with: hart_filter_mask saw unknown hart type: status="okay", mmu_type="riscv,sv32" and hangs. This patch is adopted from the original 'riscv-pk.diff' patch written by Fabrice Bellard, distributed as part of the following tarball: https://bellard.org/tinyemu/diskimage-linux-riscv-2018-09-23.tar.gz Closes: https://github.com/riscv/riscv-pk/issues/160
2019-08-12allow additional ns16550a config via device treeMichael Panzlaff3-14/+54
This commit makes bbl read some additional fields from the device tree if it detects an ns16550a: - reg-shift - reg-offset - clock-frequency For explanation of these check out the Linux Kernel doc: https://www.kernel.org/doc/Documentation/devicetree/bindings/serial/8250.txt In particular this allows the Xilinx AXI UART 16550 to act as serial console with bbl and the Linux early boot console. This also fixes a bug in which bbl will ignore any other than the first "compatible" string when iterating over the nodes. Previously this line would not have worked: compatible = "xlnx,xps-uart16550-2.00.a", "ns16550a"; Before bbl would have just checked the first field instead of checking all strings in the list.
2019-07-17Make illegal-instruction jump table entries relative to their baseAndrew Waterman2-77/+77
This supports bbl living above 4 GiB.
2019-07-17Use pointer-sized entries in trap tableAndrew Waterman1-19/+19
This allows bbl to be loaded above 4 GiB on RV64.
2019-07-05Report correct scause when faulting while fetching emulated instructionAndrew Waterman2-7/+26
2019-06-11Check for 'U' extension before accessing 'mcounteren' CSRGabriel L. Somlo1-1/+2
On 64-bit Rocket with 'DefaultFPGAConfig' (using 'WithNSmallCores'), the 'U' extension is not supported, and accessing 'mcounteren' would trigger an 'Illegal Instruction' trap. Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>
2019-01-04Set up PMP earlier, so it can be overridden laterAndrew Waterman2-5/+3
2018-12-02Delegate misaligned AMOs as access exceptions, not misalignedAndrew Waterman1-2/+8
This indicates the access is actually invalid, i.e., should not be emulated.
2018-12-02Revert "Avoid writing reserved values to pmpaddr CSR"Andrew Waterman1-2/+1
This reverts commit 7bee30c1ff56975041ffc67cd0170d7477aba865. All ones is no longer "reserved", so the old code is OK.
2018-11-20Fix the calculation for the number of interrupt enable wordsLogan Gunthorpe1-1/+2
The number of interrupt enable words should be the number of devices divided by the number of bits per word (not the number of bytes per word) and it should round up. Without this fix, when using a larger number of interrupts, the user will see a number of errors in qemu of the form: plic: invalid register write: %08x Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
2018-09-23Avoid writing reserved values to pmpaddr CSRAndrew Waterman1-1/+2
2018-08-15Fix printm on RV32 (#119)Andrew Waterman1-0/+16
Use a proxy syscall instead of a blocking character write. Resolves #84
2018-07-12minit: Move pmp setup code to a separate function to avoid duplicating codeHesham Almatary1-11/+7
Currently it's being used by both enter_supervisor_mode and enter_machine_mode
2018-07-12bbl: boot payload in machine mode when --enable-boot-machine is passedHesham Almatary3-0/+33
2018-07-11Merge pull request #113 from riscv/licensePalmer Dabbelt1-29/+34
Upgrade SoftFloat
2018-07-11Merge pull request #103 from zongbox/commentPalmer Dabbelt1-1/+1
Correct the comment of timer interrupt
2018-07-11Upgrade to SoftFloat 3eAndrew Waterman1-29/+34
2018-07-09Properly license all nontrivial filesAndrew Waterman28-0/+56
2018-06-20Fix problem of casting u64 to void* on 32-bit environment (#111)Zong Li1-2/+2
Can't cast to pointer from 64 bit size integer directly on 32 bit environment.
2018-05-22RISC-V: Support separate firmware and kernel payloadMichael Clark3-0/+65
Support for separate firmware and kernel payload is added by updating BBL to read optional preloaded kernel address attributes from device-tree using a similar mechanism to that used to pass init ramdisk addresses to linux kernel. chosen { riscv,kernel-start = <0x00000000 0x80200000>; riscv,kernel-end = <0x00000000 0x80590634>; }; These attributes are added by QEMU and read by BBL when combining -bios <firmware-image> and -kernel <kernel-image> options. e.g. $ qemu-system-riscv64 -machine virt -bios bbl -kernel vmlinux With this change, bbl can be compiled without --with-payload and the dummy payload alignment is altered to make the memory footprint of the firmware-only bbl smaller. The dummy payload message is updated to indicate the alternative load method. This load method could also be supported by a first stage boot loader that reads seperate firmware and kernel from SPI flash. The main advantage of this new mechanism is that it eases kernel development by avoiding the riscv-pk packaging step after kernel builds, makes building per repository artefacts for CI simpler, and mimics bootloaders on other platforms that can load a kernel image file directly. Ultimately BBL should use an SPI driver to load the kernel image however this mechanism supports use cases such such as QEMU's -bios, -kernel and -initrd options following examples from other platforms that pass kernel entry to firmware via device-tree. Cc: Palmer Dabbelt <palmer@sifive.com> Cc: Alistair Francis <Alistair.Francis@wdc.com> Signed-off-by: Michael Clark <mjc@sifive.com>
2018-05-21machine,minit: initialize emulated FCSR in enter_supervisor_mode() (#106)Zihao Yu1-0/+4
* If BBL emulates the FPU, the trap handler will load emulated FCSR from x0's save slot into tp. The emulated FCSR should be initialized, else the field of rounding mode will contain garbage codes. This will lead to raising SIGABRT for a user mode program which tries to print a floating point variable. In glibc, __printf_fp_l() (defined in riscv-glibc/stdio-common/printf_fp.c) will call round_away() (defined in riscv-glibc/include/rounding-mode.h). With a garbage rounding mode in emulated FCSR, round_away() may call abort().
2018-05-15Fix for missing supervisor mode when running on E51 (#96)Jim Straus1-3/+10
The E51 core on the U54-MC lacks supervisor mode, thus the plic_s_ie and plic_s_thresh are NULL when running on this core. This adds checks for this case.
2018-05-09Correct the comment of timer interruptZong Li1-1/+1
2018-04-27Fix typo of perf counter (#100)Zong Li1-2/+2
2018-04-10SBI emulation of reads and writes to perf counters and config (#98)Alex Solomatnikov1-0/+58
2018-04-09Fix the wrong access of ipi pending address (#99)Zong Li1-2/+2
The MENTRY_IPI_PENDING_OFFSET offset is based on stack pointer
2018-03-20minit: insert printm as work-around for a race conditionWesley W. Terpstra1-0/+1
Reboot does not work reliably without this.
2018-03-05mtrap: add a halt IPI used for poweroff (#86)Wesley W. Terpstra3-11/+18
Otherwise, linux complains the moment an interrupt arrives and wakes up one of the not-looping cores.
2018-01-22mtrap: loop forever, reallyWesley W. Terpstra1-1/+1
gcc sometimes takes liberties with optimizing away our important halt function!
2018-01-22Boot on the first hartPalmer Dabbelt1-9/+2
This code is broken, and it's left over from before we could read the DTB to find harts to boot on.
2018-01-09Remove the repeating bitmask of medeleg register (#74)Zong Li1-1/+0
2017-12-16Merge pull request #73 from riscv/flush_icachePalmer Dabbelt2-0/+4
Add __riscv_flush_icache
2017-12-13Add __riscv_flush_icachePalmer Dabbelt2-0/+4
For BBL's purposes a local i-cache flush should be sufficient.
2017-12-12Add a 16550 UART driver to back the SBI consolePalmer Dabbelt5-0/+95
QEMU currently provides the console via HTIF and the SBI. That's a bit messy because BBL polls for serial input, which means that typing too quickly loses characters. While QEMU has a standard 16550 device model, there's no way to have two consoles share the console in QEMU (as they'd step all over each other) so that means we can't have both the HTIF console and the 16550 console. With this patch, QEMU can be changed to use a 16650 instead of the HTIF for serial output. Linux will use the SBI for early printk support (which is fine, polling for output is stable) and then swap over as soon as it detects the UART. When Linux swaps it prints out the whole history, but there's probably a way to get around that. There's a few lines that are output to both, but it appears the Linux driver is close enough to ours that nothing catastrophic happens -- there's not much to the device, so hopefully that pans out on real hardware too. Once Linux swaps over to natively using the driver we get reliable console input. If you don't have the in-kernel driver then Linux never swaps over and keeps using the SBI console just like before.