summaryrefslogtreecommitdiff
path: root/sys/mips
AgeCommit message (Collapse)Author
2021-12-30Remove discarded mips source.Doug Moore
2021-12-30vm_extern: use standard address checkers everywhereDoug Moore
Define simple functions for alignment and boundary checks and use them everywhere instead of having slightly different implementations scattered about. Define them in vm_extern.h and use them where possible where vm_extern.h is included. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D33685
2021-12-30mips: Remove sys/mipsWarner Losh
Remove sys/mips as the next step of decomissioning mips from the tree. Remove mips special cases from the kernel make files. Remove the mips specific linker scripts. Sponsored by: Netflix
2021-12-28Simplify swi for bus_dma.John Baldwin
When a DMA request using bounce pages completes, a swi is triggered to schedule pending DMA requests using the just-freed bounce pages. For a long time this bus_dma swi has been tied to a "virtual memory" swi (swi_vm). However, all of the swi_vm implementations are the same and consist of checking a flag (busdma_swi_pending) which is always true and if set calling busdma_swi. I suspect this dates back to the pre-SMPng days and that the intention was for swi_vm to serve as a mux. However, in the current scheme there's no need for the mux. Instead, remove swi_vm and vm_ih. Each bus_dma implementation that uses bounce pages is responsible for creating its own swi (busdma_ih) which it now schedules directly. This swi invokes busdma_swi directly removing the need for busdma_swi_pending. One consequence is that the swi now works on RISC-V which had previously failed to invoke busdma_swi from swi_vm. Reviewed by: imp, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D33447
2021-12-19mips: Implement suword16Jessica Clarke
This fixes building USB-using kernels after 0ec590d24e41. Fixes: 0ec590d24e41 ("usb: add 32-bit compat for FIFOs")
2021-12-09busdma: Remove outdated comments about Giant.Alexander Motin
MFC after: 2 weeks
2021-12-09Add <machine/tls.h> header to hold MD constants and helpers for TLS.John Baldwin
The header exports the following: - Definition of struct tcb. - Helpers to get/set the tcb for the current thread. - TLS_TCB_SIZE (size of TCB) - TLS_TCB_ALIGN (alignment of TCB) - TLS_VARIANT_I or TLS_VARIANT_II - TLS_DTV_OFFSET (bias of pointers in dtv[]) - TLS_TP_OFFSET (bias of "thread pointer" relative to TCB) Note that TLS_TP_OFFSET does not account for if the unbiased thread pointer points to the start of the TCB (arm and x86) or the end of the TCB (MIPS, PowerPC, and RISC-V). Note also that for amd64, the struct tcb does not include the unused tcb_spare field included in the current structure in libthr. libthr does not use this field, and the existing calls in libc and rtld that allocate a TCB for amd64 assume it is the size of 3 Elf_Addr's (and thus do not allocate room for tcb_spare). A <sys/_tls_variant_i.h> header is used by architectures using Variant I TLS which uses a common struct tcb. Reviewed by: kib (older version of x86/tls.h), jrtc27 Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33351
2021-12-09mips: Rename TLS_DTP_OFFSET to TLS_DTV_OFFSET.John Baldwin
This is the more standard name for the bias of dtv pointers used on other platforms. This also fixes a few other places that were using the wrong bias previously on MIPS such as dlpi_tls_data in struct dl_phdr_info and the recently added __libc_tls_get_addr(). Reviewed by: kib, jrtc27 Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33346
2021-12-08Make struct syscall_args machine independentBrooks Davis
After a round of cleanups in late 2020, all definitions are functionally identical. This removes a rotted __aligned(8) on arm. It was added in b7112ead32bc50ef9744099bdbb1cfbd6e906b2a and was intended to align the args member so that 64-bit types (off_t, etc) could be safely read on armeb compiled with clang. With the removal of armev, this is no longer needed (armv7 requires that 32-bit aligned reads of 64-bit values be supported and we enable such support on armv6). As further evidence this is unnecessary, cleanups to struct syscall_args have resulted in args being 32-bit aligned on 32-bit systems. The sole effect is to bloat the struct by 4 bytes. Reviewed by: kib, jhb, imp Differential Revision: https://reviews.freebsd.org/D33308
2021-11-30Implement GET_STACK_USAGE on remaining archsMitchell Horne
This definition enables callers to estimate remaining space on the kstack, and take action on it. Notably, it enables optimizations in the GEOM and netgraph subsystems to directly dispatch work items when there is sufficient stack space, rather than queuing them for a worker thread. Implement it for riscv, arm, and mips. Remove the #ifdefs, so it will not go unimplemented elsewhere. PR: 259157 Reviewed by: mav, kib, markj (previous version) MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32580
2021-11-30mips: Fix a typo in a source code commentGordon Bergling
- s/segement/segment/ MFC after: 3 days
2021-11-24netinet: Deduplicate most in_cksum() implementationsMark Johnston
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
2021-11-24netinet: Remove in_cksum_update()Mark Johnston
It was never implemented on powerpc or riscv and appears to have been unused since it was added in 1998. No functional change intended. Reviewed by: kp, glebius, cy MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33093
2021-11-19Allow minidumps to be performed on the live systemMitchell Horne
Add a boolean parameter to minidumpsys(), to indicate a live dump. When requested, take a snapshot of important global state, and pass this to the machine-dependent minidump function. For now this includes the kernel message buffer, and the bitset of pages to be dumped. Beyond this, we don't take much action to protect the integrity of the dump from changes in the running system. A new function msgbuf_duplicate() is added for snapshotting the message buffer. msgbuf_copy() is insufficient for this purpose since it marks any new characters it finds as read. For now, nothing can actually trigger a live minidump. A future patch will add the mechanism for this. For simplicity and safety, live dumps are disallowed for mips. Reviewed by: markj, jhb MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D31993
2021-11-19minidump: Use the provided dump bitsetMitchell Horne
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
2021-11-19minidump: Use provided msgbuf pointerMitchell Horne
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
2021-11-19minidump: Parameterize minidumpsys()Mitchell Horne
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
2021-11-17Add a COMPAT_FREEBSD13 kernel optionKristof Provost
Use it wherever COMPAT_FREEBSD11 is currently specified. Reviewed by: jhb (previous version) Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33005
2021-11-12tcp: better congestion control defaultsWarner Losh
Define CC_NEWRENO in all the appropriate DEFAULTS and std.* config files. It's the default congestion control algorithm. Add code to cc.c so that CC_DEFAULT is "newreno" if it's not overriden in the config file. Sponsored by: Netflix Fixes: b8d60729deef ("tcp: Congestion control cleanup.") Revired by: manu, hselasky, jhb, glebius, tuexen Differential Revision: https://reviews.freebsd.org/D32964
2021-11-05sched: split sched_ap_entry() out of sched_throw()Kyle Evans
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
2021-11-03sched: separate out schedinit_ap()Kyle Evans
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
2021-10-19Convert vm_page_alloc() callers to use vm_page_alloc_noobj().Mark Johnston
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
2021-09-29minidump: De-duplicate the progress barMitchell Horne
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
2021-09-29minidump: De-duplicate is_dumpable()Mitchell Horne
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
2021-09-04Fix a common typo in source code commentsGordon Bergling
- s/existant/existent/ MFC after: 3 days
2021-08-30Create sys/reg.h for the common code previously in machine/reg.hAndrew Turner
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
2021-08-24mips: retire ovbcopyMateusz Guzik
ovbcopy is unused since 9f45b2da8fa08638 ("Define ovbcopy() as a macro which expands to the equivalent bcopy() call") bcopy is left in place because it is used by assembly primitives Sponsored by: Rubicon Communications, LLC ("Netgate")
2021-08-23mips: retire bzeroMateusz Guzik
Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") Sponsored by: Rubicon Communications, LLC ("Netgate")
2021-08-23mips: retire bcmpMateusz Guzik
Unused since ba96f37758412151 ("Use __builtin for various mem* and b* (e.g. bzero) routines.") Sponsored by: Rubicon Communications, LLC ("Netgate")
2021-08-14Fix a common typo in source code commentsGordon Bergling
- s/definitons/definitions/ MFC after: 5 days
2021-08-08Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrightsEd Maste
These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
2021-07-31Add pmap_vm_page_alloc_check()Konstantin Belousov
which is the place to put MD asserts about allocated pages. On amd64, verify that allocated page does not belong to the kernel (text, data) or early allocated pages. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31121
2021-07-16Pass the syscall number to capsicum permission-denied signalsDavid Chisnall
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
2021-07-15Assert that valid PTEs are not overwritten when installing a new PTPMark Johnston
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
2021-07-13pccard: remove pccard device from all kernelsWarner Losh
All the PC Card drivers have been removed from the tree. Remove the pccard drivers from all the kernels. Sponsored by: Netflix
2021-07-10Revert "Pass the syscall number to capsicum permission-denied signals"David Chisnall
This broke the i386 build. This reverts commit 3a522ba1bc852c3d4660a4fa32e4a94999d09a47.
2021-07-10Pass the syscall number to capsicum permission-denied signalsDavid Chisnall
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
2021-07-07Do not call FreeBSD-ABI specific code for all ABIsKonstantin Belousov
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
2021-06-29Add infrastructure required for Linux coredump supportEdward Tomasz Napierala
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
2021-06-16Move mips and arm to 1000Hz by default.Warner Losh
armv6 and armv7 systems already were 1000Hz. The other armv5 were a mix of 100 and 1000. This changes them to 1000. Should there be issues, we can add options HZ=100 to the systems that have bad performance at the drop of a hat. mips is a lot more complicated. But most of the systems are already 1000HZ. The hardware exceptions are all fast enough to run at 1000Hz. MALTA is our primary emulator, and history has shown emulators tend to like 100Hz better, so run those systems at 100Hz. As with arm, any system that shows a huge performance regression can reverted to 100Hz easily. This was going to be committed well in advance of the 13 branch, but it was delayed and forgotten til now. Discussed on: #bsdmips ages ago Sponsored by: Netflix
2021-06-14Reduce code duplication in machine/_types.hAlex Richardson
Many of these typedefs are the same across all architectures or can be set based on an architecture-independent compiler-provided macro (e.g. __SIZEOF_SIZE_T__). These macros have been available since GCC 4.6 and Clang sometime before 3.0 (godbolt.org does not have any older clang versions installed). I originally considered using the compiler-provided `__FOO_TYPE__` directly. However, in order to do so we have to check that those match the previous typedef exactly (not just that they have the same size) since any change would be an ABI break. For example, changing `long` to `long long` results in different C++ name mangling. Additionally, Clang and GCC disagree on the underlying type for some of (u)int*_fast_t types, so this change only moves the definitions that are identical across all architectures and does not touch those types. This de-deduplication will allow us to have a smaller diff downstream in CheriBSD: we only have to only change the (u)intptr_t definition in sys/_types.h in CheriBSD instead of having to change machine/_types.h for all CHERI-enabled architectures (currently RISC-V, AArch64 and MIPS). Reviewed By: imp, kib Differential Revision: https://reviews.freebsd.org/D29895
2021-06-11mtk: Add printing of CPU modelWarner Losh
Add the line that's in other foo_machdep.c file where the CPU model is reported. This was part of github pull request 459, but in a different way. The rest of that pull request was either committed or not relevant. I did it in a more correct way. Submitted by: Priit Trees Sponsored by: Netflix
2021-06-11mtk: Initialize mask correctly.Priit Trees
Initialization of mask is missing. Fixes a compile issue. Reviewed by: imp@ Pull Request: https://github.com/freebsd/freebsd-src/pull/459
2021-05-28[mips/broadcom] set sysctl "hw.model" by SoC ChipCommon IDMichael Zhilin
Small patch to set "hw.model" by SoC ChipCommon ID. On BCM4718 it will be BCM4716, because 4716 is core for 4716,4717 & 4718. Tested on Netgear WNR3500L (BCM4718) and Asus RT-N53 (BCM5357). Reviewed by: landonf, yamori813@yahoo.co.jp Sponsored by: Postgres Professional Differential revision: https://reviews.freebsd.org/D12737
2021-05-25crypto: Add a new type of crypto buffer for a single mbuf.John Baldwin
This is intended for use in KTLS transmit where each TLS record is described by a single mbuf that is itself queued in the socket buffer. Using the existing CRYPTO_BUF_MBUF would result in bus_dmamap_load_crp() walking additional mbufs in the socket buffer that are not relevant, but generating a S/G list that potentially exceeds the limit of the tag (while also wasting CPU cycles). Reviewed by: markj Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30136
2021-05-22[ar71xx] During reset, don't spin, just keep tryingAdrian Chadd
I've seen this fail from time to time and just hang during reset. Instead of it just hanging, just poke it again. I've not seen it fail in hundreds of test resets now. Tested: * AR9344 AP/STA configuration
2021-05-20sys/*/conf/*, docs: fix links to handbookCeri Davies
While here, fix all links to older en_US.ISO8859-1 documentation in the src/ tree. PR: 255026 Reported by: Michael Büker <freebsd@michael-bueker.de> Reviewed by: dbaio Approved by: blackend (mentor), re (gjb) MFC after: 10 days Differential Revision: https://reviews.freebsd.org/D30265
2021-04-12OCF: Remove support for asymmetric cryptographic operations.John Baldwin
There haven't been any non-obscure drivers that supported this functionality and it has been impossible to test to ensure that it still works. The only known consumer of this interface was the engine in OpenSSL < 1.1. Modern OpenSSL versions do not include support for this interface as it was not well-documented. Reviewed by: cem Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D29736
2021-04-12Create VM_MEMATTR_DEVICE on all architecturesAndrew Turner
This is intended to be used with memory mapped IO, e.g. from bus_space_map with no flags, or pmap_mapdev. Use this new memory type in the map request configured by resource_init_map_request, and in pciconf. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D29692
2021-04-09nlmrsa: Remove this deprecated driver.John Baldwin
Relnotes: yes Sponsored by: Chelsio Communications