aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv/riscv
Commit message (Collapse)AuthorAgeFilesLines
* riscv: Fix PLIC -Wunused-but-set-variable warningsJessica Clarke2021-12-101-6/+0
|
* busdma: Remove outdated comments about Giant.Alexander Motin2021-12-101-3/+1
| | | | MFC after: 2 weeks
* netinet: Deduplicate most in_cksum() implementationsMark Johnston2021-11-241-243/+0
| | | | | | | | | | | | | | | | | | | in_cksum() and related routines are implemented separately for each platform, but only i386 and arm have optimized versions. Other platforms' copies of in_cksum.c are identical except for style differences and support for big-endian CPUs. Deduplicate the implementations for the rest of the platforms. This will make it easier to implement in_cksum() for unmapped mbufs. On arm and i386, define HAVE_MD_IN_CKSUM to mean that the MI implementation is not to be compiled. No functional change intended. Reviewed by: kp, glebius MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33095
* minidump: Use the provided dump bitsetMitchell Horne2021-11-191-5/+7
| | | | | | | | | | | | | | | | | When constructing the set of dumpable pages, use the bitset provided by the state argument, rather than assuming vm_page_dump invariably. For normal kernel minidumps this will be a pointer to vm_page_dump, but when dumping the live system it will not. To do this, the functions in vm_dumpset.h are extended to accept the desired bitset as an argument. Note that this provided bitset is assumed to be derived from vm_page_dump, and therefore has the same size. Reviewed by: kib, markj, jhb MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31992
* minidump: Use provided msgbuf pointerMitchell Horne2021-11-191-4/+5
| | | | | | | | | | | | Don't assume we are dumping the global message buffer, but use the one provided by the state argument. While here, drop superfluous cast to char *. Reviewed by: markj, jhb MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31991
* minidump: reduce the amount direct accesses to page tablesMitchell Horne2021-11-191-18/+40
| | | | | | | | | | | | | | | | | | | | | | | During a live dump, we may race with updates to the kernel page tables. This is generally okay; we accept that the state of the system while dumping may be somewhat inconsistent with its state when the dump was invoked. However, when walking the kernel page tables, it is important that we load each PDE/PTE only once while operating on it. Otherwise, it is possible to have the relevant PTE change underneath us. For example, after checking the valid bit, but before reading the physical address. Convert the loads to atomics, and add some validation around the physical addresses, to ensure that we do not try to dump a non-existent or non-canonical physical address. Similarly, don't read kernel_vm_end more than once, on the off chance that pmap_growkernel() is called between the two page table walks. Reviewed by: kib, markj MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31990
* minidump: Parameterize minidumpsys()Mitchell Horne2021-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The minidump code is written assuming that certain global state will not change, and rightly so, since it executes from a kernel debugger context. In order to support taking minidumps of a live system, we should allow copies of relevant global state that is likely to change to be passed as parameters to the minidumpsys() function. This patch does the work of parameterizing this function, by adding a struct minidumpstate argument. For now, this struct allows for copies of the kernel message buffer, and the bitset that tracks which pages should be dumped (vm_page_dump). Follow-up changes will actually make use of these arguments. Notably, dump_avail[] does not need a snapshot, since it is not expected to change after system initialization. The existing minidumpsys() definitions are renamed, and a thin MI wrapper is added to kern_dump.c, which handles the construction of the state struct. Thus, calling minidumpsys() remains as simple as before. Reviewed by: kib, markj, jhb Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D31989
* sched: split sched_ap_entry() out of sched_throw()Kyle Evans2021-11-051-1/+1
| | | | | | | | | sched_throw() can no longer take a NULL thread, APs enter through sched_ap_entry() instead. This completely removes branching in the common case and cleans up both paths. No functional change intended. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D32829
* sched: separate out schedinit_ap()Kyle Evans2021-11-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | schedinit_ap() sets up an AP for a later call to sched_throw(NULL). Currently, ULE sets up some pcpu bits and fixes the idlethread lock with a call to sched_throw(NULL); this results in a window where curthread is setup in platforms' init_secondary(), but it has the wrong td_lock. Typical platform AP startup procedure looks something like: - Setup curthread - ... other stuff, including cpu_initclocks_ap() - Signal smp_started - sched_throw(NULL) to enter the scheduler cpu_initclocks_ap() may have callouts to process (e.g., nvme) and attempt to sched_add() for this AP, but this attempt fails because of the noted violated assumption leading to locking heartburn in sched_setpreempt(). Interrupts are still disabled until cpu_throw() so we're not really at risk of being preempted -- just let the scheduler in on it a little earlier as part of setting up curthread. Reviewed by: alfredo, kib, markj Triage help from: andrew, markj Smoke-tested by: alfredo (ppc), kevans (arm64, x86), mhorne (arm) Differential Revision: https://reviews.freebsd.org/D32797
* Convert consumers to vm_page_alloc_noobj_contig()Mark Johnston2021-10-201-2/+0
| | | | | | | | | Remove now-unneeded page zeroing. No functional change intended. Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32006
* Convert vm_page_alloc() callers to use vm_page_alloc_noobj().Mark Johnston2021-10-202-38/+20
| | | | | | | | | | | | | | | Remove page zeroing code from consumers and stop specifying VM_ALLOC_NOOBJ. In a few places, also convert an allocation loop to simply use VM_ALLOC_WAITOK. Similarly, convert vm_page_alloc_domain() callers. Note that callers are now responsible for assigning the pindex. Reviewed by: alc, hselasky, kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31986
* riscv: Implement pmap_mapdev_attrJessica Clarke2021-10-171-1/+7
| | | | | | | | | | | | This is needed for LinuxKPI's _ioremap_attr. This reuses the generic implementation introduced for aarch64, and itself requires implementing pmap_kenter, which is trivial to do given riscv currently treats all mapping attributes the same due to the Svpbmt extension not yet being ratified and in hardware. Reviewed by: markj, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D32445
* arm, arm64, riscv: adjust top-level nexus commentMitchell Horne2021-10-081-3/+1
| | | | | | | | | | These platforms don't manage resources for DMA request lines or I/O ports, this is specific to x86. Remove the references from the comments. Reviewed by: imp, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32358
* riscv: move signal delivery code to exec_machdep.cKonstantin Belousov2021-10-083-383/+513
| | | | | | | | Reviewed by: emaste, imp Discussed with: jrtc27 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D32310
* riscv: fix VM_MAXUSER_ADDRESS checks in asm routinesMitchell Horne2021-10-072-13/+13
| | | | | | | | | | | | | | | | There are two issues with the checks against VM_MAXUSER_ADDRESS. First, the comparison should consider the values as unsigned, otherwise addresses with the high bit set will fail to branch. Second, the value of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum mappable user address and invalid itself. Thus, use the bgeu instruction for these comparisons. Add a regression test case for copyin(9). PR: 257193 Reported by: Robert Morris <rtm@lcs.mit.edu> Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D31209
* riscv: handle page faults in the unmappable regionMitchell Horne2021-10-072-0/+10
| | | | | | | | | | | | | | | | | | | | | | | When handling a kernel page fault, check explicitly that stval resides in either the user or kernel address spaces, and make the page fault fatal if not. Otherwise, a properly crafted address may appear to pmap_fault() as a valid and present page in the kernel map, causing the page fault to be retried continuously. This is mainly due to the fact that the upper bits of virtual addresses are not validated by most of the pmap code. Faults of this nature should only occur due to some kind of bug in the kernel, but it is best to handle them gracefully when they do. Handle user page faults in the same way, sending a SIGSEGV immediately when a malformed address is encountered. Add an assertion to pmap_l1(), which should help catch other bugs of this kind that make it this far. Reviewed by: jrtc27, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31208
* riscv: Add a stub pmap_change_attr implementationJessica Clarke2021-10-031-0/+94
| | | | | | | | | | | | | | pmap_change_attr is required by drm-kmod so we need the function to exist. Since the Svpbmt extension is on the horizon we will likely end up with a real implementation of it, so this stub implementation does all the necessary page table walking to validate the input, ensuring that no new errors are returned once it's implemented fully (other than due to out of memory conditions when demoting L2 entries) and providing a skeleton for that future implementation. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31996
* minidump: De-duplicate the progress barMitchell Horne2021-09-291-43/+3
| | | | | | | | | | | | | The implementation of the progress bar is simple, but duplicated for most minidump implementations. Extract the common bits to kern_dump.c. Ensure that the bar is reset with each subsequent dump; this was only done on some platforms previously. Reviewed by: markj MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31885
* minidump: De-duplicate is_dumpable()Mitchell Horne2021-09-292-19/+4
| | | | | | | | | | | | The function is identical in each minidump implementation, so move it to vm_phys.c. The only slight exception is powerpc where the function was public, for use in moea64_scan_pmap(). Reviewed by: kib, markj, imp (earlier version) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31884
* Create sys/reg.h for the common code previously in machine/reg.hAndrew Turner2021-08-301-1/+1
| | | | | | | | | | Move the common kernel function signatures from machine/reg.h to a new sys/reg.h. This is in preperation for adding PT_GETREGSET to ptrace(2). Reviewed by: imp, markj Sponsored by: DARPA, AFRL (original work) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19830
* riscv: retire bzeroMateusz Guzik2021-08-231-11/+0
| | | | | | | | Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") Reviewed by: mhorne Sponsored by: Rubicon Communications, LLC ("Netgate")
* riscv: Fix pmap_alloc_l2 when it should allocate a new L1 entryJessica Clarke2021-08-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current code checks the RWX bits are 0 but does not check the V bit is non-zero, meaning not-yet-allocated L1 entries that are still zero are regarded as being allocated. This is likely due to copying the arm64 code that checks ATTR_DESC_MASK is L1_TABLE, which emcompasses both the type and the validity in a single field, and erroneously translating that to a check of just PTE_RWX being 0 to indicate non-leaf, forgetting about the V bit. This then results in the following panic: panic: Fatal page fault at 0xffffffc0005cf292: 0x00000000000050 cpuid = 1 time = 1628379581 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x38 kdb_backtrace() at kdb_backtrace+0x2c vpanic() at vpanic+0x148 panic() at panic+0x2a page_fault_handler() at page_fault_handler+0x1ba do_trap_supervisor() at do_trap_supervisor+0x7a cpu_exception_handler_supervisor() at cpu_exception_handler_supervisor+0x70 --- exception 13, tval = 0x50 pmap_enter_l2() at pmap_enter_l2+0xb2 pmap_enter_object() at pmap_enter_object+0x15e vm_map_pmap_enter() at vm_map_pmap_enter+0x228 vm_map_insert() at vm_map_insert+0x4ec vm_map_find() at vm_map_find+0x474 vm_map_find_min() at vm_map_find_min+0x52 vm_mmap_object() at vm_mmap_object+0x1ba vn_mmap() at vn_mmap+0xf8 kern_mmap() at kern_mmap+0x4c4 sys_mmap() at sys_mmap+0x38 do_trap_user() at do_trap_user+0x208 cpu_exception_handler_user() at cpu_exception_handler_user+0x72 --- exception 8, tval = 0x1dd Instead, we should just check the V bit, as on amd64, and assert that any valid L1 entries are not leaves, since an L1 leaf would render the entire range allocated and thus we should not have attempted to map that VA in the first place. Reported by: David Gilbert <dgilbert@daveg.ca> MFC after: 1 week Reviewed by: markj, mhorne Differential Revision: https://reviews.freebsd.org/D31460
* Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsEd Maste2021-08-081-1/+0
| | | | | | | These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
* riscv: Fix pmap_kextract racing with concurrent superpage promotion/demotionJessica Clarke2021-07-221-4/+13
| | | | | | | | | | | | | This repeats amd64's cfcbf8c6fd3b (r180498) and i386's cf3508519c5e (r202894) but for riscv; pmap_kextract must be lock-free and so it can race with superpage promotion and demotion, thus the L2 entry must only be loaded once to avoid using inconsistent state. PR: 250866 Reviewed by: markj, mhorne Tested by: David Gilbert <dgilbert@daveg.ca> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31253
* riscv: Fix pindex level confusionJessica Clarke2021-07-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The pindex values are assigned from the L3 leaves upwards, meaning there are NUL2E L3 tables and then NUL1E L2 tables (with a futher NUL0E L1 tables in future when we implement Sv48 support). Therefore anything below NUL2E is an L3 table's page and anything above or equal to NUL2E is an L2 table's page (with the threshold of NUL2E + NUL1E marking the start of the L1 tables' pages in Sv48). Thus all the comparisons and arithmetic operations must use NUL2E to handle the L3/L2 allocation (and thus L2/L1 entry) transition point, not NUL1E as all but pmap_alloc_l2 were doing. To make matters confusing, the NUL1E and NUL2E definitions in the RISC-V pmap are based on a 4-level page hierarchy but we currently use the 3-level Sv39 format (as that's the only required one, and hardware support for the 4-level Sv48 is not widespread). This means that, in effect, the above bug cancels out with the bloated NULxE definitions such that things "work" (but are still technically wrong, and thus would break when adding Sv48 support), with one exception. pmap_enter_l2 is currently the only function to use the correct constant, but since _pmap_alloc_l3 uses the incorrect constant, it will do complete nonsense when it needs to allocate a new L2 table (which is rather rare). In this instance, _pmap_alloc_l3, whilst it would correctly determine the pindex was for an L2 table, would only subtract NUL1E when computing l1index and thus go way out of bounds (by 511*512*512 bytes, or 127.75 GiB) of its own L1 table and, thanks to pmap_distribute_l1, of every other pmap's L1 table in the whole system. This has likely never been hit as it would presumably instantly fault and panic. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31087
* riscv: Implement missing nexus methodsJessica Clarke2021-07-211-19/+97
| | | | | | | | | | This is required for the SiFive FU740's PCIe controller. Copied from arm64 with the only difference being changing pmap_mapdev_attr to pmap_mapdev as riscv only has the latter. Reviewed by: mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31032
* Pass the syscall number to capsicum permission-denied signalsDavid Chisnall2021-07-161-0/+1
| | | | | | | | | | | | | | | | | | The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. This reapplies 3a522ba1bc852c3d4660a4fa32e4a94999d09a47 with a fix for the static assertion failure on i386. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185
* Assert that valid PTEs are not overwritten when installing a new PTPMark Johnston2021-07-151-0/+4
| | | | | | | | | | amd64 and 32-bit ARM already had assertions to this effect. Add them to other pmaps. Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D31171
* Revert "Pass the syscall number to capsicum permission-denied signals"David Chisnall2021-07-101-1/+0
| | | | | | This broke the i386 build. This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47.
* Pass the syscall number to capsicum permission-denied signalsDavid Chisnall2021-07-101-0/+1
| | | | | | | | | | | | | | | The syscall number is stored in the same register as the syscall return on amd64 (and possibly other architectures) and so it is impossible to recover in the signal handler after the call has returned. This small tweak delivers it in the `si_value` field of the signal, which is sufficient to catch capability violations and emulate them with a call to a more-privileged process in the signal handler. Approved by: markj (mentor) Reviewed by: kib, bcr (manpages) Differential Revision: https://reviews.freebsd.org/D29185
* Do not call FreeBSD-ABI specific code for all ABIsKonstantin Belousov2021-07-071-0/+2
| | | | | | | | | | | | Use sysentvec hooks to only call umtx_thread_exit/umtx_exec, which handle robust mutexes, for native FreeBSD ABI. Similarly, there is no sense in calling sigfastblock_clear() for non-native ABIs. Requested by: dchagin Reviewed by: dchagin, markj (previous version) Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30987
* riscv: Implement non-stub __vdso_gettc and __vdso_gettimekeepJessica Clarke2021-07-052-2/+16
| | | | | | | PR: 256905 Reviewed by: arichardson, mhorne MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D30963
* Add infrastructure required for Linux coredump supportEdward Tomasz Napierala2021-06-291-0/+3
| | | | | | | | | | | | | | | | This adds `sv_elf_core_osabi`, `sv_elf_core_abi_vendor`, and `sv_elf_core_prepare_notes` fields to `struct sysentvec`, and modifies imgact_elf.c to make use of them instead of hardcoding FreeBSD-specific values. It also updates all of the ABI definitions to preserve current behaviour. This makes it possible to implement non-native ELF coredump support without unnecessary code duplication. It will be used for Linux coredumps. Reviewed By: kib Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D30921
* riscv: Add an hw.ncpu tunable to limit the number of coresJessica Clarke2021-06-151-7/+14
| | | | | | | | Based on a similar change to arm64 in 01a8235ea61c. Reviewed by: mhorne MRC after: 1 week Differential Revision: https://reviews.freebsd.org/D30655
* riscv: Rename pmap_fault_fixup() to pmap_fault()Mark Johnston2021-06-062-2/+2
| | | | | | | | | | This is consistent with other platforms, specifically arm and arm64. No functional change intended. Reviewed by: jrtc27 MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30645
* riscv: Handle hardware-managed dirty bit updates in pmap_promote_l2()Mark Johnston2021-06-061-9/+32
| | | | | | | | | | | | | | | | | | | pmap_promote_l2() failed to handle implementations which set the accessed and dirty flags. In particular, when comparing the attributes of a run of 512 PTEs, we must handle the possibility that the hardware will set PTE_D on a clean, writable mapping. Following the example of amd64 and arm64, change riscv's pmap_promote_l2() to downgrade clean, writable mappings to read-only, so that updates are synchronized by the pmap lock. Fixes: f6893f09d Reported by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> Tested by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> Reviewed by: jrtc27, alc, Nathaniel Filardo MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30644
* arm64, riscv: remove reference to fsu_intr_faultMitchell Horne2021-05-251-2/+0
| | | | | | This variable no longer exists. MFC after: 3 days
* riscv: Remove old qemu compatibility codeBrandon Bergren2021-04-271-112/+0
| | | | | | | | | | | | | | During early qemu development, the /soc node was marked as compatible with "riscv-virtio-soc" instead of "simple-bus". This was changed in qemu 53f54508dae6 in Sep 2018, and predates the baseline required qemu version (5.0) for riscv by a wide margin. The generic simplebus code handles attachment in all cases nowadays. Sponsored by: Tag1 Consulting, Inc. Reviewed by: jrtc27, mhorne Differential Revision: https://reviews.freebsd.org/D30011
* riscv: Assert that SUM is not set in SSTATUS for exceptions.John Baldwin2021-04-211-0/+6
| | | | | | Reviewed by: mhorne Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29764
* riscv: Clear SUM in SSTATUS for supervisor mode exceptions.John Baldwin2021-04-211-0/+5
| | | | | | | | | | | | | | | Previously, a page fault taken during copyin/out and related functions would run the entire fault handler while permitting direct access to user addresses. This could also leak across context switches (e.g. if the page fault handler was preempted by an interrupt or slept for disk I/O). To fix, clear SUM in assembly after saving the original version of SSTATUS in the supervisor mode trapframe. Reviewed by: mhorne, jrtc27 Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D29763
* ddb: replace watchpoint set/clear functionsMitchell Horne2021-03-291-14/+0
| | | | | | | | | | Use the new kdb variants. Print more specific error messages. Reviewed by: jhb, markj MFC after: 3 weeks Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D29156
* Add a VA_IS_CLEANMAP() macro.John Baldwin2021-02-181-1/+1
| | | | | | | | | | | | | | This macro returns true if a provided virtual address is contained in the kernel's clean submap. In CHERI kernels, the buffer cache and transient I/O map are allocated as separate regions. Abstracting this check reduces the diff relative to FreeBSD. It is perhaps slightly more readable as well. Reviewed by: kib Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D28710
* riscv: add SBI system reset extensionDanjel Qyteza2021-01-272-4/+18
| | | | | | | | | | | | | The System Reset extension provides functions to shutdown or reboot the system via SBI firmware. This newly defined extension supersedes the functionality of the legacy shutdown extension. Update the SBI code to use the new System Reset extension when available, and fall back to the legacy one. Reviewed By: kp, jhb MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D28226
* riscv: style(9) nits in sbi.cMitchell Horne2021-01-271-5/+9
| | | | Wrap a few lines at 80 columns, which were overlooked in recent commits.
* riscv pmap: add some pv list assertionsmhorne2021-01-121-5/+13
| | | | | | | | | | | | Ensure that we don't end up with a superpage in the vm_page_t's pv list. This may help with debugging the panic reported in PR 250866, in which l3 in pmap_remove_write() was found to be NULL. Adding a KASSERT to this function will help narrow down the cause of this panic the next time it occurs. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D28109
* Skip the vm.pmap.kernel_maps sysctl by default.John Baldwin2020-12-181-1/+1
| | | | | | | | | | | This sysctl node can generate very verbose output, so don't trigger it for sysctl -a or sysctl vm.pmap. Reviewed by: markj, kib Differential Revision: https://reviews.freebsd.org/D27504 Notes: svn path=/head/; revision=368768
* riscv: report additional known SBI implementationsMitchell Horne2020-12-181-0/+12
| | | | | | | | | | | | These implementation IDs are defined in the SBI spec, so we should print their name if detected. Submitted by: Danjel Qyteza <danq1222@gmail.com> Reviewed by: jhb, kp Differential Revision: https://reviews.freebsd.org/D27660 Notes: svn path=/head/; revision=368767
* riscv: handle debug.debugger_on_trap for fatal page faultsMitchell Horne2020-12-101-0/+12
| | | | | | | | | | | Allows recovery or diagnosis of a fatal page fault before panicking the system. Reviewed by: jhb, kp Differential Revision: https://reviews.freebsd.org/D27534 Notes: svn path=/head/; revision=368527
* Stack unwinding robustness fixes for RISC-V.John Baldwin2020-12-083-12/+16
| | | | | | | | | | | | | | | | - Push the kstack_contains check down into unwind_frame() so that it is honored by DDB and DTrace. - Check that the trapframe for an exception frame is contained in the traced thread's kernel stack for DDB traces. Reviewed by: markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27357 Notes: svn path=/head/; revision=368454
* Add a kstack_contains() helper function.John Baldwin2020-12-011-3/+2
| | | | | | | | | | | | | This is useful for stack unwinders which need to avoid out-of-bounds reads of a kernel stack which can trigger kernel faults. Reviewed by: kib, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27356 Notes: svn path=/head/; revision=368240