aboutsummaryrefslogtreecommitdiff
path: root/sys/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* powerpc: Add ISA 2.06 sub-word atomic set/clearJustin Hibbits4 hours1-26/+56
| | | | | | | Add atomic_set/clear_short/char for doing 8-bit and 16-bit operations more efficiently on "newer" architectures (POWER7 and later). Piggybacks on b31abc95eb.
* Remove all code under __SPE__Minsoo Choo5 days8-111/+0
| | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1957
* conf: remove powerpcspeMinsoo Choo7 days1-685/+0
| | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1914 (cherry picked from commit 4a5a1c17ac43356fae053524187bb16f8fc1ac70)
* conf: remove MPC85XXSPEMinsoo Choo7 days1-151/+0
| | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1914 (cherry picked from commit 40a49bccf388494f9685a81cfa781050f5f8bb1f)
* param.h: remove powerpcspeMinsoo Choo7 days1-4/+0
| | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1914 (cherry picked from commit 1bfae8b50814697ac12bc8879ad8013e7ffd77b2)
* powerpc: put the isync inside the TD_LOCK() checking loopAdrian Chadd13 days2-2/+2
| | | | | | | | | | | | | | | | | | | Fix a narrow window where the lock is unlocked but the checking CPU hasn't flushed things appropriately. Inside this window the CPU inside cpu_switch() will loop forever thinking the destination thread is still blocked/locked even though it is not. This manifests as the system hanging after starting all APs. I've seen this reliably trigger in qemu-system-ppc64 running power9 pseries guests; the more CPUs the more likely it triggers at boot. PR: kern/292167 Differential Revision: https://reviews.freebsd.org/D54478 Reviewed by: jhibbits MFC after: 1 week Relnotes: yes
* powerpc/intr: Minor cleanupJustin Hibbits2025-12-201-7/+1
| | | | Use MTX_SYSINIT() instead of rolling our own.
* 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
* bus_alloc_resource: Pass rid by value to BUS_ALLOC_RESOURCE DEVMETHODJohn Baldwin2025-12-098-38/+34
| | | | | | | | | The wrapper functions such as bus_alloc_resource_any() still support passing the rid by value or pointer, but the underlying implementation now passes by value. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D53402
* powerpc/_stdint.h: fix SIG_ATOMIC_{MIN,MAX,WIDTH}Robert Clausecker2025-12-021-10/+5
| | | | | | | | | | | | | On powerpc/powerpc64, sig_atomic_t is an int, but was treated as if it was a long by <machine/_stdint.h>. This was finally caught by the unit test added with 4a1c752 / D53831. Reported by: kib Reviewed by: kib, imp Approved by: markj (mentor) Fixes: c3e289e1ce8c9af8d14e9f727632e22b3bf901f9 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D54026
* sys/stdint.h: add C23 _WIDTH macrosRobert Clausecker2025-11-301-0/+33
| | | | | | | | | | | | | | 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: RealTek -> Realtekykla2025-11-272-4/+4
| | | | | | | | | | | Realtek changed how it styled its name 25 or so years ago, but the old style persisted in many places. These products use the new styling in their datasheets. Signed-off-by: ykla yklaxds@gmail.com Sponsored by: Chinese FreeBSD Community Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1901
* powerpc: Don't use cache to zero pagesJustin Hibbits2025-11-194-15/+10
| | | | | | | 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
* random: allow disabling of entropy harvesting from keyboard & miceDavid E. O'Brien2025-11-112-0/+8
| | | | | | Reviewed by: jmg Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D53390
* powerpc: Move openpic_intr, since it's hidden nowJustin Hibbits2025-10-301-11/+11
| | | | | | | | | Last minute change by me (diff reduction), that I didn't build. This was in the original commit. Fixes: 8fb1789612 ("intr/powerpc: create openpic_class kobj") MFC after: 2 weeks X-MFC-with: 8fb1789612
* intr/powerpc: create openpic_class kobjElliott Mitchell2025-10-305-52/+38
| | | | | | | | | | | | Using kobj allows implementing most PIC functions merely by inheriting from the parent class. As there are multiple OpenPIC implementations, this ensures all common hooks go through by default. Note, this adds the suspend/resume functions to other PICs. This should be harmless as suspend/resume isn't working on the devices anyway. Reviewed by: jhibbits MFC after: 2 weeks
* intr/powerpc: cleanup extraneous spaces in PowerMAC CPC HT driverElliott Mitchell2025-10-301-10/+10
| | | | | | | | Spotted while examing this driver. Remove some end of line spaces/tabs. Replace some spaces which should instead be tabs. Reviewed by: jhibbits MFC after: 2 weeks
* 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
* imgact: Mark brandinfo and note structures as constZhenlei Huang2025-10-182-10/+10
| | | | | | | | | No functional change intended. Reviewed by: kib MFC after: 10 days MFC with: 80336636b6b9f7a3bdad007c400e85eae017d2a2 Differential Revision: https://reviews.freebsd.org/D53173
* powerpc: Use proper prototype for SYSINIT functionsZhenlei Huang2025-10-132-3/+4
| | | | MFC after: 1 week
* u2f(4): Invert U2F_MAKE_UHID_ALIAS kernel build optionVladimir Kondratyev2025-09-252-2/+0
| | | | | | | This makes non-GENERIC kernel configs easier to maintain. Requested by: glebius MFC after: 2 days
* arm, powerpc, riscv: implement atomic_set/clear_16Konstantin Belousov2025-09-201-1/+32
| | | | | | | Reviewed by: jrtc27, markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52626
* sys: NOTES: Fix comment for wlan_* devices; GENERIC*: Re-order 'wlan_tkip'Olivier Certner2025-09-092-2/+2
| | | | | | | | | | | | | | | | | Fix the comment introducing the 'wlan_*' devices (AES-CCMP is missing) after introducing AES-GCMP. While here, re-order the devices in order of appearance of the related technologies. No functional change (intended). Reviewed by: adrian, emaste Fixes: 7bf82ea4fdda ("sys: add wlan_gcmp to GENERIC kernels as appropriate") MFC after: 3 days MFC to: stable/15 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52444
* u2f(4): a HID driver for FIDO/U2F security keysVladimir Kondratyev2025-08-172-0/+2
| | | | | | | | | | | | | | | | | While FIDO/U2F keys were already supported by the generic uhid(4) and hidraw(4) drivers, this driver adds some additional features an does steps to tighten the security of FIDO/U2F access. - It automatically loads through devd. - Automatically enables HQ_NO_READAHEAD for FIDO/U2F devices. - Implements only miminum set of features. - Do not requires external devfs configuration to set character device permissions. - Names character device as u2f/# to make possible capsicum or any other pledge()-style sandboxing. PR: 265528 Differential Revision: https://reviews.freebsd.org/D51612
* gpio: remove gpiobus_attach_busAhmad Khalifa2025-08-131-1/+2
| | | | | | | | | | | | Since gpiobus_attach_bus can attach the gpiobus child along with its children in the same bus pass, the parent controller's reference to gpiobus might not be set by the time the children need it. Instead, drivers should use gpiobus_add_bus and explicitly call bus_attach_children. Reviewed by: mmel, imp (older version) Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D51578
* busdma: another fix for small bounce transfersMitchell Horne2025-08-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More fallout from a77e1f0f81df. When the tag has an alignment requirement but a small (remaining) transfer size, the transfer will be rounded up to exceed its bounds, resulting in memory corruption. The issue is observed on powerpc as noted in the pull request: https://github.com/freebsd/freebsd-src/pull/1415 I also observe the issue locally on riscv hardware, with an 8-byte transfer having 64-byte alignment. There is some uncertainty about the purpose/need for the alignment roundup; both its original intention and present effect. Notably, it is no longer present at all in arm/arm64 implementations. Possibly, this roundup can be removed altogether, but this requires more careful analysis of the edge-cases and history of the property. For now, simply clamp sgsize to be no larger than the remaining buflen, as this is certain to be correct within the current scheme and fixes the affected transfers. Discussed with: jhb, markj MFC after: 3 weeks Fixes: a77e1f0f81df ("busdma: better handling of small segment bouncing") Sponsored by: The FreeBSD Foundation Pull Request: https://github.com/freebsd/freebsd-src/pull/1415 Signed-off-by: Chattrapat Sangmanee <aomsin27@hotmail.co.th> Co-authored-by: Chattrapat Sangmanee <aomsin27@hotmail.co.th> Differential Revision: https://reviews.freebsd.org/D47807
* powerpc: Fix multiple issues with FP/VSX save/restoreTimothy Pearson2025-07-134-22/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Multiple issues existed within the powerpc FP/VSX save/restore functionality, leading to register corruption and loss of register contents in specific scenarios involving high signal load and use of both floating point and VSX instructions. Issue #1 On little endian systems the PCB used the wrong location for the shadowed FP register within the larger VSX register. This appears to have been an attempt to correct issue #2 without understanding how the vector load/store instructions actually operate. Issue #2 On little endian systems, the VSX state save/restore routines swapped 32-bit words within the 64-bit aliased double word for the associated floating point register. This was due to the use of a word-oriented load/store vs. doubleword oriented load/store. Issue #3 The FPU was turned off in the PCB but not in hardware, leading to a potential race condition if the same thread was scheduled immediately after sigreturn. The triggering codebase for this is Go, which makes heavy use of signals and and generates an unusual mix of floating point and VSX assembler. As a result, when combined with th powerpc lazy FPU restore, a condition was repeatedly hit whereby the thread was interrupted in FP+VSX mode, then restored in FP only mode, thus reliably triggering the issues above. Also clean up the associated asm() style issue flagged by GitHub Actions. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1756
* powerpc: Reserve correct scratch region size below stackTimothy Pearson2025-07-131-3/+3
| | | | | | | | | | | | | According to the ELF ABI v2, two scratch regions are reserved below the stack pointer, one 288 byte general region and one 224 byte compiler region. FreeBSD only reserved the 288 byte region. Follow the ELV v2 ABI and reserve the full 512 byte region as specified. Signed-off-by: Timothy Pearson <tpearson@raptorengineering.com> MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1756
* 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
* gpio: attach gpiobus when the controller is readyAhmad Khalifa2025-07-041-2/+2
| | | | | | | | | | Only attach gpiobus when the controller is fully initialized. Children of gpiobus expect this to be the case. Reviewed by: mmel, imp, andrew Approved by: imp (mentor) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D51088
* nexus: Add device_shutdown where missingJustin Hibbits2025-06-251-0/+1
| | | | | | | | | | | | | At shutdown devices may need to do extra work to clean up state, etc. This is done in a device_shutdown kobj method on a driver, with the default being a `do nothing` method. Only x86's nexus driver includes the device_shutdown method to propagate down to its children, so on other architectures the device_shutdown stops at the root, and thus device_shutdown is never called for any real devices. Add this missing method to the nexus drivers of the other architectures so devices have a chance to properly shutdown. Sponsored by: Juniper Networks, Inc.
* sys: Add AT_HWCAP3 and AT_HWCAP4Andrew Turner2025-06-243-0/+7
| | | | | | | | | It is likely we will need these on arm64. Add them in preparation for flags in these to be added at some point in the future. Reviewed by: brooks, imp, kib Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D51005
* newbus: replace leftover device unit wildcardsAhmad Khalifa2025-06-2110-15/+16
| | | | | | Reviewed by: imp, jhb Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D50913
* pmap_growkernel(): do not panic immediately, optionally return the errorKonstantin Belousov2025-06-193-9/+27
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47935
* runq: Deduce most parameters, remove machine headersOlivier Certner2025-06-181-55/+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
* 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-112-7/+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
* machine/stdarg.h -> sys/stdarg.hBrooks Davis2025-06-117-7/+7
| | | | | | | | | | | | | Switch to using sys/stdarg.h for va_list type and va_* builtins. Make an attempt to insert the include in a sensible place. Where style(9) was followed this is easy, where it was ignored, aim for the first block of sys/*.h headers and don't get too fussy or try to fix other style bugs. Reviewed by: imp Exp-run by: antoine (PR 286274) Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
* thr_new: pass params.flags to cpu_set_user_tls()Konstantin Belousov2025-05-311-1/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week
* powerpc: Enable VIMAGE on more kernel configsLi-Wen Hsu2025-05-203-0/+3
| | | | Sponsored by: The FreeBSD Foundation
* Revert "powernv: Add RF_BIGENDIAN resource flag"Justin Hibbits2025-05-144-6/+3
| | | | | | | | | | | After further thinking, the nexus bus mappings are for the immediate peripherals, not downstream. Given this, and that historically PowerPC platforms have been big-endian by default, it makes sense to default mappings to BE always. If this changes in the future, the platform devices can explicitly mark their mappings with the RF_LITTLEENDIAN flag instead. This reverts commit 86d20eaadfd1a03e19d8bc8333c689b820299d52.
* powernv: Add RF_BIGENDIAN resource flagJustin Hibbits2025-05-134-3/+6
| | | | | | | | | | | | | The big-endian analogue to the RF_LITTLEENDIAN flag, if this flag is set on a memory resource it's always mapped big endian. This is needed by the PowerNV OPAL resources (XIVE and PCI), as these top-level peripherals are always big-endian. Tested by: pkubaj Fixes: c4921a0f("powerpc: Always use BE tag in nexus_map_resource") MFC after: 1 day X-MFC-with: c4921a0f
* powerpc: Always use BE tag in nexus_map_resourceJustin Hibbits2025-05-131-1/+1
| | | | | | | | | | | | | | | | 7b5a5e4e replaced nexus_activate_resource() with the bus generic equivalent, which uses bus_map_resource(). However, though not intended to have a functional change, nexus_map_resource() uses the bus tag of the build (BE vs LE), while nexus_activate_resource() always explicitly set a big-endian tag, leading to failures on powerpc64le now. Using BE unless otherwise explicitly specified with the RF_LITTLEENDIAN fixes LE on bare metal, and doesn't hurt in a VM, which nexus_map_resource() was added for. Reported by: pkubaj Tested by: pkubaj Fixes: 7b5a5e4e("powerpc nexus: Use bus_generic_rman_*") MFC after: 1 day
* powerpc: add missing headerDoug Moore2025-04-211-0/+1
| | | | | | Add missing vm/vm_radix.header. Fixes: b6cd84ca2d08 ("powerpc: replace tailq pointers with iterators")
* powerpc: replace tailq pointers with iteratorsDoug Moore2025-04-214-33/+46
| | | | | | | | 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/trap: Change prediction of NOFAULTING in trap_pfault()Justin Hibbits2025-03-291-1/+1
| | | | | | | This was probably intended to match the amd64 check, but that tests NOFAULTING against non-zero, while this checks against 0. We're most likely to end up in this function when faulting is allowed, so predict_true is the better option.
* sys: add wlan_gcmp to GENERIC kernels as appropriateAdrian Chadd2025-03-272-0/+2
| | | | | | | Add wlan_gcmp wherever CCMP is defined in kernel configs. Differential Revision: https://reviews.freebsd.org/D49343 Reviewed by: bz, cy
* powernv: Explicitly enable the facilities we supportJustin Hibbits2025-03-192-0/+11
| | | | | | | | | | Thus far we've relied on the firmware setting HFSCR correctly, enabling all facilities. However, it appears some recent firmwares do not. Linux explicitly enables all facilities it supports (including transactional memory, which new firmwares apparently do not enable), so do the same here, explicitly enable all the facilities FreeBSD supports. MFC after: 1 week