aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/include
Commit message (Collapse)AuthorAgeFilesLines
* subr_devmap: Implement pmap_mapdev with pmap_mapdev_attrAndrew Turner2025-05-151-7/+1
| | | | | | | | | We can now support pmap_mapdev_attr on arm. Switch to use this to implement pmap_mapdev to reduce duplicate code. Reviewed by: mhorne, mmel Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50309
* arm: Make the pmap_kenter signature like arm64Andrew Turner2025-05-151-1/+1
| | | | | | | | | To support a common pmap_mapdev_attr change pmap_kenter to include the size any memory type in the signature. Reviewed by: mhorne Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50307
* subr_devmap: Reduce the use of the static devmapAndrew Turner2025-05-021-0/+2
| | | | | | | | | We only create the static devmap on arm. Stop building this code on other architectures. Reviewed by: mhorne, imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D50016
* efi/metadata: Make a note that efi_map_header isn't standardWarner Losh2025-04-091-3/+8
| | | | | | | | | | efi_map_header is similar to, but not at all the same as the UEFI EFI_MEMORY_ATTRIBUTES_TABLE (we could easily have used the latter though, with one fewer non-standard types, but we can't change it easily now due to the last 10 years of boot loaders passing this in). Sponsored by: Netflix
* pci: cleanup __PCI_REROUTE_INTERRUPTSMitchell Horne2025-01-231-2/+0
| | | | | | | | This flag was used as a transition for differing pcib implementations. Today it is defined for all supported architectures, and can be removed. Reviewed by: imp, jhb Differential Revision: https://reviews.freebsd.org/D48485
* Centralize and simpify implemention of some VM macrosBrooks Davis2025-01-141-7/+0
| | | | | | | | | | | | | These macros have substantially identical implementations on each platform. Use roundup2/rounddown2 for round_page/trunc_page. This version standardizes on not using explicit casts and instead preserving the original type. A couple of tweaks were required to make this work. Reviewed by: brooks, kib, markj Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D48450
* intrng: fix INTR_ROOT_* constantsElliott Mitchell2024-12-161-0/+3
| | | | | | | | | | | Switch to INTR_ROOT_COUNT as this name better describes its purpose. Remove the default INTR_ROOT_IRQ from the core. Define it (redundantly) in each architecture's header, but now placed alongside its sibling values (if defined by the platform, e.g. arm64 INTR_ROOT_FIQ). Reviewed by: mhorne Pull Request: https://github.com/freebsd/freebsd-src/pull/1280
* atomics: Constify loadsOlivier Certner2024-12-161-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | In order to match reality, allow using these functions with pointers on const objects, and bring us closer to C11. Remove the '+' modifier in the atomic_load_acq_64_i586()'s inline asm statement's constraint for '*p' (the value to load). CMPXCHG8B always writes back some value, even when the value exchange does not happen in which case what was read is written back. atomic_load_acq_64_i586() further takes care of the operation atomically writing back the same value that was read in any case. All in all, this makes the inline asm's write back undetectable by any other code, whether executing on other CPUs or code on the same CPU before and after the call to atomic_load_acq_64_i586(), except for the fact that CMPXCHG8B will trigger a #GP(0) if the memory address is part of a read-only mapping. This unfortunate property is however out of scope of the C abstract machine, and in particular independent of whether the 'uint64_t' pointed to is declared 'const' or not. Approved by: markj (mentor) MFC after: 5 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46887
* sys/intr.h: Make it safe to include from assemblerWarner Losh2024-12-061-2/+4
| | | | | | | | | | | | Sometimes we need defines from this file in assembler code. Today we do the heavyweight approach of using genassym for that. However, they are just #defines, so in the future we want to include sys/intr.h to pick up the needed constants in exception.S. PR: 283041 Sponsored by: Netflix Reviewed by: mmel, andrew Differential Revision: https://reviews.freebsd.org/D47846
* atomic(9): Implement atomic_testand(clear|set)_ptrJohn Baldwin2024-11-191-0/+2
| | | | | | | | | | For current architectures, these are just aliases for the existing operation on the relevant scalar integer. Reviewed by: imp, kib Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47631
* atomic(9): Remove fcmpset-based fallback for atomic_testand(clear|set)John Baldwin2024-11-191-4/+0
| | | | | | | | All architectures implement a MD version Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47629
* arm: Implement atomic_testandset_acq_long as a simple wrapperJohn Baldwin2024-11-191-1/+11
| | | | | | | | | | Use a memory barrier after calling the existing atomic_testandset_long rather than using the fcmpset-based fallback version from <sys/_atomic_subword.h>. Reviewed by: kib Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47628
* arm: switch the BUSDMA buffers to normal uncached memoryMichal Meloun2024-11-111-1/+1
| | | | | | | | | | | | The BUSDMA buffer is treated as normal memory during compilation and compiler is free to inline/optimize basic functions (i.e. memset, memcpy) accessing buffers, including when an instruction is generated that performs a word access to unaligned data. We support this, but only if the buffer in question is mapped as normal memory (cached or not), but not to memory mapped as strongly ordered or device type. MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D47485
* Revert "intrng: change multi-interrupt root support type to enum"Kyle Evans2024-10-251-6/+0
| | | | | | | | | This reverts commit 536c8d948e8563141356fd41fb8bfe65be289385. The change seemed fine on the surface, but converting to an enum has raised some concerns due to the asm <-> C interface. Back it out and let someone else deal with it later if they'd like to. Further context about the concerns can be found in D47279.
* sys/intr.h: formally depend on machine/intr.hKyle Evans2024-10-241-2/+0
| | | | | | | | | | | | | | sys/intr.h originally started life as an extract of arm's intr.h, and this include was dropped in its place. Changes in flight want to add some MD definitions that we'll use in the more MI parts of INTRNG. Let's formally reverse the dependency now since this is way more common in general. All of the includes switched in this change that I spot-checked were in-fact wanting declarations historically included in sys/intr.h anyways. Reviewed by: andrew, imp, jrtc27, mhorne, mmel, olce Differential Revision: https://reviews.freebsd.org/D47002
* intrng: change multi-interrupt root support type to enumElliott Mitchell2024-10-241-0/+6
| | | | | | | | | | | | | | | | | uint32_t is handy for directly interfacing with assembly-language. For the C portion, enum is much handier. In particular there is no need to count the number of roots by hand. This also works better for being able to build kernels with varying numbers of roots. Switch to INTR_ROOT_COUNT as this better matches the purpose of the value. Switch to root_type, rather than rootnum for similar reasons. Remove the default from the core. Better to require the architectures to declare the type since they will routinely deviate and a default chosen now will likely be suboptimal. Leave intr_irq_handler() taking a register type as that better matches for interfacing with assembly-language.
* arm: Remove support for Armv6 CPU coresAndrew Turner2024-09-111-3/+0
| | | | | | | | The ARM1176 is an Armv6 CPU. As Armv6 support has been removed we can also remove ARM1176 support. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45958
* arm: Assume __ARM_ARCH == 7Andrew Turner2024-09-115-98/+12
| | | | | | | | The only supported 32-bit Arm architecture is Armv7. Remove old checks for earlier architecture revisions. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45957
* Retire non-NEW_PCIB code and remove config optionJessica Clarke2024-07-181-2/+0
| | | | | | | | | | | All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent to do so in 121be555997b (arm: Set NEW_PCIB in DEFAULTS rather than a subset of kernel configs")), so it's time we removed the legacy code that no longer sees much testing and has a significant maintenance burden. Reviewed by: jhb, andrew, emaste Differential Revision: https://reviews.freebsd.org/D32954
* arm: Start to remove the now unneeded acle-compat.hAndrew Turner2024-06-261-155/+3
| | | | | | | | | | | | All supported compilers provide the acle macros so we don't need the backup versions. Keep the file around for anything that included it directly, but make it an error to not support the acle macros. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45726
* Revert "arm: Start to remove the now unneeded acle-compat.h"Andrew Turner2024-06-251-3/+155
| | | | | | This reverts commit 3d02fe6c59dc87b265f268233cd574f7f04edb5d. This wasn't ready to be committed
* arm: Start to remove the now unneeded acle-compat.hAndrew Turner2024-06-251-155/+3
| | | | | | | All supported compilers provide the acle macros so we don't need the backup versions. Sponsored by: Arm Ltd
* sdt: Implement SDT probes using hot-patchingMark Johnston2024-06-191-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea here is to avoid a memory access and conditional branch per probe site. Instead, the probe is represented by an "unreachable" unconditional function call. asm goto is used to store the address of the probe site (represented by a no-op sled) and the address of the function call into a tracepoint record. Each SDT probe carries a list of tracepoints. When the probe is enabled, the no-op sled corresponding to each tracepoint is overwritten with a jmp to the corresponding label. The implementation uses smp_rendezvous() to park all other CPUs while the instruction is being overwritten, as this can't be done atomically in general. The compiler moves argument marshalling code and the sdt_probe() function call out-of-line, i.e., to the end of the function. Per gallatin@ in D43504, this approach has less overhead when probes are disabled. To make the implementation a bit simpler, I removed support for probes with 7 arguments; nothing makes use of this except a regression test case. It could be re-added later if need be. The approach taken in this patch enables some more improvements: 1. We can now automatically fill out the "function" field of SDT probe names. The SDT macros let the programmer specify the function and module names, but this is really a bug and shouldn't have been allowed. The intent was to be able to have the same probe in multiple functions and to let the user restrict which probes actually get enabled by specifying a function name or glob. 2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability to include blocks of code in the out-of-line path. For example: if (SDT_PROBES_ENABLED()) { int reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; SDT_PROBE1(proc, , , exit, reason); } could be written SDT_PROBE1_EXT(proc, , , exit, reason, int reason; reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; ); In the future I would like to use this mechanism more generally, e.g., to remove branches and marshalling code used by hwpmc, and generally to make it easier to add new tracepoint consumers without having to add more conditional branches to hot code paths. Reviewed by: Domagoj Stolfa, avg MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D44483
* Remove the arm FIQ supportAndrew Turner2024-06-102-72/+1
| | | | | | | | It isn't used, and only masks/unmasks FIQs on the local CPU so will be broken on SMP. Reviewed by: mmel Differential Revision: https://reviews.freebsd.org/D33804
* vm: Simplify startup page dumping conditionalBojan Novković2024-05-251-0/+1
| | | | | | | | | | This commit introduces the MINIDUMP_STARTUP_PAGE_TRACKING symbol and uses it to simplify several instances of a complex preprocessor conditional for adding pages allocated when bootstraping the kernel to minidumps. Reviewed by: markj, mhorne Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D45085
* arm: add missing atomic-pointer functionsElliott Mitchell2024-05-091-2/+9
| | | | | | | | | The pointer function types were missing for these functions, so add them. Valuable for places where type sizes vary by architecture. Differential Revision: https://reviews.freebsd.org/D37778 Reviewed by: imp, andrew Pull Request: https://github.com/freebsd/freebsd-src/pull/1126
* arm: Remove duplicate definitions in armreg.hMark Johnston2024-04-301-2/+0
| | | | | | No functional change intended. MFC after: 1 week
* arm: Clean up socdev_vaAndrew Turner2024-02-131-0/+7
| | | | | | | | Support socdev_va on arm and ensure the variable is available on arm64. Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43359
* pmap: Convert boolean_t to bool.John Baldwin2024-01-312-11/+11
| | | | | Reviewed by: kib (older version) Differential Revision: https://reviews.freebsd.org/D39921
* intrng: Extract arm/arm64 IPI->PIC glue codeJessica Clarke2024-01-241-13/+0
| | | | | | | | | | | | | | | | | | | | | | | | | The arm and arm64 implementations of dispatching IPIs via PIC_IPI_SEND are almost identical, and entirely MI with the lone exception of a single store barrier on arm64 (that is likely either redundant or needed on arm too). Thus, de-duplicate this code by moving it to INTRNG as a generic IPI glue framework. The ipi_* functions remain declared in MD smp.h headers and implemented in MD code, but are trivial wrappers around intr_ipi_send that could be made MI, at least for INTRNG ports, at a later date. Note that, whilst both arm and arm64 had an ii_send member in intr_ipi to abstract over how to send interrupts,, they were always ultimately using PIC_IPI_SEND, and so this complexity has been removed. A follow-up commit will re-introduce the same flexibility by instead allowing a device other than the root PIC to be registered as the IPI sender. As part of this, strengthen a MAXCPU assertion that was missed in commit 2f0b059eeafc ("intrng: switch from MAXCPU to mp_ncpus") (which itself is mis-titled). Reviewed by: mmel, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D35898
* sys: Remove ancient SCCS tags.Warner Losh2023-11-2716-33/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* _bus.h: Use standard licnese textWarner Losh2023-11-131-24/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of these used the 'immediately at beginning' variation of the BSD-2-Clause license. This wasn't intentional, just what I copied from from a random file in the tree back in 2005. It was not an intentional decision. The different arch bus.h files are a mix of BSD-2-Clause and BSD-4-Clause that have various copyright holders (Charles M. Hannum, Christopher G. Demetriou, The NetBSD Foundation and KATO Takenori), and some of the content of these files were likely copied from there. However, apart from the uncopyrightable interface lines, there are very few comments. It's unclear if these comments are 'original material' here to copyright, but to the extent that there is, license it under the standard BSD-2-Clause copyright that's the norm for the project today. In any event, the standard BSD-2-Clause is also closer to those originals. In addition, FreeBSD uses different type definitions than the original NetBSD code in part. The comments that were copied have been copied a lot, but appear in NetBSD's bus.h files in NetBSD 1.3. While I'm here, assign the copyright, to the extent any exists from me, to the FreeBSD Foundation. I just cut and pasted these into _bus.h from the different machine files and those files have a rich history of modification from the original imports from NetBSD over more than 25 years so it's tricky to say who, exactly, wrote each bit. Given the size of the files, this seems like the best compromise. Also add an acknowledgement to the NetBSD 1.3 bus.h files and their authors (there were no additional FreeBSD authors listed in the various sys/*/include/bus.h files). Finally, use the SPDX identifier instead of multiple copies of the text. Differential Revision: https://reviews.freebsd.org/D42532 Sponsored by: Netflix
* arm: Update declarations for arm_dcache_align{,_mask}Mark Johnston2023-11-021-2/+2
| | | | | Reported by: Jenkins Fixes: 3d8f548b9e57 ("uma: Make the cache alignment mask unsigned")
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-1610-10/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-1620-20/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-1653-106/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* pcpu: Remove unused definitions of ALT_STACK_SIZEMark Johnston2023-07-271-2/+0
| | | | | | | This was added originally for the sparc64 port and apparently copied to other platforms. No functional change intended. MFC after: 1 week
* arm: Only include sysreg.h when needed in asm.hAndrew Turner2023-07-241-1/+1
| | | | | | | We only need sysreg.h for armv6 barriers Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41141
* arm: Rename pte-v6.h to pte.hAndrew Turner2023-07-242-1/+1
| | | | | | | There is no need for this to be versioned after the removal of armv4/v5 Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41139
* arm: Move contents of pmap-v6.h into pmap.hAndrew Turner2023-07-242-171/+133
| | | | | | | | | | Previously we had an armv4/v5 and armv6/v7 copy of the pmap header. As we have removed armv4/v5 support we can now merge the armv6/v7 code into pmap.h Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41138
* arm: Move contents of cpu-v6.h into cpu.hAndrew Turner2023-07-243-688/+674
| | | | | | | | | | Previously we had an armv4/v5 and armv6/v7 copy of the cpu.h header. As we have removed armv4/v5 support we can now merge the armv6/v7 code into cpu.h Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41137
* arm: Remove swi.hAndrew Turner2023-07-241-22/+0
| | | | | | | It has been unneeded since moving to the Arm EABI Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41136
* arm: Move contents of atomic-v6.h into atomic.hAndrew Turner2023-07-242-1051/+1003
| | | | | | | | | | Previously we had an armv4/v5 and armv6/v7 implementation of the atomic operations. As we have removed armv4/v5 support we can now merge the armv6/v7 code into atomic.h Reviewed by: imp Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41135
* arm: Explain why _atomic_subword.h is neededAndrew Turner2023-07-241-0/+6
| | | | | Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41134
* Remove left over includes from armv4/v5Andrew Turner2023-07-241-6/+0
| | | | | | | | These includes were added for armv4 and armv5 support. Remove them as this has been removed from the tree. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D41133
* Consistently provide ffs/fls using builtinsMitchell Horne2023-07-061-57/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use of compiler builtin ffs/ctz functions will result in optimized instruction sequences when possible, and fall back to calling a function provided by the compiler run-time library. We have slowly shifted our platforms to take advantage of these builtins in 60645781d613 (arm64), 1c76d3a9fbef (arm), 9e319462a03a (powerpc, partial). Some platforms still rely on the libkern implementations of these functions provided by libkern, namely riscv, powerpc (ffs*, flsll), and i386 (ffsll and flsll). These routines are slow, as they perform a linear search for the bit in question. Even on platforms lacking dedicated bit-search instructions, such as riscv, the compiler library will provide better-optimized routines, e.g. by using binary search. Consolidate all definitions of these functions (whether currently using builtins or not) to libkern.h. This should result in equivalent or better performing routines in all cases. One wart in all of this is the existing HAVE_INLINE_F*** macros, which we use in a few places to conditionally avoid the slow libkern routines. These aren't easily removed in one commit. For now, provide these defines unconditionally, but marked for removal after subsequent cleanup. Removal of the now unused libkern routines will follow in the next commit. Reviewed by: dougm, imp (previous version) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40698
* smp: Dynamically allocate the stoppcbs arrayMark Johnston2023-05-252-5/+0
| | | | | | | | | | | | | | This avoids bloating the kernel image when MAXCPU is large. A follow-up patch for kgdb and other kernel debuggers is needed since the stoppcbs symbol is now a pointer. Bump __FreeBSD_version so that debuggers can use osreldate to figure out how to handle stoppcbs. PR: 269572 MFC after: never Reviewed by: mjg, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39806
* spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSDWarner Losh2023-05-124-4/+4
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-1225-25/+25
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* hwpmc: use kstack_contains()Mitchell Horne2023-05-061-4/+2
| | | | | | | | | | | | | | This existing helper function is preferable to the hand-rolled calculation of the kstack bounds. Make some small style improvements while here. Notably, rename every instance of "r", the return address, to "ra". Tidy the includes in the affected files. Reviewed by: jkoshy MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39909