aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc/aim
Commit message (Collapse)AuthorAgeFilesLines
* powerpc64: initial conversion of oea64 to rwlocksAdrian Chadd2026-02-221-18/+32
| | | | | | | Convert the oea64 mmu code to rwlocks. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D54936
* powerpc: document the magic constants for 16MB page sizeAdrian Chadd2026-02-161-0/+13
| | | | | | | | After discussion with jhibbits@, we pulled out what is supported here and how it's supported. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D55093
* powerpc: enable HPT superpages by defaultAdrian Chadd2026-02-161-7/+2
| | | | | | | | It's time to flip these on and see if anything happens in -HEAD. It can be turned back off before 16.0-RELEASE if there are problems. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D55071
* powerpc64: Fix disappearing low memory on radix MMU systems (POWER9)Timothy Pearson2026-02-053-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The FreeBSD radix implementation piggybacks on the physical memory allocation function from the HPT implementation, but did not share the same state information for number of physical memory ranges. This led to a situation where the HPT physical memory allocator would attempt to shift the physical memory ranges in the shared range table, but would use the wrong number of entries, thus overwriting the large segment of low memory that should have been available for e.g. 32-bit DMA. Incorrect physical memory map: real memory = 33997058048 (32422 MB) available KVA = 34359619583 (32767 MB) Physical memory chunk(s): 0x0000000000003000 - 0x0000000000002fff, 0 bytes (0 pages) 0x000000000000e000 - 0x000000000000ffff, 8192 bytes (2 pages) 0x0000000000094000 - 0x0000000000ffffff, 16171008 bytes (3948 pages) 0x0000000100000000 - 0x00000007a2042fff, 28487987200 bytes (6955075 pages) 0x00000007d0006000 - 0x00000007fc72dfff, 745701376 bytes (182056 pages) 0x00000007fdc00000 - 0x00000007ff79ffff, 28966912 bytes (7072 pages) 0x00000007ff7d1000 - 0x00000007ff7effff, 126976 bytes (31 pages) avail memory = 29190103040 (27837 MB) FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs Correct physical memory map: real memory = 33997058048 (32422 MB) available KVA = 34359619583 (32767 MB) Physical memory chunk(s): 0x0000000000003000 - 0x0000000000002fff, 0 bytes (0 pages) 0x000000000000e000 - 0x000000000000ffff, 8192 bytes (2 pages) 0x0000000000094000 - 0x0000000000ffffff, 16171008 bytes (3948 pages) 0x0000000002000000 - 0x000000000284ffff, 8716288 bytes (2128 pages) 0x0000000004627000 - 0x000000002fffffff, 731746304 bytes (178649 pages) 0x0000000034040000 - 0x00000000efffffff, 3153854464 bytes (769984 pages) 0x0000000100000000 - 0x00000007982ecfff, 28323008512 bytes (6914797 pages) 0x00000007cc20a000 - 0x00000007fc72dfff, 810696704 bytes (197924 pages) 0x00000007fdc00000 - 0x00000007ff79ffff, 28966912 bytes (7072 pages) 0x00000007ff7d1000 - 0x00000007ff7effff, 126976 bytes (31 pages) avail memory = 32984436736 (31456 MB) FreeBSD/SMP: Multiprocessor System Detected: 16 CPUs Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> Sponsored-by: Raptor Computing Systems, LLC
* powerpc64/pmap: No need to use r0 anymore in tlbieJustin Hibbits2026-02-051-14/+3
| | | | | | | | | | | The only use of `tlbie %rN, 0` is now explicit and covered in the block above. Since there's no need for an explicit `tlbie %rN, 0` now, drop this convoluted piece and let the compiler decide. While here, a trivial optimization of the old-style tlbie block, by clearing tlbie_lock and returning, instead of going to the end which checks again if the lock is needed. Since it's already known to be needed, there's no need to check again.
* powerpc/pmap: Use a constant for HPT superpage shiftJustin Hibbits2026-02-031-2/+2
| | | | | | | | There are no plans to allow multiple sizes of HPT superpages, so just use a constant for it. MFC after: 3 weeks Fixes: 1bc75d77e9 ("powerpc/pmap/oea64: Make PV_LOCK superpage sized")
* powerpc/pmap/oea64: Make PV_LOCK superpage sizedJustin Hibbits2026-02-031-45/+3
| | | | | | | | | HPT superpages are 16MB, not 2MB. Taking 8 locks to lock a super page almost defeats the purpose of using the super page. Expanding the PV_LOCK scope to cover 16MB (24 bit shift) reduces this to a single lock. MFC after: 3 weeks
* powerpc/pmap: Mark more CPUs as lockless TLBIEJustin Hibbits2026-02-031-2/+2
| | | | | | | | | | Add POWER10 and POWER11 to the list of lockless TLBIE capable CPUs. According to Linux, anything POWER5 and later should be able to do this, but that hasn't been tested with FreeBSD. POWER10 and POWER11, being derived after the POWER9, implicitly have this capability per the ISA spec. MFC after: 1 week
* powerpc: disable the TLBIE lock, it's not needed for POWER8Adrian Chadd2026-01-271-0/+5
| | | | | | | | | | | | According to POWER8_UM_v1.3_16MAR2016 3.8.3 Translation Lookaside Buffer (TLB), POWER8 supports lockless TLBIE operations. Locally Tested: * IBM POWER8 Revision 2.0, dual socket, 160 threads Differential Revision: https://reviews.freebsd.org/D54855 Approved by: jhibbits
* powerpc: Don't use cache to zero pagesJustin Hibbits2025-11-192-9/+6
| | | | | | | pmap_zero_page() may be called on uncached pages, so using the cache to zero uncached pages may trigger a fault. MFC after: 2 weeks
* powerpc: Use proper prototype for SYSINIT functionsZhenlei Huang2025-10-131-2/+2
| | | | MFC after: 1 week
* pmap: Degrade pmap_page_set_attr*() into a no-op on same attributeOlivier Certner2025-07-133-0/+10
| | | | | | | | | | | | For 32-bit arm, move the no-op test that was already in place at start of the function so that it stays first even if the '#if 0' block around the call to sf_buf_invalidate_cache() is uncommented at some point (if ever). Reviewed by: jeffpc_josefsipek.net, kib MFC after: 10 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51253
* pmap_growkernel(): do not panic immediately, optionally return the errorKonstantin Belousov2025-06-191-6/+7
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47935
* vm: remove pa_index from the machine-independent layerAlan Cox2025-06-131-1/+4
| | | | | | | | | | | After the demise of vm_page_lock(), the only remaining uses of pa_index() are in various pmap implementations. In many cases, e.g., amd64, the pmap implementations already provided their own definitions, often identical to the machine-independent one. For those that didn't provide one, this change adds it. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D50823
* vm: retire vm_page_lock()Alan Cox2025-06-111-1/+1
| | | | | | | | | | | vm_page_lock() and its underlying array of locks, pa_lock[], have been replaced throughout the virtual memory system by either atomics or busy-style, per-page synchronization. The Linux KPI support contained the only remaining use cases. Eliminate or update them as appropriate to each case. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D50767
* powerpc: replace tailq pointers with iteratorsDoug Moore2025-04-213-27/+37
| | | | | | | | Change architecture-specific code to use iterators rather than tailq pointers. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49927
* powerpc: silence compiler warningDoug Moore2025-04-211-0/+4
| | | | | | | | Function moea64_sp_demote_aligned() is only invoked if VM_NRESERVLEVEL > 0. Add #if/#endif pairs around the declaration and definition of that function to silence warnings about unused static functions. Reviewed by: kib
* powerpc: Add Hypervisor Facility Unavailable handlingJustin Hibbits2025-03-191-0/+1
| | | | | | | | | | Treat Hypervisor Facility Unavailable as an illegal instruction in user space. This way programs that use facilities like transactional memory, which will never be supported as it has been removed from the ISA, will not crash the kernel. Tested by: pkubaj MFC after: 1 week
* powerpc: mmu_radix_page_array_startup(): Don't force allocation from domain 0Olivier Certner2025-02-191-1/+1
| | | | | | | | | | | In this case, the domain from which the memory to back the VM page array is allocated does not matter, so just let vm_phys_early_alloc() choose a suitable domain. Reviewed by: jhibbits, markj MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48888
* pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pagesBojan Novković2024-07-301-3/+3
| | | | | | | | | | | This patch modifies pmap_growkernel in all pmaps to use VM_ALLOC_NOFREE when allocating new pagetable pages. This should help reduce longterm fragmentation as these pages are never released after they are allocated. Differential Revision: https://reviews.freebsd.org/D45998 Reviewed by: alc, markj, kib, mhorne Tested by: alc
* powerpc_mmu_radix: Release PTP reference on leaf ptpage allocation failureBojan Novković2024-06-161-1/+4
| | | | | | | | | | | | | | 0013741 fixed an edge case invloving mlock() and superpage creation by creating and inserting a leaf pagetable page for mlock'd superpages. However, the code does not properly release the reference to the pagetable page in the error handling path. This commit fixes the issue by adding calls to 'pmap_abort_ptp' in the error handling path. Reported by: alc Approved by: markj (mentor) Fixes: 0013741 Differential Revision: https://reviews.freebsd.org/D45582
* powerpc_mmu_radix: Introduce 'pmap_abort_ptp'Bojan Novković2024-06-161-11/+23
| | | | | | | | This commit moves code for releasing pagetable page references into a separate function. No functional change intended. Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D45581
* pmap: Skip some superpage promotion attempts that will failAlan Cox2024-06-041-2/+7
| | | | | | | | | | | | | Implement a simple heuristic to skip pointless promotion attempts by pmap_enter_quick_locked() and moea64_enter(). Specifically, when vm_fault() calls pmap_enter_quick() to map neighboring pages at the end of a copy-on-write fault, there is no point in attempting promotion in pmap_enter_quick_locked() and moea64_enter(). Promotion will fail because the base pages have differing protection. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D45431 MFC after: 1 week
* pmap: Convert boolean_t to bool.John Baldwin2024-01-313-118/+117
| | | | | Reviewed by: kib (older version) Differential Revision: https://reviews.freebsd.org/D39921
* powerpc_mmu_radix: add leaf page for wired mappings when pmap_enter(psind=1)Robert Wing2024-01-091-0/+32
| | | | | | | | | | This applies the fix to powerpc's pmap as was done in commit aa3bcaad51076ceb and d0941ed9b5c39d92 for amd64 and riscv pmaps, respectively. Reported by: Jenkins Reviewed by: bojan.novkovic_fer.hr, markj Fixes: e4078494f344bcba8709216bd601efa3dd05f6b3 Differential Revision: https://reviews.freebsd.org/D43339
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-272-2/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* powerpc pmap: initialize kernel pmap radix trieDoug Moore2023-09-131-0/+1
| | | | | | | | | | | | | | | | | | Commit 2d2bcba7ba70141388729ed49674b36fd01146c5 changed radix trie implementation and made it necessary that radix tries be initialized with vm_radix_init. @dbaio reports that in some configurations, there is a powerpc boot panic and that this commit introduced the problem. In powerpc/aim/mmu_radix.c, the radix trie in kernel_pmap is initialized by zeroing all its fields. Add a call to vm_radix_init to properly initialize kernel_pmap->pm_radix. Reported by: dbaio Reviewed by: alc, jhibbits Fixes: 2d2bcba7ba drop NULL check from radix trie search MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D41846
* powerpc_mmu_radix: include vm_radix.h fileDoug Moore2023-09-121-0/+1
| | | | | | | | Replacing _vm_radix.h with vm_radix.h in one header file leaves one source file short of function definitions. Include vm_radix.h in that source file. Fixes a problem rooted in change 429c871ddddac4bbf6abf1eb9e2e6603f87c2ef5.
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-166-12/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* sys: Remove $FreeBSD$: one-line .c comment patternWarner Losh2023-08-165-5/+0
| | | | Remove /^/[*/]\s*\$FreeBSD\$.*\n/
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-163-6/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-127-7/+7
| | | | | | | | | 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
* powerpc: Use valid prototypes for function declarations with no arguments.John Baldwin2023-04-241-2/+2
| | | | | Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D39733
* powerpc: fix a few pmap related functions to return correct typesDimitry Andric2023-04-233-8/+8
| | | | | | | | | | | While experimenting with changing boolean_t to another type, I noticed that several powerpc pmap related functions returned the wrong type: boolean_t instead of int. Fix several declarations and definitions to match the actual pmap function types: pmap_dev_direct_mapped_t and pmap_ts_referenced_t. MFC after: 3 days
* powerpc/pmap: Account for a potential NULL pmap in pmap_sync_icacheJustin Hibbits2023-03-211-0/+3
| | | | | | | | | | | It's apparently possible for pcpu->pc_curpmap to be NULL at some point, leading to a panic. Account for this as is done with the other 64-bit AIM pmap. Reported by: pkubaj Tested by: pkubaj Fixes: 6f0b2a235a1 ("Add pmap_sync_icache() for radix pmap") MFC after: 3 days
* powerpc/pmap: Add pmap_sync_icache() for radix pmapJustin Hibbits2023-03-121-0/+21
| | | | | | | DTrace pid provider writes to user space to set breakpoints. Failing to sync the icache can lead to SIGTRAP. Radix pmap is the only one missing a pmap_sync_icache() method, so the pid provider would only potentially crash a process on a POWER9 or later system.
* powerpc: fix warning: a function declaration without a prototype is ↵Piotr Kubaj2023-02-261-1/+1
| | | | | | | | | | | deprecated in all versions of C Reviewers: #powerpc Approved by: alfredo Subscribers: imp, jhibbits Differential Revision: https://reviews.freebsd.org/D38787
* powerpc: slb_alloc_user_cache: fix missing uma_zalloc wait flagAlfredo Dal'Ava Junior2022-10-031-1/+1
| | | | | | | | | Flags should be M_WAITOK | M_ZERO instead of just M_ZERO Reviewed by: markj MFC after: 2 days Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br) Differential Revision: https://reviews.freebsd.org/D36865
* kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.John Baldwin2022-09-221-1/+1
| | | | | | Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36549
* pmap_unmapdev/bios: Accept a pointer instead of a vm_offset_t.John Baldwin2022-09-223-10/+14
| | | | | | | | This matches the return type of pmap_mapdev/bios. Reviewed by: kib, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36548
* Define _NPCM and the last PC_FREEn constant in terms of _NPCPV.John Baldwin2022-08-231-1/+1
| | | | | | | | | | This applies one of the changes from 5567d6b4419b02a2099527228b1a51cc55a5b47d to other architectures besides arm64. Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36263
* Adjust function definition in moea64_native.c to avoid clang 15 warningDimitry Andric2022-08-151-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/moea64_native.c:306:22: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_install_native() ^ void This is because moea64_install_native() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* Fix unused variable warning in mmu_radix.cDimitry Andric2022-08-151-1/+8
| | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/mmu_radix.c:5409:22: error: variable 'freed' set but not used [-Werror,-Wunused-but-set-variable] int allfree, field, freed, idx; ^ The 'freed' variable is only used when PV_STATS is defined. Ensure it is only declared and set in that case. MFC after: 3 days
* Adjust function definitions in mmu_radix.c to avoid clang 15 warningsDimitry Andric2022-08-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/powerpc/aim/mmu_radix.c:786:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_tlbie_all() ^ void sys/powerpc/aim/mmu_radix.c:3615:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_init() ^ void sys/powerpc/aim/mmu_radix.c:6081:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mmu_radix_scan_init() ^ void This is because mmu_radix_tlbie_all(), mmu_radix_init(), and mmu_radix_scan_init() are declared with (void) argument lists, but defined with empty argument lists. Make the definitions match the declarations. MFC after: 3 days
* Adjust function definitions in mmu_oea64.c to avoid clang 15 warningsDimitry Andric2022-08-151-2/+2
| | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/powerpc/aim/mmu_oea64.c:1947:12: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_init() ^ void sys/powerpc/aim/mmu_oea64.c:3257:17: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] moea64_scan_init() ^ void This is because moea64_init() and moea64_scan_init() are declared with (void) argument lists, but defined with empty argument lists. Make the definitions match the declarations. MFC after: 3 days
* Adjust function definition in aim_machdep.c to avoid clang 15 warningDimitry Andric2022-08-151-1/+1
| | | | | | | | | | | | | | | With clang 15, the following -Werror warning is produced: sys/powerpc/aim/aim_machdep.c:750:14: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] mpc745x_sleep() ^ void This is because mpc745x_sleep() is declared with a (void) argument list, but defined with an empty argument list. Make the definition match the declaration. MFC after: 3 days
* AST: reworkKonstantin Belousov2022-08-022-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Make most AST handlers dynamically registered. This allows to have subsystem-specific handler source located in the subsystem files, instead of making subr_trap.c aware of it. For instance, signal delivery code on return to userspace is now moved to kern_sig.c. Also, it allows to have some handlers designated as the cleanup (kclear) type, which are called both at AST and on thread/process exit. For instance, ast(), exit1(), and NFS server no longer need to be aware about UFS softdep processing. The dynamic registration also allows third-party modules to register AST handlers if needed. There is one caveat with loadable modules: the code does not make any effort to ensure that the module is not unloaded before all threads processed through AST handler in it. In fact, this is already present behavior for hwpmc.ko and ufs.ko. I do not think it is worth the efforts and the runtime overhead to try to fix it. Reviewed by: markj Tested by: emaste (arm64), pho Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D35888
* powerpc: Use __diagused for variables only used in KASSERT().John Baldwin2022-04-131-3/+3
|
* powerpc cpudep_ap_setup: Quite unused variable warnings.John Baldwin2022-04-121-5/+7
|
* powerpc: Remove unused variables.John Baldwin2022-04-121-2/+0
|