aboutsummaryrefslogtreecommitdiff
path: root/sys/arm
Commit message (Collapse)AuthorAgeFilesLines
* arm: Use the correct irq when in the hypervisorAndrew Turner2024-05-171-7/+18
| | | | | | | | | | When booting in the hypervisor state we need to use the hypervisor interrupt in the generic timer. In this case the registers we access in the kernel are remapped to the EL2 versions, however this causes an unexpected interrupt to trigger. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43975
* arm: Add a missing interrupt to the generic timerAndrew Turner2024-05-171-0/+2
| | | | | | | | | | The ACPI generic timer attachment added 3 interrupts, but missed the hypervisor physical interrupt. As the field is present in all versions of the GTDT ACPI table and isn't an optional interrupts we can add it to the interrupts provided to the driver. Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D43974
* uio: Use switch statements when handling UIO_READ vs UIO_WRITEJohn Baldwin2024-05-101-4/+12
| | | | | | | | | | This is mostly to reduce the diff with CheriBSD which adds additional constants to enum uio_rw, but also matches the normal style used for uio_segflg. Reviewed by: kib, emaste Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D45142
* 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/pmu: remove passing trap frame as argumentElliott Mitchell2024-05-091-7/+3
| | | | | | | | | | While otherwise a handy potential approach, getting the trap frame via the argument isn't documented and isn't supposed to be used. Adjust pmu_intr() to instead use curthread->td_intr_frame, which is the proper way. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1126
* busdma: better handling of small segment bouncingMitchell Horne2024-05-071-14/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Typically, when a DMA transaction requires bouncing, we will break up the request into segments that are, at maximum, page-sized. However, in the atypical case of a driver whose maximum segment size is smaller than PAGE_SIZE, we end up inefficiently assigning each segment its own bounce page. For example, the dwmmc driver has a maximum segment size of 2048 (PAGE_SIZE / 2); a 4-page transfer ends up requiring 8 bounce pages in the current scheme. We should attempt to batch segments into bounce pages more efficiently. This is achieved by pushing all considerations of the maximum segment size into the new _bus_dmamap_addsegs() function, which wraps _bus_dmamap_addseg(). Thus we allocate the minimal number of bounce pages required to complete the entire transfer, while still performing the transfer with smaller-sized transactions. For most drivers with a segment size >= PAGE_SIZE, this will have no impact. For drivers like dwmmc mentioned above, this improves the memory and performance efficiency when bouncing a large transfer. Co-authored-by: jhb Reviewed by: jhb MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45048
* busdma: deduplicate _bus_dmamap_addseg() functionMitchell Horne2024-05-071-41/+4
| | | | | | | | | | | | It is functionally identical in all implementations, so move the function to subr_busdma_bounce.c. The KASSERT present in the x86 version is now enabled for all architectures. It should be universally applicable. Reviewed by: jhb MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D45047
* arm: Remove stray references to dev/sound/chip.hChristos Margiolis2024-05-064-4/+0
| | | | | | | Fixes: 923e0040a59a ("sound: Move chip.h contents to pcm/sound.h") Reported by: Jenkins CI Sponsored by: The FreeBSD Foundation MFC after: 1 week
* arm: Remove duplicate definitions in armreg.hMark Johnston2024-04-301-2/+0
| | | | | | No functional change intended. MFC after: 1 week
* sys/*/conf: do not use "../../conf/" when including std.*Lexi Winter2024-04-233-3/+3
| | | | | | | | Since config(8) searches sys/conf by default, there's no need to specify the full relative path here; replace it by the filename alone. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1124
* sys: add conf/std.debug, generic debugging optionsLexi Winter2024-04-232-22/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new sys/conf/std.debug contains the list of debugging options enabled by default in -CURRENT, so they don't need to be listed individually in every kernel config. The enabled options are the set of all debug options which were enabled for the GENERIC kernel on any platform. This means some architectures now have debugging options enabled in GENERIC which weren't previously enabled: - amd64: [1] - arm64: [2] - arm: [2]. [3] - i386: [1], [2] - powerpc: [1], [2], [3] - riscv: [2] [1] ALT_BREAK_TO_DEBUGGER is now enabled. [2] BUF_TRACKING, FULL_BUF_TRACKING, and QUEUE_MACRO_DEBUG_TRASH are now enabled. [3] DEADLKRES is now enabled. While here, move the documentation for the (commented out) K*SAN options for amd64 from GENERIC to NOTES. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1124
* Enable L1SS handling on RPI4 pcibHP van Braam2024-04-211-4/+18
| | | | | | | | | | | | | | | | | | | Thanks to @kevans91 for pointing me in the right direction. FreeBSD had the same bug as Linux (see https://bugzilla.kernel.org/show_bug.cgi?id=217276) where the ultimate solution was to honor the brcm,enable-l1ss FDT property. In current versions of the dtb files this property has been added by default. Without this on many, many pcie addin cards the pcib will Serror when trying to assert the clreq# pin on the pcie bus. Many cards do not have these hooked up. PR: 260131, 277638, 277605 Reviewed-by: emaste Signed-off-by: HP van Braam <hp@tmm.cx> Pull-request: https://github.com/freebsd/freebsd-src/pull/1179
* freescale: Fix a typo in a source code commentGordon Bergling2024-04-211-1/+1
| | | | | | - s/cant/can't/ MFC after: 3 days
* arm: Fix a typo in a KASSERT messageGordon Bergling2024-04-191-1/+1
| | | | | | - s/resoure/resource/ MFC after: 5 days
* bcm2838_xhci: add moduleLexi Winter2024-04-101-0/+2
| | | | | | | | | | | | | | | | | | | | | bcm2838_xhci(4) is a shim for the XHCI controller on the Raspberry Pi 4B SoC. It loads the controller's firmware before passing control to the normal xhci(4) driver. When xhci(4) is built as a module (and not in the kernel), bcm2838_xhci is not built at all and the RPi4's XHCI controller won't attach due to missing firmware. To fix this, build a new module, bcm2838_xhci.ko, which depends on xhci.ko. For the dependency to work correctly, also modify xhci to provide the 'xhci' module in addition to the 'xhci_pci' module it already provided. Since bcm2838_xhci is specific to a quirk of the RPi4 SoC, only build the module for AArch64. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1142
* NOTES: Add devices for iSCSI supportJohn Baldwin2024-04-091-0/+1
| | | | | | Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44688
* NOTES: Move OFED options to MI NOTESJohn Baldwin2024-04-091-0/+5
| | | | | | | | Disable in armv7 NOTES to match sys/modules/Makefile Reviewed by: imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D44686
* ktrace: Record syscall violations with KTR_CAPFAILJake Freeland2024-04-071-15/+12
| | | | | | | | | | Report syscalls that are not allowed in capability mode with CAPFAIL_SYSCALL. Reviewed by: markj Approved by: markj (mentor) MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D40678
* vf_i2c: split up and add ACPI attachments in addition to FDTPierre-Luc Drouin2024-03-292-611/+2
| | | | | | | | | | | Move the code from the arm specific to the iicbus controller directory. Split up between general logic and bus attachment code. Add support for ACPI attachment in addition to FDT. MFC after: 7 days Tested by: bz (LS1088a FDT), Pierre-Luc Drouin (Honeycomb, ACPI) Based on: D24917 by Val Packett (initial early version) Differential Revision: https://reviews.freebsd.org/D44020
* arm: Remove TI from NOTESEmmanuel Vadot2024-03-281-3/+0
| | | | | | TI support was removed so remove it from NOTES too. Sponsored by: Beckhoff Automation GmbH & Co. KG
* arm/GENERIC: Remove TI DTBsEmmanuel Vadot2024-03-201-2/+0
| | | | | | | We've removed TI support in 3416e102c4e9 ("arm: Remove TI code from GENERIC") so no need to build the DTBs now. Sponsored by: Beckhoff Automation GmbH & Co. KG
* arm busdma: Fix parameter types to exclusion_bounce_checkJohn Baldwin2024-03-151-1/+1
| | | | | | | | These are bus addresses not CPU virtual addresses. Reviewed by: andrew Sponsored by: University of Cambridge, Google, Inc. Differential Revision: https://reviews.freebsd.org/D44343
* new-bus: Remove the 'rid' and 'type' arguments from BUS_RELEASE_RESOURCEJohn Baldwin2024-03-131-10/+6
| | | | | | | | | | The public bus_release_resource() API still accepts both forms, but the internal kobj method no longer passes the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44131
* new-bus: Remove the 'rid' and 'type' arguments from BUS_*ACTIVATE_RESOURCEJohn Baldwin2024-03-132-31/+18
| | | | | | | | | | The public bus_activate/deactivate_resource() API still accepts both forms, but the internal kobj methods no longer pass the arguments. Implementations which need the rid or type now use rman_get_rid() or rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44130
* new-bus: Remove the 'type' argument from BUS_MAP/UNMAP_RESOURCEJohn Baldwin2024-03-132-11/+11
| | | | | | | | | | The public bus_map/unmap_resource() API still accepts both forms, but the internal kobj methods no longer pass the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44129
* new-bus: Remove the 'type' argument from BUS_ADJUST_RESOURCEJohn Baldwin2024-03-131-7/+6
| | | | | | | | | | The public bus_adjust_resource() API still accepts both forms, but the internal kobj method no longer passes the argument. Implementations which need the type now use rman_get_type() to fetch the value from the allocated resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44128
* imgact_elf: Add const to the header_supported callback argumentsAlex Richardson2024-03-041-4/+4
| | | | | | | | This callback shouldn't be modifying any of the arguments. Reviewed by: imp, kib, emaste, jhb Obtained from: CheriBSD Differential Revision: https://reviews.freebsd.org/D44193
* conf: deduplicate dwmmc config logicMitchell Horne2024-02-272-2/+0
| | | | | | | | | | | | | The core of this driver is supported by multiple architectures. Move the config entries to the MI conf/files. This hardware is found on several available/emerging RISC-V SoCs, so we will soon need it on this architecture. Reviewed by: manu MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D44104
* ath(4): always enable 11nBjoern A. Zeeb2024-02-221-1/+0
| | | | | | | | | | | | | Enabling 11n for ath(4) so far was handled by a kernel option, which was only enabled for certain kernel configurations. In order to allow loading ath(4) as a module with 11n support on all platforms, remove the kernel option and unconditionally enable 11n in ath(4). Reported by: pkubaj Discussed with: adrian in D43549. Reviewed by: adrian, imp Differential Revision: https://reviews.freebsd.org/D43964
* arm: Set NEW_PCIB in DEFAULTS rather than a subset of kernel configsJessica Clarke2024-02-223-2/+2
| | | | | | | | | | | | | | | | | | | All other architectures set NEW_PCIB in DEFAULTS, with arm being the one remaining straggler that only sets it for GENERIC and TEGRA124. ARMADA38X and ARMADAXP contain device pci but don't set NEW_PCIB, however GENERIC claims to support them and as part of that NEW_PCIB support was added to mv_pci, so these configs are most likely just stale. Other than NOTES that just leaves ALPINE as the one kernel with PCI support not covered by GENERIC, but al_pci is supported by arm64 which enables NEW_PCIB, and it's just a generic_pcie_fdt_driver with some fixup code to deal with quirks so should support PCI_RES_BUS just fine. Therefore it is believed that all in-tree kernel configs support NEW_PCIB in reality, and so let's take a step towards removing all the non-NEW_PCIB code by having it always-on everywhere. Reviewed by: emaste, jhb, manu MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D43806
* aw_gpio: temporarily switch to input function if read in eint modeAndriy Gapon2024-02-181-0/+12
| | | | | | | | This is needed for gpiokeys driver that needs to read input state after receiving an interrupt for either edge. PR: 248138 MFC after: 1 month
* busdma: fix page miscount for small segment sizesMitchell Horne2024-02-161-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For small segments (< PAGE_SIZE) there is a mismatch between how required bounce pages are counted in _bus_dmamap_count_pages() and bounce_bus_dmamap_load_buffer(). This problem has been observed on the RISC-V VisionFive v2 SoC (and earlier revisions of the hardware) which has memory physically addressed above 4GB. This requires some bouncing for the dwmmc driver, which has has a maximum segment size of 2048 bytes. When attempting to load a page-aligned 4-page buffer that requires bouncing, we can end up counting 4 bounce pages for an 8-segment transfer. These pages will be incorrectly configured to cover only the first half of the transfer (4 x 2048 bytes). Fix the immediate issue by adding the maxsegsz check to _bus_dmamap_count_pages(); this is what _bus_dmamap_count_phys() does already. The result is that we will inefficiently allocate a separate bounce page for each segment (8 pages for the example above), but the transfer will proceed in its entirety. The more complete fix is to address the shortcomings in how small segments are assigned to bounce pages, so that we opportunistically batch multiple segments to a page whenever they fit (e.g. two 2048 bytes segments per 4096 page). This will be addressed more holistically in the future. For now this change will prevent the (silent) incomplete transfers that have been observed. PR: 273694 Reported by: Jari Sihvola <jsihv@gmx.com> Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D34118
* arm: Add EARLY_PRINTF and SOCDEV_PA/VA to NOTESAndrew Turner2024-02-131-0/+8
| | | | | | This ensures they are build tested. Sponsored by: Arm Ltd
* arm: Clean up socdev_vaAndrew Turner2024-02-132-0/+15
| | | | | | | | 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
* arm: Move locore-v6.S to locore.SWarner Losh2024-02-061-0/+0
| | | | | | | | | As a separate commit, now move locore-v6.S to locore.S. This makes git annotate work, at least back to 2014 when Ian created locore-v6.S. svn didn't save enough metadata for the converter to allow it to go back further. Sponsored by: Netflix
* arm: Use locore-v6.S directlyWarner Losh2024-02-061-35/+0
| | | | | | | | | Use locore-v6.S directly, rather than indirectly via including locore.S. This loses acle-compat.h inclusion, but that's only needed for gcc 4.8 and earlier. Since we don't support anything that old, there's no need for it here. Sponsored by: Netflix
* arm: Catchup to atmel retirementWarner Losh2024-02-061-2/+1
| | | | | | | | AT91 boot2 loaders have been long gone, and don't support the AT91 parts that have armv7 cores (since we don't have specific support for that). Mentioning its interface is OBE, so remove it. Sponsored by: Netflix
* ddb: Remove useless includesWarner Losh2024-02-061-2/+0
| | | | | | | systm.h was included for boothowto here, but it's not used here, so drop this include. Also sys/cdefs.h isn't needed, drop it too. Sponsored by: Netflix
* arm: pmap_extract() returns a PA not a boolean valueJohn Baldwin2024-02-021-1/+1
| | | | | | | Assume a PA of 0 indicates an invalid virtual address. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D43694
* x86 & arm: remove CAM_DEBUG_FLAGS= from MMCCAM kernelsMina Galić2024-02-021-5/+1
| | | | | | | | we leave `options CAMDEBUG` enabled, so that when needed, CAM debugging can be enabled *as needed*, rather than setting a default of everything. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/798
* arm: fix typo in GENERIC-MMCCAMMina Galić2024-02-021-1/+1
| | | | | Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/798
* pmap: Convert boolean_t to bool.John Baldwin2024-01-313-89/+89
| | | | | Reviewed by: kib (older version) Differential Revision: https://reviews.freebsd.org/D39921
* intrng: Allow alternative IPI PICs to be registered and usedJessica Clarke2024-01-243-1/+26
| | | | | | | | | | | | | | | | | | On RISC-V, the root PIC (whether the PLIC or, as will be the case in future, the local interrupt controller) cannot send IPIs, relying on another means to trigger the necessary software interrupts (firmware calls), but there are upcoming standard devices that will be able to inject them, so we can't just put the firmware calls in the root PIC driver. Thus, split out a new intr_ipi_dev from intr_irq_root_dev to use for sending IPIs. New devices can be registered with a given priority up until the first IPI is set up, when the best device seen so far gets frozen as the IPI device to use. Reviewed by: mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D35899
* intrng: Extract arm/arm64 IPI->PIC glue codeJessica Clarke2024-01-243-142/+7
| | | | | | | | | | | | | | | | | | | | | | | | | 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
* intrng: Remove irq_root_ipicount and corresponding intr_pic_claim_root argJessica Clarke2024-01-246-8/+6
| | | | | | | | | | | | | The static irq_root_ipicount variable is only ever written to (with the value passed to irq_root_ipicount), never read. Moreover, the bcm2836 driver, as used by the Raspberry Pi 2B and 3A/B (but not 4, which uses a GIC-400, though does have the legacy interrupt controller present too) passes 0 as ipicount, despite implementing IPIs. It's thus inaccurate and serves no purpose, so should be removed. Reviewed by: mmel, imp, mhorne MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D35897
* arm mv_pcib: Use bus_generic_rman_*John Baldwin2024-01-231-23/+157
| | | | | | | | | | | | | - Implement bus_get_rman pulling bits from mv_pcib_alloc_resource. - Implement bus_map/unmap_resource pulling bits from mv_pcib_activate/deactivate_resource. - Use bus_generic_rman_* to handle memory and I/O resources for mv_pcib_alloc/activate/adjust/deactivate/release_resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43438
* arm nexus: Use bus_generic_rman_*John Baldwin2024-01-231-123/+97
| | | | | | | | | | | | | | | - Implement bus_get_rman pulling bits from nexus_alloc_resource. - Implement bus_map/unmap_resource pulling bits from nexus_activate/deactivate_resource. - Use bus_generic_rman_* for bus_alloc/adjust/activate/deactivate/release_resource except for custom interrupt activate/deactivate logic still in nexus_activate/deactivate_resource. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D43437
* arm/mpic: remove empty pic_init_secondary() hookElliott Mitchell2024-01-231-7/+0
| | | | | | | | | The default hook does nothing, so having an empty handler is pointless. Simple cleanup. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D40475
* uart(4): Honor hardware state of NS8250-class for tsw_busyMarius Strobl2024-01-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | In 9750d9e5, I brought the equivalent of the TS_BUSY flag back in a mostly hardware-agnostic way in order to fix tty_drain() and, thus, TIOCDRAIN for UARTs with TX FIFOs. This proved to be sufficient for fixing the regression reported. So in light of the release cycle of FreeBSD 10.3, I decided that this change was be good enough for the time being and opted to go with the smallest possible yet generic (for all UARTs driven by uart(4)) solution addressing the problem at hand. However, at least for the NS8250-class the above isn't a complete fix as these UARTs only trigger an interrupt when the TX FIFO became empty. At this point, there still can be an outstanding character left in the transmit shift register as indicated via the LSR. Thus, this change adds the 3rd (besides the tty(4) and generic uart(4) bits) part I had in my tree ever since, adding a uart_txbusy method to be queried in addition for tsw_busy and hooking it up as appropriate for the NS8250-class. As it turns out, the exact equivalent of this 3rd part later on was implemented for uftdi(4) in 9ad221a5. While at it, explain the rational behind the deliberately missing locking in uart_tty_busy() (also applying to the generic sc_txbusy testing already present).
* syscon: Move syscon code in dev/sysconEmmanuel Vadot2024-01-1014-15/+15
| | | | | | | | | | | We've removed kernel option EXT_RESOURCES almost two years ago. While it was ok to have some code under a common 'extres' subdirectory at first, we now have a lot of consumer of it and we made it mandatory so no need to have it under a cryptic name. Reviewed by: mhorne Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D43196