1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-01 08:27:59 +00:00
Commit Graph

5753 Commits

Author SHA1 Message Date
Oskar Holmlund
ad7c98797b Remove TI reference from arm/GENERIC
Approved by: imp, manu (mentor)
Differential revision: https://reviews.freebsd.org/D46702
2024-09-19 20:15:47 +02:00
Andrew Turner
66a6e1d613 arm: Remove support for Armv6 CPU cores
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
2024-09-11 10:40:35 +00:00
Andrew Turner
d29771a722 arm: Assume __ARM_ARCH == 7
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
2024-09-11 10:40:13 +00:00
Andrew Turner
bf18be5ab7 bcm2835: Remove support for SoCs with an Armv6 CPU
Armv6 has been removed, there is no need to keep this in the tree.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45956
2024-09-11 10:39:42 +00:00
Andrew Turner
31ca046e22 arm: Only define get_cntxct_a64_unstable when used
When building an ACPI only kernel get_cntxct_a64_unstable in the Arm
generic tiner driver is unused. Add an #ifdef FDT check around it.

Sponsored by:	Arm Ltd
2024-09-09 13:15:39 +00:00
Tom Jones
d8fffc3704 imx_gpio: Add gpio compat string for imx8 SOCs
Several imx8* device trees have a compatible gpio controller which
identifies as working with the soc and imx35-gpio.

Add a compat string for the commonly included 'imx35-gpio', rather than
adding each to the table.

From a grep of our dts mirror this includes the following arm64 SOCs:
- imx8dxl
- imx8mm
- imx8mn
- imx8mp
- imx8mq
- imx8qm
- imx8qxp

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46532
2024-09-05 14:51:37 +01:00
Zhenlei Huang
fe6985ef87 arm ti: Stop checking for failures from malloc(M_WAITOK)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45852
2024-09-03 18:25:22 +08:00
Zhenlei Huang
356be1348d kernel: Make some compile time constant variables const
Those variables are not going to be changed at runtime. Make them const
to avoid potential overwriting. This will also help spotting accidental
global variables shadowing, since the variable's name such as `version`
is short and commonly used.

This change was inspired by reviewing khng's work D44760.

No functional change intended.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45227
2024-08-30 18:26:30 +08:00
Doug Moore
d48524e21f dev_pager: define free_page for mgt devices
Callers of cdev_pager_free_page in the kernel always have object->type
== OBJT_MGTDEVICE. Define a function for them to call that skips the
runtime type check in cdev_pager_free.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46389
2024-08-21 15:48:59 -05:00
Bojan Novković
ddc09a10ea pmap_growkernel: Use VM_ALLOC_NOFREE when allocating pagetable pages
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
2024-07-30 17:38:24 +02:00
Mark Johnston
6aa98f78cc conf: Remove kernel stack swapping support, part 12
Remove the NO_SWAPPING option.  There is still some code in
vm_swapout.c, but it relates to RACCT handling.  Remove the option and
make compilation of vm_swapout.c conditional on RACCT.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46130
2024-07-29 01:43:59 +00:00
Mark Johnston
ba682f8b9b vm: Remove kernel stack swapping support, part 5
- Remove cpu_thread_swapin() and cpu_thread_swapout().

Tested by:	pho
Reviewed by:	alc, imp, kib
Differential Revision:	https://reviews.freebsd.org/D46116
2024-07-29 01:40:39 +00:00
Mark Johnston
e24a655283 thread: Remove kernel stack swapping support, part 4
- Remove the IS_SWAPPED thread inhibitor state.
- Remove all uses of TD_IS_SWAPPED() in the kernel.
- Remove the TDF_CANSWAP flag.
- Remove the P_SWAPPINGOUT and P_SWAPPINGIN flags.

Tested by:	pho
Reviewed by:	alc, imp, kib
Differential Revision:	https://reviews.freebsd.org/D46115
2024-07-29 01:40:22 +00:00
Warner Losh
5b56413d04 newbus: globally replace device_add_child(..., -1) with DEVICE_UNIT_ANY
Sponsored by:		Netflix
2024-07-24 22:22:58 -06:00
Alan Cox
cd836f6004 vm: Retire kmem_arena
It has simply been an alias for the kernel_arena for many years now.
Enough time has passed to retire it.  Any out-of-tree kernel modules
that directly use kmem_arena should switch to kernel_arena.

Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D46057
2024-07-24 14:31:40 -05:00
Jessica Clarke
e1d442a6db Retire unused non-PCI_RES_BUS code
All architectures define PCI_RES_BUS unconditionally now that only
NEW_PCIB is supported, so we no longer need the legacy code.

Reviewed by:	jhb, andrew
Differential Revision:	https://reviews.freebsd.org/D32955
2024-07-18 18:55:33 +01:00
Jessica Clarke
8415a654d0 Retire non-NEW_PCIB code and remove config option
All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent
to do so in 121be55599 (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
2024-07-18 18:55:12 +01:00
Andrew Turner
f5c7644378 sys/arm: Remove armv6 kernel configs
Only the Raspberry Pi config was supported on armv6. Remove it in
preparation for removing armv6 support from the kernel.

Reviewed by:	manu, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45646
2024-07-12 11:31:54 +00:00
Mark Johnston
d68d124817 arm: Add evdev to the TEGRA124 config
This is required for the kernel to link after commit 13d00a43cb.

Fixes:	13d00a43cb ("conf: Add usbhid and hidbus to GENERIC* kernel configs")
2024-07-11 15:19:42 -04:00
Emmanuel Vadot
13d00a43cb conf: Add usbhid and hidbus to GENERIC* kernel configs
Include the new unified HID stack by default in generic.
This will allow us to migrate to the multi-stack hkbd and hms instead of
relying on the older ukbd and ums which only work with USB.
To test those drivers just add hw.usb.usbhid.enable=1 in loader.conf

Differential Revision:	https://reviews.freebsd.org/D45658
Reviewed by:	emaste, imp, wulf (all older version)
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2024-07-10 08:05:25 +02:00
Mitchell Horne
558c1b3733 busdma: avoid buflen underflow
The loop condition in the dmamap_load_buffer() method is 'buflen > 0',
and buflen is an unsigned type (bus_size_t).

A recent change made it possible for sgsize to exceed the remaining
buflen, when the tag has a large alignment requirement. The result is
that we would not break out of the loop at the correct time. Fix this by
avoiding underflow in the subtraction at the end of the loop.

PR:		279383
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	jhibbits
Fixes:		a77e1f0f81 ("busdma: better handling of small segment bouncing")
Differential Revision:	https://reviews.freebsd.org/D45732
2024-07-08 11:51:31 -03:00
Zhenlei Huang
aa3860851b net: Remove unneeded NULL check for the allocated ifnet
Change 4787572d05 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740
2024-06-28 18:16:29 +08:00
Andrew Turner
5afc347944 arm: Start to remove the now unneeded acle-compat.h
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
2024-06-26 08:52:08 +00:00
Andrew Turner
36e0db4916 Revert "arm: Start to remove the now unneeded acle-compat.h"
This reverts commit 3d02fe6c59.

This wasn't ready to be committed
2024-06-25 09:37:14 +00:00
Andrew Turner
3d02fe6c59 arm: Start to remove the now unneeded acle-compat.h
All supported compilers provide the acle macros so we don't need the
backup versions.

Sponsored by:	Arm Ltd
2024-06-25 09:07:19 +00:00
Oskar Holmlund
332f00cdba ti/am335x: Fix the device_set_descf() call in am335x_dmtimer_probe()
Fixes: 459dc61c8b ("arm: Convert drivers to use device_set_desc(f)()")

Reviewed by:    markj, imp, manu
Approved by:    markj, imp, manu (mentor)
Differential Revision:  https://reviews.freebsd.org/D45699
2024-06-24 13:57:25 +02:00
Mark Johnston
ddf0ed09bd sdt: Implement SDT probes using hot-patching
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
2024-06-19 16:57:41 -04:00
Andrew Turner
6abad5b606 Remove the arm FIQ support
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
2024-06-10 15:16:10 +00:00
Mark Johnston
3ce9b2ee94 ti/am335x: Fix the device_set_descf() call in dmtpps_probe()
Fixes:	459dc61c8b ("arm: Convert drivers to use device_set_desc(f)()")
2024-06-09 10:08:31 -04:00
Mitchell Horne
5df74441b3 devmap: eliminate unused arguments
The optional 'table' pointer is a legacy part of the interface, which
has been replaced by devmap_register_table()/devmap_add_entry(). The few
in-tree callers have already adapted to this, so it can be removed.

The 'l1pt' argument is already entirely unused within the function.

Reviewed by:	andrew, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45319
2024-06-04 20:17:47 -03:00
Mark Johnston
459dc61c8b arm: Convert drivers to use device_set_desc(f)()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:40 -04:00
Warner Losh
b8a7548399 LINT: Don't build bnxt on 32-bit platforms
Sponsored by: Netflix
Fixes: acd884dec9 ("RDMA/bnxt_re: Add bnxt_re RoCE driver")
2024-05-29 10:50:27 -06:00
Mitchell Horne
deab57178f Adjust comments referencing vm_mem_init()
I cannot find a time where the function was not named this.

Reviewed by:	kib, markj
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45383
2024-05-27 18:37:40 -03:00
Bojan Novković
0a44b8a56d vm: Simplify startup page dumping conditional
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
2024-05-25 19:24:55 +02:00
Andrew Turner
e72c417723 arm: Use the correct irq when in the hypervisor
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
2024-05-17 16:07:16 +00:00
Andrew Turner
f715e95461 arm: Add a missing interrupt to the generic timer
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
2024-05-17 16:07:15 +00:00
John Baldwin
473c90ac04 uio: Use switch statements when handling UIO_READ vs UIO_WRITE
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
2024-05-10 13:43:36 -07:00
Elliott Mitchell
98c276811a arm: add missing atomic-pointer functions
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
2024-05-09 17:14:59 -06:00
Elliott Mitchell
e64318e76e arm/pmu: remove passing trap frame as argument
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
2024-05-09 17:14:29 -06:00
Mitchell Horne
a77e1f0f81 busdma: better handling of small segment bouncing
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
2024-05-07 13:02:57 -03:00
Mitchell Horne
5604069824 busdma: deduplicate _bus_dmamap_addseg() function
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
2024-05-07 13:02:57 -03:00
Christos Margiolis
a3513995f5 arm: Remove stray references to dev/sound/chip.h
Fixes:		923e0040a5 ("sound: Move chip.h contents to pcm/sound.h")
Reported by:	Jenkins CI
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2024-05-06 21:35:30 +02:00
Mark Johnston
4a5e2ddbd8 arm: Remove duplicate definitions in armreg.h
No functional change intended.

MFC after:	1 week
2024-04-30 17:33:43 -04:00
Lexi Winter
8a8daeafaf sys/*/conf: do not use "../../conf/" when including std.*
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
2024-04-23 15:13:31 -06:00
Lexi Winter
4f8f9d708e sys: add conf/std.debug, generic debugging options
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
2024-04-23 15:13:31 -06:00
HP van Braam
10e0c34bf8 Enable L1SS handling on RPI4 pcib
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
2024-04-21 18:34:05 -04:00
Gordon Bergling
26f6c148bc freescale: Fix a typo in a source code comment
- s/cant/can't/

MFC after:	3 days
2024-04-21 09:52:14 +02:00
Gordon Bergling
178cf4b9db arm: Fix a typo in a KASSERT message
- s/resoure/resource/

MFC after:	5 days
2024-04-19 08:54:39 +02:00
Lexi Winter
ac83063d37 bcm2838_xhci: add module
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
2024-04-09 21:11:39 -06:00
John Baldwin
76f22e353f NOTES: Add devices for iSCSI support
Reviewed by:	imp
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44688
2024-04-09 15:02:58 -07:00