summaryrefslogtreecommitdiff
path: root/sys/mips/include
Commit message (Collapse)AuthorAgeFilesLines
* Remove 'struct trapframe' pointer from mips64's 'struct syscall_args'.Edward Tomasz Napierala2020-11-061-2/+2
| | | | | | | | | | | | | While here, use MAXARGS. This brings its 'struct syscall_args' in sync with most other architectures. Reviewed by: arichardson, brooks MFC after: 2 weeks Sponsored by: EPSRC Differential Revision: https://reviews.freebsd.org/D26619 Notes: svn path=/head/; revision=367429
* Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.Edward Tomasz Napierala2020-09-271-1/+0
| | | | | | | | | Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D26458 Notes: svn path=/head/; revision=366205
* Check for the only 32-bit MIPS ABIs we support, rather than !n64Justin Hibbits2020-09-261-1/+1
| | | | | | | | | | | There may be additional 64-bit ABIs supported, so use a positive check rather than a negative check. Suggested by: imp MFC after: 1 week Sponsored by: Juniper Networks, Inc Notes: svn path=/head/; revision=366188
* mips: Fix compat32 library builds from r366162Justin Hibbits2020-09-251-0/+4
| | | | | | | | | | Re-add the a_ptr and a_fcn fields to Elf32_Auxinfo. MFC after: 1 week Sponsored by: Juniper Networks, Inc. Notes: svn path=/head/; revision=366169
* Fix compat32 on mips64Justin Hibbits2020-09-251-2/+0
| | | | | | | | | | | | | | | | | | Summary: Two bugs: * Elf32_Auxinfo is broken, using pointers in the union, which are 64-bits not 32. * freebsd32_sysarch() doesn't update the 'user local' register when handling MIPS_SET_TLS, leading to a NULL pointer dereference in the 32-bit application. Reviewed by: #mips, brooks MFC after: 1 week Sponsored by: Juniper Networks, Inc Differential Revision: https://reviews.freebsd.org/D26556 Notes: svn path=/head/; revision=366162
* Add a vmparam.h constant indicating pmap support for large pages.Mark Johnston2020-09-231-0/+5
| | | | | | | | | | | Enable SHM_LARGEPAGE support on arm64. Reviewed by: alc, kib Sponsored by: Juniper Networks, Inc., Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26467 Notes: svn path=/head/; revision=366090
* Sparsify the vm_page_dump bitmapD Scott Phillips2020-09-211-1/+2
| | | | | | | | | | | | | | | | | | | On Ampere Altra systems, the sparse population of RAM within the physical address space causes the vm_page_dump bitmap to be much larger than necessary, increasing the size from ~8 Mib to > 2 Gib (and overflowing `int` for the size). Changing the page dump bitmap also changes the minidump file format, so changes are also necessary in libkvm. Reviewed by: jhb Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26131 Notes: svn path=/head/; revision=365978
* Move vm_page_dump bitset array definition to MI codeD Scott Phillips2020-09-212-4/+5
| | | | | | | | | | | | | | | | | | | These definitions were repeated by all architectures, with small variations. Consolidate the common definitons in machine independent code and use bitset(9) macros for manipulation. Many opportunities for deduplication remain in the machine dependent minidump logic. The only intended functional change is increasing the bit index type to vm_pindex_t, allowing the indexing of pages with address of 8 TiB and greater. Reviewed by: kib, markj Approved by: scottl (implicit) MFC after: 1 week Sponsored by: Ampere Computing, Inc. Differential Revision: https://reviews.freebsd.org/D26129 Notes: svn path=/head/; revision=365977
* Add missing assignment forgotten in r365899Michal Meloun2020-09-201-0/+1
| | | | | | | | | Noticed by: mav MFC after: 1 month MFC with: r365899 Notes: svn path=/head/; revision=365926
* Add NetBSD compatible bus_space_peek_N() and bus_space_poke_N() functions.Michal Meloun2020-09-191-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | One problem with the bus_space_read_N() and bus_space_write_N() family of functions is that they provide no protection against exceptions which can occur when no physical hardware or device responds to the read or write cycles. In such a situation, the system typically would panic due to a kernel-mode bus error. The bus_space_peek_N() and bus_space_poke_N() family of functions provide a mechanism to handle these exceptions gracefully without the risk of crashing the system. Typical example is access to PCI(e) configuration space in bus enumeration function on badly implemented PCI(e) root complexes (RK3399 or Neoverse N1 N1SDP and/or access to PCI(e) register when device is in deep sleep state. This commit adds a real implementation for arm64 only. The remaining architectures have bus_space_peek()/bus_space_poke() emulated by using bus_space_read()/bus_space_write() (without exception handling). MFC after: 1 month Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D25371 Notes: svn path=/head/; revision=365899
* Add the MEM_EXTRACT_PADDR ioctl to /dev/mem.Mark Johnston2020-09-021-1/+1
| | | | | | | | | | | | | | | This allows privileged userspace processes to find information about the physical page backing a given mapping. It is useful in applications such as DPDK which perform some of their own memory management. Reviewed by: kib, jhb (previous version) MFC after: 2 weeks Sponsored by: Juniper Networks, Inc. Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D26237 Notes: svn path=/head/; revision=365265
* mips: clean up empty lines in .c and .h filesMateusz Guzik2020-09-016-18/+2
| | | | Notes: svn path=/head/; revision=365076
* Various fixes to TLS for MIPS.John Baldwin2020-06-121-3/+1
| | | | | | | | | | | | | | | | | | | | | | - Clear the current thread's TLS pointer on exec. Previously the TLS pointer (and register) remain unchanged. - Explicitly clear the TLS pointer when new threads are created. - Make md_tls_tcb_offset per-process instead of per-thread. The layout of the TLS and TCB are identical for all threads in a process, it is only the TLS pointer values themselves that vary by thread. This also makes setting md_tls_tcb_offset in cpu_set_user_tls() redundant with the setting in exec_setregs(), so only set it in exec_setregs(). Submitted by: Alfredo Mazzinghi (1) Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24957 Notes: svn path=/head/; revision=362122
* Print CPU informtion later in boot.John Baldwin2020-05-201-0/+3
| | | | | | | | | | | | | | | | | Match other architectures and print CPU information during cpu_startup(). In particular, this prints the information after the message buffer is initialized which allows it to be retrieved after boot via dmesg(8). While here, add some extern declarations to <machine/md_var.h> in place of duplicated declarations in various source files. Reviewed by: brooks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24936 Notes: svn path=/head/; revision=361297
* Simplify hot-patching cpu_switch() for lack of UserLocal register.John Baldwin2020-05-201-0/+1
| | | | | | | | | | | | | Rather than walking all of cpu_switch looking for the sequence of instructions to patch, add a global label at the location that needs the patch applied. Reviewed by: brooks, Alfredo Mazzinghi <alfredo.mazzinghi_cl.cam.ac.uk> Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24931 Notes: svn path=/head/; revision=361296
* Use the right type for 64-bit coprocessor registers.John Baldwin2020-04-171-4/+4
| | | | | | | | | | | | | | | The use of "int" here caused the compiler to believe that it needs to insert a "sll $n, $n, 0" to sign extend as part of the implicit cast to uint64_t. Submitted by: Nathaniel Filardo <nwf20@cl.cam.ac.uk> Reviewed by: brooks, arichardson Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D24457 Notes: svn path=/head/; revision=360050
* mips: fix kernel build after r357804Kyle Evans2020-02-141-1/+1
| | | | | | | | Drop the padding down the size of a single uintptr_t to account for pc_zpcpu_offset Notes: svn path=/head/; revision=357935
* [PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operationsBrandon Bergren2020-01-021-0/+4
| | | | | | | | | | | | | | | | | | | This is a lock-based emulation of 64-bit atomics for kernel use, split off from an earlier patch by jhibbits. This is needed to unblock future improvements that reduce the need for locking on 64-bit platforms by using atomic updates. The implementation allows for future integration with userland atomic64, but as that implies going through sysarch for every use, the current status quo of userland doing its own locking may be for the best. Submitted by: jhibbits (original patch), kevans (mips bits) Reviewed by: jhibbits, jeff, kevans Differential Revision: https://reviews.freebsd.org/D22976 Notes: svn path=/head/; revision=356308
* Two minor issues:Warner Losh2019-12-171-1/+7
| | | | | | | | | (1) Don't define load/store 64 atomics for o32. They aren't atomic there. (2) Add comment about why we need 64 atomic define on n32 only. Notes: svn path=/head/; revision=355841
* Introduce vm_page_astate.Mark Johnston2019-12-101-1/+1
| | | | | | | | | | | | | | | | | This is a 32-bit structure embedded in each vm_page, consisting mostly of page queue state. The use of a structure makes it easy to store a snapshot of a page's queue state in a stack variable and use cmpset loops to update that state without requiring the page lock. This change merely adds the structure and updates references to atomic state fields. No functional change intended. Reviewed by: alc, jeff, kib Sponsored by: Netflix, Intel Differential Revision: https://reviews.freebsd.org/D22650 Notes: svn path=/head/; revision=355586
* Regularize my copyright noticeWarner Losh2019-12-042-3/+2
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* Remove two obsolete comments that reference splhigh/splx.Warner Losh2019-11-211-7/+0
| | | | Notes: svn path=/head/; revision=354972
* add atomic_load_64 for mipsn32Andriy Gapon2019-10-071-0/+4
| | | | | | | | | It's just an alias for atomic_load_acq_64 (same as on i386). MFC after: 1 week Notes: svn path=/head/; revision=353166
* mips: use generic sub-word atomic *cmpsetKyle Evans2019-10-021-68/+74
| | | | | | | | | | Most of this diff is refactoring to reduce duplication between the different acq_ and rel_ variants. Differential Revision: https://reviews.freebsd.org/D21822 Notes: svn path=/head/; revision=353016
* mips: fcmpset: do not spin on sc failureKyle Evans2019-10-021-12/+18
| | | | | | | | | | | | | | For ll/sc architectures, atomic(9) allows failure modes where *old == val due to write failure and callers should compensate for this. Do not retry on failure, just leave 0 in ret and fail the operation if we couldn't sc it. This lets the caller determine if it should retry or not. Reviewed by: kib Looks ok: imp Differential Revision: https://reviews.freebsd.org/D21836 Notes: svn path=/head/; revision=353008
* mips: move support for temporary mappings above KSEG0 to per-CPU dataJason A. Harmening2019-09-171-1/+7
| | | | | | | | | | | | This is derived from similar work done in r310481 for i386 and r312610 for armv6/armv7. Additionally, use a critical section to keep the thread pinned for per-CPU operations instead of completely disabling local interrupts. No objections from: adrian, jmallett, imp Differential Revision: https://reviews.freebsd.org/D18593 Notes: svn path=/head/; revision=352434
* mips: fix some mcount nitsKyle Evans2019-09-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The symbol version for _mcount was removed 12 years ago in r169525 from gmon/Symbol.map, to be added to the per-arch Symbol.map. mips was overlooked in this, so _mcount has no symver. Add it back to where it should have been, rather than where it would go if it were added today, since we're correcting a historical mistake. Additionally, _mcount is getting thrown into .mdebug.abi32 in the llvm80/90 world as it's not getting explicitly thrown into .text, so do this now. This fixes the libc build that was previously failing due to relocations in .mdebug.abi32. This is specifically due to the way clang's integrated AS works and that they emit the .mdebug.abiNN section early in the process. An LLVM bug has been submitted[0] and an agreement has been made that the mips backend should switch to .text following .mdebug.abiNN for compatibility. [0] https://bugs.llvm.org/show_bug.cgi?id=43119 Reviewed by: imp, arichardson MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21435 Notes: svn path=/head/; revision=351681
* Centralize __pcpu definitions.Konstantin Belousov2019-08-291-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | Many extern struct pcpu <something>__pcpu declarations were copied/pasted in sources. The issue is that the definition is MD, but it cannot be provided by machine/pcpu.h due to actual struct pcpu defined in sys/pcpu.h later than the inclusion of machine/pcpu.h. This forced the copying when other code needed direct access to __pcpu. There is no way around it, due to machine/pcpu.h supplying part of struct pcpu fields. To work around the problem, add a new machine/pcpu_aux.h header, which should fill any needed MD definitions after struct pcpu definition is completed. This allows to remove copies of __pcpu spread around the source. Also on x86 it makes it possible to remove work arounds like OFFSETOF_CURTHREAD or clang specific warnings supressions. Reported and tested by: lwhsu, bcran Reviewed by: imp, markj (previous version) Discussed with: jhb Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D21418 Notes: svn path=/head/; revision=351594
* mips: hide regnum definitions behind _KERNEL/_WANT_MIPS_REGNUMKyle Evans2019-08-221-5/+6
| | | | | | | | | | | | | | | | | | | machine/regnum.h ends up being included by sys/procfs.h and sys/ptrace.h via machine/reg.h. Many of the regnum definitions are too short and too generic to be exposing to any userland application including one of these two headers. Moreover, these actively cause build failures in googletest (template <typename T1 ...> expanding to template <typename 9 ...>). Hide the definitions behind _KERNEL or _WANT_MIPS_REGNUM, and patch all of the userland consumers to define as needed. Discussed with: imp, jhb Reviewed by: imp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D21330 Notes: svn path=/head/; revision=351409
* mips: avoid empty mdproc structKyle Evans2019-08-191-1/+2
| | | | | | | | Compiling with a more modern toolchain than GCC 4.2 in base warns about the empty struct. Take a hint and comment from r350902+r350953 by luporl@. Notes: svn path=/head/; revision=351227
* Move phys_avail definition into MI code. It is consumed in the MI layer andJeff Roberson2019-08-161-6/+2
| | | | | | | | | | | doing so adds more flexibility with less redundant code. Reviewed by: jhb, markj, kib Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D21250 Notes: svn path=/head/; revision=351108
* mips: Implement basic pmap_kenter_device, pmap_kremove_deviceConrad Meyer2019-05-161-0/+2
| | | | | | | | | | | Unbreak mips.BERI_DE4_SDROOT build, which uses device xdma. Device xdma depends on the pmap_kenter_device APIs. Reported by: tinderbox (local) Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=347888
* amd64 KPTI: add control from procctl(2).Konstantin Belousov2019-03-161-0/+4
| | | | | | | | | | | | | | | | | Add the infrastructure to allow MD procctl(2) commands, and use it to introduce amd64 PTI control and reporting. PTI mode cannot be modified for existing pmap, the knob controls PTI of the new vmspace created on exec. Requested by: jhb Reviewed by: jhb, markj (previous version) Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D19514 Notes: svn path=/head/; revision=345228
* Remove obsolete wrappers for 64-bit loads/stores which were only used by theJuli Mallett2019-03-161-10/+2
| | | | | | | | | removed (r342255) SiByte port. Reviewed by: imp Notes: svn path=/head/; revision=345221
* Add kernel support for Intel userspace protection keys feature onKonstantin Belousov2019-02-201-0/+7
| | | | | | | | | | | | | | | | Skylake Xeons. See SDM rev. 68 Vol 3 4.6.2 Protection Keys and the description of the RDPKRU and WRPKRU instructions. Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D18893 Notes: svn path=/head/; revision=344353
* Remove a few stray "All Rights Reserved." declarations on stuff I'veWarner Losh2019-02-051-1/+1
| | | | | | | written. Notes: svn path=/head/; revision=343810
* atomic_cmpset return value is also an int.Warner Losh2018-12-141-8/+8
| | | | Notes: svn path=/head/; revision=342095
* atomic_fcmpset* return int, not the type of *.Warner Losh2018-12-141-8/+8
| | | | | | | | | | | fcmpset returns true/false as a int, so make the return types and variables match the int to be consistent with other arch. Reviewed by: cognet@ Differential Revision: https://reviews.freebsd.org/D18557 Notes: svn path=/head/; revision=342094
* Correctly implemenet atomic_swap_long for mips64.Warner Losh2018-12-131-6/+9
| | | | | | | | | | | MIPS64 has 64-bit longs, so use uint64_t for it, otherwise uint32_t. sizeof(long) == sizeof(ptr) for all platforms, so define atomic_swap_ptr in terms of atomic_swap_long. Submitted by: hps@ Notes: svn path=/head/; revision=342022
* Implement atomic_swap_xxx() for all platforms.Hans Petter Selasky2018-12-101-0/+64
| | | | | | | | | | Differential Revision: https://reviews.freebsd.org/D18450 Reviewed by: kib@ MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=341787
* Add a KPI for the delay while spinning on a spin lock.John Baldwin2018-11-051-0/+1
| | | | | | | | | | | | | Replace a call to DELAY(1) with a new cpu_lock_delay() KPI. Currently cpu_lock_delay() is defined to DELAY(1) on all platforms. However, platforms with a DELAY() implementation that uses spin locks should implement a custom cpu_lock_delay() doesn't use locks. Reviewed by: kib MFC after: 3 days Notes: svn path=/head/; revision=340164
* Consolidate identical ELF auxargs type defintions.Brooks Davis2018-10-221-31/+0
| | | | | | | | | | | | | | | All platforms except powerpc use the same values and powerpc shares a majority of them. Go ahead and declare AT_NOTELF, AT_UID, and AT_EUID in favor of the unused AT_DCACHEBSIZE, AT_ICACHEBSIZE, and AT_UCACHEBSIZE for powerpc. Reviewed by: jhb, imp Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D17397 Notes: svn path=/head/; revision=339625
* Make cache coherency attributes definitions available in machine/vm.h on MIPS.Konstantin Belousov2018-08-013-90/+158
| | | | | | | | | | | | Move definitions from cpuregs.h into the cca.h, and include cca.h into vm.h. This is required to make MIPS MD memattr definitions usable in userspace. Sponsored by: The FreeBSD Foundation, Mellanox Technologies MFC after: 1 week Differential revision: https://reviews.freebsd.org/D15583 Notes: svn path=/head/; revision=337048
* Back pcpu zone with domain correct pagesMatt Macy2018-07-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | - Change pcpu zone consumers to use a stride size of PAGE_SIZE. (defined as UMA_PCPU_ALLOC_SIZE to make future identification easier) - Allocate page from the correct domain for a given cpu. - Don't initialize pc_domain to non-zero value if NUMA is not defined There are some misconceptions surrounding this field. It is the _VM_ NUMA domain and should only ever correspond to valid domain values as understood by the VM. The former slab size of sizeof(struct pcpu) was somewhat arbitrary. The new value is PAGE_SIZE because that's the smallest granularity which the VM can allocate a slab for a given domain. If you have fewer than PAGE_SIZE/8 counters on your system there will be some memory wasted, but this is obviously something where you want the cache line to be coming from the correct domain. Reviewed by: jeff Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D15933 Notes: svn path=/head/; revision=336020
* Fix PT_STEP single-stepping for mips.John Baldwin2018-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that GDB at least implements single stepping for MIPS using software breakpoints explicitly rather than using PT_STEP, so this has only been tested via tests in ptrace_test which now pass rather than fail. - Fix several places to use uintptr_t instead of int for virtual addresses. - Check for errors from ptrace_read_int() when setting a breakpoint for a step. - Properly check for errors from ptrace_write_int() as it returns non-zero, not negative values on failure. - Change the error returns for ptrace_read_int() and ptrace_write_int() from ENOMEM to EFAULT. - Clear a single step breakpoint when it traps rather than waiting for it to be cleared from ptrace(). This matches the behavior of the arm port and in general seems a bit more reliable than waiting for ptrace() to clear it via FIX_SSTEP. - Drop the PROC_LOCK around ptrace_write_int() in ptrace_clear_single_step() since it can sleep. - Reorder the breakpoint handler in trap() to only read the instruction if the address matches the current thread's breakpoint address. - Replace various #if 0'd debugging printfs with KTR_PTRACE traces. Tested on: mips64 Notes: svn path=/head/; revision=332951
* Expose breakpoint() to userland from <machine/cpufunc.h> on MIPS.John Baldwin2018-04-241-6/+6
| | | | | | | | | | Enable ptrace() tests using breakpoint on MIPS as well. Tested on: mips64 MFC after: 1 month Notes: svn path=/head/; revision=332907
* No need to force md code to define a macro that's the same asWarner Losh2018-04-161-5/+0
| | | | | | | _BYTE_ORDER. Use that instead. Notes: svn path=/head/; revision=332563
* Add SMP support for BERI CPU.Ruslan Bukin2018-04-122-0/+9
| | | | | | | | Obtained from: CheriBSD Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=332441
* Move most of the contents of opt_compat.h to opt_global.h.Brooks Davis2018-04-064-16/+0
| | | | | | | | | | | | | | | | | | | | | opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941 Notes: svn path=/head/; revision=332122
* Move remaining EF_MIPS_* flags to <sys/elf_common.h>.John Baldwin2018-03-231-20/+0
| | | | | | | | | Reviewed by: brooks Sponsored by: DARPA / AFRL Differential Revision: https://reviews.freebsd.org/D14789 Notes: svn path=/head/; revision=331459