History log of /openbsd/sys/arch/riscv64/riscv64/machdep.c (Results 1 – 25 of 38)
Revision Date Author Comments
# 03901979 06-Apr-2024 kettenis <kettenis@openbsd.org>

Now that we support RISC-V CPUs that have MMUs with memory cachability
attributes, the "direct map" becomes problematic as it results in
mappings for the same physical memory pages with different cac

Now that we support RISC-V CPUs that have MMUs with memory cachability
attributes, the "direct map" becomes problematic as it results in
mappings for the same physical memory pages with different cachability
addresses. The RISC-V specification of the "Svpbmt" extension doesn't
outright state that this is "verboten" like on some other
architectures that we support. But it does say that it may result in
access with the wrong attributes. So restrict the use of the direct
map to just mapping the 64MB block that the bootloader loaded us into.
To make this possible map the device tree later like we do on arm64.
This allows us to get rid of some assembly code in locore.S as a bonus!

ok miod@, jca@

show more ...


# 462472fc 26-Mar-2024 kettenis <kettenis@openbsd.org>

The devicetree standard allows for multiple /memory nodes, each with
multiple memory ranges. We support the latter, but not the former.
Fix this, such that we detect all the memory on the Milk-V Pio

The devicetree standard allows for multiple /memory nodes, each with
multiple memory ranges. We support the latter, but not the former.
Fix this, such that we detect all the memory on the Milk-V Pioneer
board.

ok miod@

show more ...


# 46164c39 21-Feb-2024 dlg <dlg@openbsd.org>

revert r1.35

i dont know what i'm doing wrong with the handling of the no-map
property, but i'll find some coffee and time and figure it out soon
hopefully.


# aa73d722 21-Feb-2024 dlg <dlg@openbsd.org>

handle /reserved-memory nodes from device trees on arm64.

u-boot is supposed to take these entries and put them in the efi
memory map, but i keep hitting machines where an otherwise functional
u-boo

handle /reserved-memory nodes from device trees on arm64.

u-boot is supposed to take these entries and put them in the efi
memory map, but i keep hitting machines where an otherwise functional
u-boot does not do this, resulting in weird errors.

i have an espressobin with a vendor u-boot that has a reserved-memory
region for psci. without this diff the machine faults when the
kernel tries to reboot using a psci handler.

a macchiatobin with an otherwise working u-boot throws SErrors or
panics on weird memory corruption problems without this. i thought
it was bad RAM, but the problems persisted with completely different
ram, and very underclocked and well cooled ram.

riscv64 already has code to handle reserved-memory regions. the
riscv64 change is to add handling for the "no-map" property.

ok kettenis@

show more ...


# 84aa31c6 23-Jan-2024 kettenis <kettenis@openbsd.org>

T-Head implemented a page attribute extension that violates the RISC-V
specification. The default attributes result in memory being uncached
which makes the system perform like a slug. So implement

T-Head implemented a page attribute extension that violates the RISC-V
specification. The default attributes result in memory being uncached
which makes the system perform like a slug. So implement a workaround
that is designed to make implementation of the Svpbmt extension that is
part of the latest published RISC-V specification. This gets us a bit
further booting OpenBSD on an Allwinner D1 SoC.

ok mlarkin@, jca@

show more ...


# 0932d385 04-Dec-2023 claudio <claudio@openbsd.org>

Account for nkmempages as well in the pmap_growkernel() call during
initalisation. This way there is enough KVA mapped that kmeminit()
succeeds even with large nkmempages. This is similar to e.g. alp

Account for nkmempages as well in the pmap_growkernel() call during
initalisation. This way there is enough KVA mapped that kmeminit()
succeeds even with large nkmempages. This is similar to e.g. alpha.
OK miod@ kettenis@

show more ...


# dd3795d1 14-Aug-2023 miod <miod@openbsd.org>

Skip leading dash in kernel boot options instead of complaining it is an
unknown option character.


# 4711fcb1 05-Aug-2023 guenther <guenther@openbsd.org>

cpu_idle_{enter,leave} are no-ops on riscv64, so just #define
away the calls

ok jca@


# e7a57e0a 06-Dec-2022 jca <jca@openbsd.org>

Print SBI vendor, version and implemented spec version

On my Unmatched:

SBI: OpenSBI v0.9, SBI Specification Version 0.2

ok mlarkin@


# 1b4a394f 30-Oct-2022 guenther <guenther@openbsd.org>

Simplfity setregs() by passing it the ps_strings and switching
sys_execve() to return EJUSTRETURN.

setregs() is the MD routine used by sys_execve() to set up the
thread's trapframe and PCB such that

Simplfity setregs() by passing it the ps_strings and switching
sys_execve() to return EJUSTRETURN.

setregs() is the MD routine used by sys_execve() to set up the
thread's trapframe and PCB such that, on 'return' to userspace, it
has the register values defined by the ABI and otherwise zero. It
had to set the syscall retval[] values previously because the normal
syscall return path overwrites a couple registers with the retval[]
values. By instead returning EJUSTRETURN that and some complexity
with program-counter handling on m88k and sparc64 goes away.

Also, give setregs() add a 'struct ps_strings *arginfo' argument
so powerpc, powerpc64, and sh can directly get argc/argv/envp
values for registers instead of copyin()ing the one in userspace.

Improvements from miod@ and millert@
Testing assistance miod@, kettenis@, and aoyama@
ok miod@ kettenis@

show more ...


# 01ad66f9 03-Oct-2022 kettenis <kettenis@openbsd.org>

Reorganize the EFI code a bit. Move the efi.h header from dev/acpi to
dev/efi and rename the arm64 efi.c to efi_machdep.c, preparing the way
for MI EFI code and an amd64 implementation of EFI runtim

Reorganize the EFI code a bit. Move the efi.h header from dev/acpi to
dev/efi and rename the arm64 efi.c to efi_machdep.c, preparing the way
for MI EFI code and an amd64 implementation of EFI runtime support.

ok deraadt@, mlarkin@

show more ...


# 9326cac6 22-Mar-2022 miod <miod@openbsd.org>

Do not bother initializing a0 with a special value in setregs, that's a
FreeBSDism we have no need for.
ok jsg@


# 3e494340 14-Sep-2021 jca <jca@openbsd.org>

Provide instruction cache invalidation through sysarch(RISCV_ICACHE_SYNC)

Modelled after the arm implementation. The first consumer would be
__builtin___clear_cache() in libcompiler_rt.

Input from

Provide instruction cache invalidation through sysarch(RISCV_ICACHE_SYNC)

Modelled after the arm implementation. The first consumer would be
__builtin___clear_cache() in libcompiler_rt.

Input from kettenis@ and deraadt@, ok kettenis@

show more ...


# fb1b7c97 02-Jul-2021 kettenis <kettenis@openbsd.org>

Remove a few pointless comments.


# 19eb7a60 02-Jul-2021 kettenis <kettenis@openbsd.org>

Cleanup early bootstrap code. This mostly realigns the code with the
FreeBSD code from which it was derived. In particular, it uses the same
trick to switch page tables as FreeBSD, which is what we

Cleanup early bootstrap code. This mostly realigns the code with the
FreeBSD code from which it was derived. In particular, it uses the same
trick to switch page tables as FreeBSD, which is what we use to spin up
the secondary CPUs already. This avoids having to install a temporary
1:1 mapping.

ok mlarkin@

show more ...


# f2269f65 30-Jun-2021 kettenis <kettenis@openbsd.org>

Simplify the way we track the FPU state, using powerpc64 as a model.
The new code still uses the clean/dirty state that the hardware reports
to optimize saving/restoring the FPU register, but no long

Simplify the way we track the FPU state, using powerpc64 as a model.
The new code still uses the clean/dirty state that the hardware reports
to optimize saving/restoring the FPU register, but no longer attempts to
keep the FPU registers alive across a context switch. Fixes panics seen
on MP kernels.

ok drahn@

show more ...


# a6dedbf6 21-Jun-2021 kettenis <kettenis@openbsd.org>

Change tb_freq to uint64_t. This prevents an overflow in the riscv64
implementation of delay(9).

ok deraadt@


# 36fde14f 18-Jun-2021 kettenis <kettenis@openbsd.org>

When we do a context switch, always set the FPU to "off" for the old proc.
Disable the optimization to mark the new proc "clean" since it causes
random failures in regress. Hopefully we can revisit

When we do a context switch, always set the FPU to "off" for the old proc.
Disable the optimization to mark the new proc "clean" since it causes
random failures in regress. Hopefully we can revisit this soon.

ok drahn@

show more ...


# 2d87e9ee 13-Jun-2021 kettenis <kettenis@openbsd.org>

Add support for sfuart(4) as a console.

ok drahn@


# 3d760e7f 20-May-2021 drahn <drahn@openbsd.org>

Significant overhaul of the floating point save/restore code.
At this point the mechanism should closely resemble the powerpc64
save/restore points with one difference. (reload avoidance)
The previou

Significant overhaul of the floating point save/restore code.
At this point the mechanism should closely resemble the powerpc64
save/restore points with one difference. (reload avoidance)
The previous 'aggressive' fpu save code that was (mostly) implemented before
and is present on arm32 and arm64.

There is one piece from that other design that remains, if
pcb->pcb_fpcpu == ci && ci->ci_fpuproc == p
after sleep, this will automatically re-activate the FPU state without
needing to reload it.
To enable this, the pointer pair is not changed on FPU context save
to indicate that the CPU still holds the valid content as long as both
of those pointers are pointing to each other.
Note that if another core steals the FPU conxtex (when we get to SMP)
the pcb->pcb_fpcpu will be another cpu, and from that it will know
to reload the FPU context. Also optimistically enabling this only makes
sense on riscv64 because there is the notion of FPU on and clean. Other
implimentations would need to 'fault on' the FPU enable, but could avoid
the FPU context load if no other processor has run this FPU context and no
other process has use FPU on this core.

ok kettenis@ deraadt@ Prior to a couple of fixes.

show more ...


# bf89b30c 19-May-2021 kettenis <kettenis@openbsd.org>

Get rid of the do-nothing cache setup code. The RISC-V architecture has
no architecturally defined caches (yet) so there is nothing to set up here.
Gets rid of some more useless XXX.


# c9fd0cd6 16-May-2021 kettenis <kettenis@openbsd.org>

Sync memreg_add() implementation with arm64 and powerpc64.


# 1e64a2f2 14-May-2021 jsg <jsg@openbsd.org>

remove uneeded includes


# 285e3455 13-May-2021 kettenis <kettenis@openbsd.org>

Use intr_enable()/int_disable()/intr_restore() instead of
enable_interrupts()/disable_interrupts()/restore_interrupts() and remove
the latter interfaces.

ok mlarkin@, drahn@


# 380aa7b9 12-May-2021 jsg <jsg@openbsd.org>

add OpenBSD rcs ids


12