Commit graph

5287 commits

Author SHA1 Message Date
Michal Meloun
40a0633862 mvebu_gpio: Fix settings of gpio pin direction.
Data Output Enable Control register is inverted – 0 means output direction.
Reflect this fact in code.

MFC after:	3 weeks

(cherry picked from commit 01c6d79189)
2022-01-20 11:22:30 +01:00
Michal Meloun
9ddb35ef1f mvebu_gpio: Multiple fixes.
- gpio register access primitives
- locking in interrupt path
- cleanup

In cooperation with: mw
Reviewed by:	mw (initial version)
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D29044
Differential Revision:	https://reviews.freebsd.org/D28911

(cherry picked from commit a5dce53b75)
2022-01-20 11:22:04 +01:00
Marcin Wojtas
8c12f9dea1 mvebu_gpio: fix interrupt cause register configuration
According to Armada 8k documentation, the interrupt cause register
(at offset 0x14) is RW0C. Update the configuration in attach and
the mvebu_gpio_isrc_eoi() to follow the description.

Reviewed by: mmel
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D29013

(cherry picked from commit 819760b35f)
2022-01-20 11:21:42 +01:00
Michal Meloun
f84b424eaf tegra/ahci: do not advertise enclosure management facility
It is not implemented in HW.

MFC after:	1 week

(cherry picked from commit 6e9119768d)
2022-01-20 11:15:47 +01:00
Michal Meloun
7a647bb045 tegra124: Implement new get_gate method for tegra124 clocks.
MFC after:	1 week

(cherry picked from commit be01656fa4)
2022-01-20 11:15:15 +01:00
Michal Meloun
79631b49ee arm: Fix handling of undefined instruction aborts in THUMB2 mode.
Correctly recognize NEON/SIMD and VFP instructions in THUMB2 mode and pass
these to the appropriate handler. Note that it is not necessary to filter
all undefined instruction variant or register combinations, this is a job
for given handler.

Reported by:	Robert Clausecker <fuz@fuz.su>
PR:		259187
MFC after:	2 weks

(cherry picked from commit a670e1c13a)
2022-01-20 11:12:36 +01:00
Andrew Turner
b8c5b751bf Add the missing terminator to the bcm_xhci methods
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6e1be96fd2)
2022-01-10 10:54:20 +00:00
Hans Petter Selasky
a2e8fccd7a Implement suword16() for the 32-bit ARMv6/v7 architecture.
Sponsored by:	NVIDIA Networking

(cherry picked from commit 516df15582)
(cherry picked from commit 48014c6679)
2022-01-07 14:25:23 +01:00
Andriy Gapon
2de6637133 aw_spi: improve I/O stability
This driver does not use DMA at the moment, so some care is needed to
prevent TX FIFO underruns and RX FIFO overflows.
Several improvements are done in oder to minimize chances of those.

First, the interrupt handling is moved to a filter to minimize latency.
Second, FIFO trigger thresholds are configured for both FIFOs.
The TX FIFO threshold is set to 3/4-th of its size and the RX FIFO
threshold is set to 1/4-th of its size.
The interrupt conditions are changed from the empty FIFO and full FIFO
for the TX and RX correspondingly to going below and above the thresholds.

While here I renamed AW_SPI_IER_RF_ERQ to AW_SPI_IER_RF_RDY which is
closer to what the documentation uses, RF_RDY_INT_EN in the interrupt
control register and RX_RDY in the interrupt status register.

(cherry picked from commit 08ff54dc5b)
2022-01-03 10:47:59 +02:00
Alexander Motin
0d3b432779 busdma: Remove outdated comments about Giant.
MFC after:	2 weeks

(cherry picked from commit 8493918868)
2021-12-23 20:05:17 -05:00
Emmanuel Vadot
cee79df364 fb: Remove unused cursors ioctls
The cursors related ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by:	emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33217

(cherry picked from commit b9d3b253e2)

arm/freescale: remove FBIOSCURSOR

Unbreaks building EFIKA_MX

Fixes:	b9d3b253e2 ("fb: Remove unused cursors ioctls")
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 793c74e415)
2021-12-21 10:21:16 +01:00
Gordon Bergling
468495e5be omap4: Fix a few typos in source code comments
- s/addresss/address/

(cherry picked from commit b86066a15e)
2021-12-07 19:52:00 +01:00
Mitchell Horne
1d640e6135 Implement GET_STACK_USAGE on remaining archs
This definition enables callers to estimate remaining space on the
kstack, and take action on it. Notably, it enables optimizations in the
GEOM and netgraph subsystems to directly dispatch work items when there
is sufficient stack space, rather than queuing them for a worker thread.

Implement it for riscv, arm, and mips. Remove the #ifdefs, so it will
not go unimplemented elsewhere.

PR:		259157
Reviewed by:	mav, kib, markj (previous version)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32580

(cherry picked from commit 0d2224733e)
2021-12-07 14:13:47 -04:00
Warner Losh
59ad98cc3f arm: Make machine/reg.h self-contained
Allow inclusion of sys/reg.h w/o pre-requisites by making arm's machine/reg.h
self-contained.

Sponsored by:		Netflix

(cherry picked from commit b57e0aa4ef)
2021-12-06 08:55:56 -07:00
Elyes HAOUAS
27fceea98c Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
(cherry picked from commit 9097ac9af4)
2021-12-06 08:55:55 -07:00
Mitchell Horne
233ec6b12b minidump: Use the provided dump bitset
When constructing the set of dumpable pages, use the bitset provided by
the state argument, rather than assuming vm_page_dump invariably. For
normal kernel minidumps this will be a pointer to vm_page_dump, but when
dumping the live system it will not.

To do this, the functions in vm_dumpset.h are extended to accept the
desired bitset as an argument. Note that this provided bitset is assumed
to be derived from vm_page_dump, and therefore has the same size.

Reviewed by:	kib, markj, jhb
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31992

(cherry picked from commit 10fe6f80a6)
2021-12-03 10:02:03 -04:00
Mitchell Horne
069d7fa63b minidump: Use provided msgbuf pointer
Don't assume we are dumping the global message buffer, but use the one
provided by the state argument. While here, drop superfluous
cast to char *.

Reviewed by:	markj, jhb
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31991

(cherry picked from commit 1d2d1418b4)
2021-12-03 10:02:03 -04:00
Mitchell Horne
f61e6927a4 minidump: reduce the amount direct accesses to page tables
During a live dump, we may race with updates to the kernel page tables.
This is generally okay; we accept that the state of the system while
dumping may be somewhat inconsistent with its state when the dump was
invoked. However, when walking the kernel page tables, it is important
that we load each PDE/PTE only once while operating on it. Otherwise, it
is possible to have the relevant PTE change underneath us. For example,
after checking the valid bit, but before reading the physical address.

Convert the loads to atomics, and add some validation around the
physical addresses, to ensure that we do not try to dump a non-existent
or non-canonical physical address.

Similarly, don't read kernel_vm_end more than once, on the off chance
that pmap_growkernel() is called between the two page table walks.

Reviewed by:	kib, markj
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31990

(cherry picked from commit 681bd71047)
2021-12-03 10:02:03 -04:00
Mitchell Horne
eb2ea57ef1 minidump: Parameterize minidumpsys()
The minidump code is written assuming that certain global state will not
change, and rightly so, since it executes from a kernel debugger
context. In order to support taking minidumps of a live system, we
should allow copies of relevant global state that is likely to change to
be passed as parameters to the minidumpsys() function.

This patch does the work of parameterizing this function, by adding a
struct minidumpstate argument. For now, this struct allows for copies of
the kernel message buffer, and the bitset that tracks which pages should
be dumped (vm_page_dump). Follow-up changes will actually make use of
these arguments.

Notably, dump_avail[] does not need a snapshot, since it is not expected
to change after system initialization.

The existing minidumpsys() definitions are renamed, and a thin MI
wrapper is added to kern_dump.c, which handles the construction of
the state struct. Thus, calling minidumpsys() remains as simple as
before.

Reviewed by:	kib, markj, jhb
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31989

(cherry picked from commit 1adebe3cd6)
2021-12-03 10:02:03 -04:00
Mark Johnston
1d250ec707 netinet: Deduplicate most in_cksum() implementations
in_cksum() and related routines are implemented separately for each
platform, but only i386 and arm have optimized versions.  Other
platforms' copies of in_cksum.c are identical except for style
differences and support for big-endian CPUs.

Deduplicate the implementations for the rest of the platforms.  This
will make it easier to implement in_cksum() for unmapped mbufs.  On arm
and i386, define HAVE_MD_IN_CKSUM to mean that the MI implementation is
not to be compiled.

No functional change intended.

Reviewed by:	kp, glebius
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ecbbe83144)
2021-12-01 07:42:43 -05:00
Gordon Bergling
03490cedbc TWL: Fix a typo in a source code comment
- s/maxium/maximum/

(cherry picked from commit 8b11850f9d)
2021-11-28 12:40:29 +01:00
Warner Losh
3161a62f2d arm: Remove unused items
Remote detritis copied, apparently, from sparc. utrap has never been
used on arm, so it's safe to just remove it.

Sponsored by:		Netflix

(cherry picked from commit c47a4a2375)
2021-11-18 21:52:21 -07:00
Tom Hukins
8d7e5c90e9 arm64: Spell BeagleBone correctly in config file.
Pull Request:		https://github.com/freebsd/freebsd-src/pull/545

(cherry picked from commit 202692b1a7)
2021-11-18 21:52:21 -07:00
Mateusz Guzik
97767e2012 arm: fix a typo in nvidia/drm2/tegra_bo.c
Unbreaks building TEGRA124

Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e2493f4912)
2021-11-09 08:46:01 -05:00
Mark Johnston
f86bda068c Convert consumers to vm_page_alloc_noobj_contig()
Remove now-unneeded page zeroing.  No functional change intended.

Reviewed by:	alc, hselasky, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 84c3922243)
2021-11-03 13:41:40 -04:00
Mark Johnston
66cb1858f4 Convert vm_page_alloc() callers to use vm_page_alloc_noobj().
Remove page zeroing code from consumers and stop specifying
VM_ALLOC_NOOBJ.  In a few places, also convert an allocation loop to
simply use VM_ALLOC_WAITOK.

Similarly, convert vm_page_alloc_domain() callers.

Note that callers are now responsible for assigning the pindex.

Reviewed by:	alc, hselasky, kib
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4667e09e6)
2021-11-03 13:39:36 -04:00
Konstantin Belousov
c683063a00 Enable PPS_SYNC on amd64, arm64 and armv7
PR:	259036

(cherry picked from commit e81e77c5a0)
2021-10-17 03:28:13 +03:00
Konstantin Belousov
6a54fd55de arm: move signal delivery code to exec_machdep.c
(cherry picked from commit dfaf65023e)
2021-10-16 16:01:48 +03:00
Mitchell Horne
aa794b82ef arm, arm64, riscv: adjust top-level nexus comment
These platforms don't manage resources for DMA request lines or I/O
ports, this is specific to x86. Remove the references from the comments.

Reviewed by:	imp, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32358

(cherry picked from commit 17f790f49f)
2021-10-15 12:22:14 -03:00
Mitchell Horne
fc7febf483 minidump: De-duplicate the progress bar
The implementation of the progress bar is simple, but duplicated for
most minidump implementations. Extract the common bits to kern_dump.c.
Ensure that the bar is reset with each subsequent dump; this was only
done on some platforms previously.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31885

(cherry picked from commit ab4ed843a3)
2021-10-15 12:20:48 -03:00
Mitchell Horne
5794f8c75e minidump: De-duplicate is_dumpable()
The function is identical in each minidump implementation, so move it to
vm_phys.c. The only slight exception is powerpc where the function was
public, for use in moea64_scan_pmap().

Reviewed by:	kib, markj, imp (earlier version)
MFC after:	2 weeks
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D31884

(cherry picked from commit 31991a5a45)
2021-10-15 12:20:48 -03:00
Gordon Bergling
0e5787b1d0 ti(4): Fix a typo in an error message
- s/chanels/channels/

(cherry picked from commit 42dfad2ef1)
2021-10-09 05:01:17 +02:00
Mitchell Horne
a7a54bf8c3 bcm2835_sdhci: don't use DMA for kernel dumps
When handling a data irq, the sdhci driver calls the
sdhci_platform_will_handle() method, to determine if it should allow the
platform driver to handle the transfer or fall back to programmed I/O.
While dumping, the data irq path may be invoked directly (not from an
interrupt context), which the bcm2835_sdhci DMA code is not prepared to
handle. Return early in this case, to force the fallback to PIO.

Otherwise, the KASSERT that follows will be triggered, and the dump will
fail. On non-INVARIANTS kernels, the system will hang, waiting for a DMA
interrupt that will never arrive.

Reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31893

(cherry picked from commit 806ebc9eba)
2021-09-28 11:21:38 -03:00
Kevin Bowling
d1fe04cee8 Revert "arm: Bump KSTACK_PAGES default to match i386/amd64"
This reverts commit b684d812fc.

It causes an issue on a pfsense routing workload where memory
fragmentation prevents the necessary consecutive pages from being
readily available.

Reported by:	pfsense (mjg, scottl)
Approved by:	ian
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D31244

(cherry picked from commit 5647f85ade)
2021-09-02 07:56:25 -07:00
Gordon Bergling
dbb74dd891 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

(cherry picked from commit 5bdf58e196)
2021-08-31 08:13:15 +02:00
Konstantin Belousov
a686d177a7 Add pmap_vm_page_alloc_check()
(cherry picked from commit 041b7317f7)
2021-08-24 02:21:13 +03:00
Mateusz Guzik
9fc5596c03 arm: hide busdma statistics behind ifdef ARM_BUSDMA_MAPLOAD_STATS
Stat collection using counter(9) is quite expensive on this platform and
these counters are normally not needed.

In particular we see about 1.5% bump in packet rate using Cortex-A9

Reviewed by:	ian
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Different Revision:	https://reviews.freebsd.org/D31592

(cherry picked from commit aec8ad8a9e)
2021-08-23 12:35:09 +00:00
Gordon Bergling
f296898fb7 Fix a common typo in source code comments
- s/aligment/alignment/

(cherry picked from commit a1581cd735)
2021-08-19 09:18:35 +02:00
Andrew Turner
24a9a22bc7 Add more GIC and GICv3 registers
These aren't used by either driver, however they will be needed by
bhyve on arm64 to emulate a GICv3 interrupt controller.

Sponsored by:	Innovate UK

(cherry picked from commit 15fa52a564)
2021-08-05 20:50:16 +00:00
Warner Losh
efc3ebeb69 Revert "arm: remove fslsdma from GENERIC"
The firmware was already in the tree when I did this commit, and I
missed the message. The bug was obsolete.

This reverts commit 9e3761d126.

The commit was f219c05385 in stable/13.

PR:		237466
Sponsored by:	Netflix

(cherry picked from commit e94f1a0a37)
2021-08-03 20:12:22 -06:00
Kevin Bowling
914e70b909 arm: Bump KSTACK_PAGES default to match i386/amd64
See 3f6867ef63 for additional context.

It is also needed for OpenZFS performance and stability.

Reviewed by:	ian (arm), imp
Differential Revision:	https://reviews.freebsd.org/D31244

(cherry picked from commit b684d812fc)
2021-08-03 15:51:14 -07:00
Mateusz Guzik
289a9ba5e6 arm: dedup counter(9) address calculation
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 78e3a16861)
2021-07-25 07:00:14 +00:00
Emmanuel Vadot
b71d5848cd armv7: allwinner: Add aw_r_intc driver
This is also needed after the 5.13 dts update.

Sponsored by:	Diablotin Systems
Reported by:	Mark Millard <marklmi@yahoo.com>

(cherry picked from commit 48687f733f)
2021-07-22 19:30:22 +02:00
Emmanuel Vadot
2b07bfa110 arm64: allwinner: Add r_intc driver
The r intc interrupt controller seems to do a lot of things :
- It can handle the NMI interrupt
- It have local interrupts for some device that also can be muxed with GIC
- It can serve as an forwarder for the GIC

It's mostly used for deepsleep/wakeup if I understood correctly and we do not
support this on arm64.

For now just forward everything to the GIC so interrupts works again for device
which now have this interrupts controller set since dts v5.12

Sponsored by:	Diablotin Systems

(cherry picked from commit 993e8236c3)
2021-07-22 19:30:21 +02:00
Emmanuel Vadot
6a633b65cc arm: allwinner: Add clock driver for Display Engine to the build
This is needed for drm

(cherry picked from commit 25593adbc1)
2021-07-22 19:23:07 +02:00
Emmanuel Vadot
1fbd603533 arm64: allwinner: clk: Test with the current parent freq first
Even if the clock is flagged with AW_CLK_SET_PARENT the current parent
freq might be enough to get a correct divisor.
So test first if we can get the expected freq before changing the parent
freq.

(cherry picked from commit ac1d7397bf)
2021-07-22 19:23:06 +02:00
Emmanuel Vadot
f7e159e926 arm: Add no-cftconvert for sdma-imx6 files
Fixes a warning when building kernel:
ctfconvert: file.c: Couldn't read ehdr: Invalid argument

MFC after:	3 days

(cherry picked from commit 0c80ad2dc6)
2021-07-22 19:20:47 +02:00
Emmanuel Vadot
8c4e42f5be arm: allwinner: Add mmc_pwrseq support
If a pwrseq is found, set power accordingly.

Sponsored by:	Diablotin Systems

(cherry picked from commit 6bc8fe8a9f)
2021-07-22 19:09:47 +02:00
Emmanuel Vadot
770dcb677f arm: SOCFPGA: Add ext_resources driver
mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to SOCFPGA conf file to fix the build

Reported by:    mjg

(cherry picked from commit 2d926ed71e)
2021-07-22 19:09:46 +02:00
Emmanuel Vadot
3ef7edce20 arm: RPI-B: Add ext_resources driver
mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to RPI-B conf file to fix the build

Reported by:	mjg

(cherry picked from commit 996afd401c)
2021-07-22 19:09:46 +02:00