aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/include
Commit message (Collapse)AuthorAgeFilesLines
* Revert "pcb.h: mark struct pcb to be preserved"Konstantin Belousov2026-02-091-4/+0
| | | | | | | kgdb only uses the marked fields from dumppcb for initial frame reconstruction. This reverts commit 8f23665fed2fbaf4481359b4d2fcdd7b9feb40e3.
* pcb.h: mark struct pcb to be preservedMinsoo Choo2026-02-091-0/+4
| | | | | | | | | | There are programs that depend on this structure (e.g. kernel debuggers) that breaks when the ABI changes. Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: kib MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D55149
* STACKALIGN: Reimplement in terms of __align_downJohn Baldwin2026-02-061-1/+0
| | | | | | | | | | This changes STACKALIGN to be type-preserving when operating on pointers. Reviewed by: brooks, kib Effort: CHERI upstreaming Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54920
* arm: Implement kernel ifuncMichal Meloun2026-02-011-3/+21
| | | | | | | | Add kernel ifunc support on arm. MFC after : 3 weeks Reviewed by: kib (previous version) Differential Revision: https://reviews.freebsd.org/D54970
* arm, riscv: add a preprocessor symbol indicating missed support of ifuncKonstantin Belousov2026-01-291-0/+10
| | | | | | | | | in kernel. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54831
* arm: Make init_proc0 staticJohn Baldwin2026-01-271-1/+0
| | | | | | | | | | This function is not used outside of machdep.c and is already static on arm64 and riscv. Reviewed by: imp Effort: CHERI upstreaming Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D54838
* Add sys/_align.h replacing machine/_align.hBrooks Davis2025-12-102-52/+1
| | | | | | | | | | | | | | | | Define _ALIGNBYTES using sizeof(void *) (no functional change on any existing architecture) which will allow it to work with CHERI were we must align things up to capability alignment. In _ALIGN, replace integer manipulation which does not preserve pointer provenance with a type and provenance preserving builtin. This requires modest changes in code which assumes _ALIGN returns an integer, but those are relatively rare. Reviewed by: kib, markj Effort: CHERI upstreaming Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D53947
* armv7: Tweak some armv6 removalsWarner Losh2025-12-031-1/+0
| | | | | | Fixes: 42421307b115 (sys: remove armv6/6.1 support from debug monitor) Suggested by: jhb Sponsored by: Netflix
* sys/stdint.h: add C23 _WIDTH macrosRobert Clausecker2025-11-301-0/+23
| | | | | | | | | | | | | | The platform-dependent macros are added to the various _stdint.h headers, those that are always the same are added directly to _stdint.h. We may want to move the definitions for WCHAR_* and WINT_* out of the platform header files as those are always the same. Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53830
* sys/limits.h: add C23 _WIDTH macrosRobert Clausecker2025-11-301-0/+3
| | | | | | | | | | | | For compliance with IOS/IEC 9899:2024 ("C23"). These macros define the width in bits of the basic integer types. Another new macro, BITINT_MAXWIDTH, is not yet included as I do not understand what it should be set to. Perhaps it is compiler-specific. Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D53825
* sys: remove comment for armv5/6Minsoo Choo2025-11-292-6/+1
| | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1903
* kexec: Add dummy headers for arm, i386, powerpc, and riscvJustin Hibbits2025-10-271-0/+38
| | | | | | | | kexec hasn't been ported to these architectures, yet, so appease the build with dummy headers. Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D51625
* sys/arm: add fp[gs]et* prototypes to <ieeefp.h>Robert Clausecker2025-10-221-0/+10
| | | | | | | | | | We have provided implementations for hard float of these for a while now. Add them to the header to make things official. This is required for a bunch of legacy programs in ports. Approved by: markj (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53156
* arm/atomic.h: remove misleading commentKonstantin Belousov2025-09-201-5/+0
| | | | | | | Noted and reviewed by: jrtc27 Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52626
* arm, powerpc, riscv: implement atomic_set/clear_16Konstantin Belousov2025-09-201-0/+3
| | | | | | | Reviewed by: jrtc27, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52626
* runq: Deduce most parameters, remove machine headersOlivier Certner2025-06-181-46/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The 'runq' machinery now depends on only two settable parameters, RQ_MAX_PRIO, the maximum priority number that can be accepted, the minimum being 0, and RQ_PPQ, the number of priorities per queue (to reduce the number of queues). All other parameters are deduced from these ones. Also, all architectures automatically get a runq word that is their natural word. RQB_FFS() always was 'ffsl() - 1' except for amd64 where it was 'bsfq()'. Now that all these finally call compiler builtins, the resulting assembly code is the same, so there is no cost to removing this special case. After all these changes, <machine/runq.h> headers have no more purpose, so remove them. While here, fix potentially confusing parameter name for RQB_WORD() and RQB_BIT(). While here, include all necessary headers so that <sys/runq.h> can be included standalone. No functional change (intended). Reviewed by: kib MFC after: 1 month Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45387
* arm: fix build after _types.h changesBrooks Davis2025-06-121-0/+2
| | | | | Reported by: alc Fixes: b01e971fd39d ("Don't rely on sys/_types.h including sys/cdefs.h")
* 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")