]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agosys/geom: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:51 +0000 (09:41 -0800)]
sys/geom: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33635

2 years agosys/ddb: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:47 +0000 (09:41 -0800)]
sys/ddb: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33634

2 years agosys/crypto: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:38 +0000 (09:41 -0800)]
sys/crypto: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33633

2 years agosys/compat: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:33 +0000 (09:41 -0800)]
sys/compat: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33632

2 years agodtrace: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:25 +0000 (09:41 -0800)]
dtrace: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33631

2 years agosys/kern: Use C99 fixed-width integer types.
John Baldwin [Tue, 28 Dec 2021 17:41:08 +0000 (09:41 -0800)]
sys/kern: Use C99 fixed-width integer types.

No functional change.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D33630

2 years agotcp_usr_shutdown: don't cast inp_ppcb to tcpcb before checking inp_flags
Gleb Smirnoff [Tue, 28 Dec 2021 16:50:02 +0000 (08:50 -0800)]
tcp_usr_shutdown: don't cast inp_ppcb to tcpcb before checking inp_flags

While here move out one more erroneous condition out of the epoch and
common return.  The only functional change is that if we send control
on a shut down socket we would get EINVAL instead of ECONNRESET.

Reviewed by: tuexen
Reported by: syzbot+8388cf7f401a7b6bece6@syzkaller.appspotmail.com
Fixes: f64dc2ab5be38e5366271ef85ea90d8cb1c7841a

2 years agonet: iflib: fix vlan processing in the drivers
Vincenzo Maffione [Tue, 28 Dec 2021 11:05:31 +0000 (11:05 +0000)]
net: iflib: fix vlan processing in the drivers

The logic that sets iri_vtag and M_VLANTAG does not handle the
case where the 802.11q VLAN tag is 0. Fix this issue across
the iflib drivers. While there, also improve and align the
VLAN tag check extraction, by moving it outside the RX descriptor
loop, eliminating a local variable and additional checks.

PR:             260068
Reviewed by:    kbowling, gallatin
Reported by: erj
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D33156

2 years agonet: iflib: let the drivers use isc_capenable
Vincenzo Maffione [Tue, 28 Dec 2021 11:00:32 +0000 (11:00 +0000)]
net: iflib: let the drivers use isc_capenable

Since isc_capenable (private copy of ifp->if_capenable) is
now synchronized to if_capenable, use it in the drivers
when checking the IFCAP_* bits.
This results in better cache usage and avoids indirection
through the ifp pointer.

PR:             260068
Reviewed by:    kbowling, gallatin
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D33156

2 years agonet: iflib: sync isc_capenable to if_capenable
Vincenzo Maffione [Tue, 28 Dec 2021 10:47:13 +0000 (10:47 +0000)]
net: iflib: sync isc_capenable to if_capenable

On SIOCSIFCAP, some bits in ifp->if_capenable may be toggled.
When this happens, apply the same change to isc_capenable, which
is the iflib private copy of if_capenable (for a subset of the
IFCAP_* bits). In this way the iflib drivers can check the bits
using isc_capenable rather than if_capenable. This is convenient
because the latter access requires an additional indirection
through the ifp, and it is also less likely to be in cache.

PR: 260068
Reviewed by: kbowling, gallatin
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33156

2 years agosctp: minor improvements in sctp_get_frag_point
Michael Tuexen [Tue, 28 Dec 2021 09:23:31 +0000 (10:23 +0100)]
sctp: minor improvements in sctp_get_frag_point
MFC after: 3 days

2 years agosctp: check that the computed frag point is a multiple of 4
Michael Tuexen [Tue, 28 Dec 2021 08:40:52 +0000 (09:40 +0100)]
sctp: check that the computed frag point is a multiple of 4

Reported by: syzbot+5da189fc1fe80b31f5bd@syzkaller.appspotmail.com
MFC after: 3 days

2 years agoipq4018_usb_phy: remove old debugging routine
Adrian Chadd [Tue, 28 Dec 2021 02:33:06 +0000 (18:33 -0800)]
ipq4018_usb_phy: remove old debugging routine

This isn't needed anymore, I know that these work!

2 years agoqcom_dwc3: add initial Qualcomm SoC DWC3 controller glue
Adrian Chadd [Tue, 28 Dec 2021 02:25:32 +0000 (18:25 -0800)]
qcom_dwc3: add initial Qualcomm SoC DWC3 controller glue

This adds some very simple DWC3 glue for the IPQ4018/IPQ4019.
Other chipsets introduce reset line iteration, some further
clock line iteration and some customisations; I'll look at adding
those later.

This is enough to finally bring up USB 3.0 on my IPQ4018 ASUS
RT-58U router.

2 years agoipq4018_usb_phy: add USB 2.0 and 3.0 PHY support
Adrian Chadd [Tue, 28 Dec 2021 02:21:36 +0000 (18:21 -0800)]
ipq4018_usb_phy: add USB 2.0 and 3.0 PHY support

This adds the USB 2.0 and 3.0 PHY support for the IPQ4018/IPQ4019.

All it really needs to do is gate the relevant clocks on/off in the
right order with the right delays.

2 years agoGEOM: Minor polishing in geom_event.
Alexander Motin [Tue, 28 Dec 2021 01:52:59 +0000 (20:52 -0500)]
GEOM: Minor polishing in geom_event.

 - Remove timeouts from msleep()'s.  Those should always be woken up.
 - Move wakeup() under the lock to not call on possibly freed pointer.
 - Remove some dead code.

MFC after: 2 weeks

2 years agoFix pmap_is_prefaultable() on arm64 and riscv
Alan Cox [Sat, 25 Dec 2021 03:54:01 +0000 (21:54 -0600)]
Fix pmap_is_prefaultable() on arm64 and riscv

The current implementations never correctly return TRUE. In all cases,
when they currently return TRUE, they should have returned FALSE.  And,
in some cases, when they currently return FALSE, they should have
returned TRUE.  Except for its effects on performance, specifically,
additional page faults and pointless calls to pmap_enter_quick() that
abort, this error is harmless.  That is why it has gone unnoticed.

Add a comment to the amd64, arm64, and riscv implementations
describing how their return values are computed.

Reviewed by: kib, markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33659

2 years agoitimers: strip unused bits from struct itimer and struct itimers
Konstantin Belousov [Mon, 27 Dec 2021 18:29:22 +0000 (20:29 +0200)]
itimers: strip unused bits from struct itimer and struct itimers

Reviewed by: imp, markj, mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33670

2 years agoitimers_alloc: no need to initialize its_timers array
Konstantin Belousov [Mon, 27 Dec 2021 18:32:01 +0000 (20:32 +0200)]
itimers_alloc: no need to initialize its_timers array

struct itimers is allocated with M_ZERO, setting all members to NULL
is tautological.

Reviewed by: imp, markj, mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D33670

2 years agotcp_usr_shutdown: don't cast inp_ppcb to tcpcb before checking inp_flags
Gleb Smirnoff [Tue, 28 Dec 2021 00:58:09 +0000 (16:58 -0800)]
tcp_usr_shutdown: don't cast inp_ppcb to tcpcb before checking inp_flags

Fixes: f64dc2ab5be38e5366271ef85ea90d8cb1c7841a

2 years agoqcom_tcsr: add initial top control and status register (TCSR) support
Adrian Chadd [Mon, 27 Dec 2021 23:45:40 +0000 (15:45 -0800)]
qcom_tcsr: add initial top control and status register (TCSR) support

The Qualcomm TCSR is some top level glue between multiple IP blocks,
both for doing configuration of said IP blocks, some IPC between
them (mostly between multiple execution environments - eg trustzone
and non-TZ), and interrupt status bits for them.

However, for the IPQ4018/IPQ4019, it only is used as a small subset
of IP block configuration.  As for what it actually gets used as
for other Qualcomm chipsets?  Well, that'll have to wait.

It's a bit of a mess in linux and openwrt.  See, every different
SoC support branch ends up with some different TCSR code for it.

So instead, I'm going to land a single TCSR driver that I'm going
to use for the IPQ4018/IPQ4019.  When I add the next chipset, I'll
figure out how to organise things so there's a single TCSR driver
that works for multiple platforms.

2 years agoqcom_qup: add initial v1/v2 QUP SPI driver
Adrian Chadd [Mon, 27 Dec 2021 23:27:29 +0000 (15:27 -0800)]
qcom_qup: add initial v1/v2 QUP SPI driver

The Qualcomm Universal Peripherals Engine (QUP) is a unified SPI and I2C
peripheral that ships with a variety of Qualcomm SoCs.

It supports three transfer modes - single PIO, block PIO and DMA.

This driver only supports the single PIO mode, which is enough to
bootstrap the rest of the SPI NAND/NOR support and means I can do
things like read the Wifi calibration data from NOR.  It has some
hardware support code for the other transfer modes as well as
some support for split transfers (ie, transfers with no read or
write phase), but I haven't yet implemented those.

This driver is based on four sources - the linux driver, the u-boot
driver, some initial work done for APQ8064 by mmel@, and the APQ8064
Technical Reference Manual which is surprisingly free and open to
read.  The linux and u-boot drivers approach a variety of things
completely differently, from how PIO is done, the hardware support
for re-ordering bytes in a transfer word and how the CS lines
are used.

Tested:

* IPQ4018, SPI to NAND/NOR flash, PIO only

2 years agosctp: cleanup the SCTP_MAXSEG socket option.
Michael Tuexen [Mon, 27 Dec 2021 22:40:31 +0000 (23:40 +0100)]
sctp: cleanup the SCTP_MAXSEG socket option.

This patch makes the handling of the SCTP_MAXSEG socket option
compliant with RFC 6458 (SCTP socket API) and fixes an issue
found by syzkaller.

Reported by: syzbot+a2791b89ab99121e3333@syzkaller.appspotmail.com
MFC after: 3 days

2 years agoqca: add cpufreq into the build
Adrian Chadd [Mon, 27 Dec 2021 21:13:38 +0000 (13:13 -0800)]
qca: add cpufreq into the build

Now that the clock drivers are in the tree, the cpufreq driver will
"just work".

Tested:

* IPQ4018, testing performance of dd from /dev/zero->/dev/null at
  each frequency step.

2 years agoAdd support for qualcomm clock nodes the the IPQ4018/IPQ4019 clock tree.
Adrian Chadd [Sun, 26 Dec 2021 17:08:57 +0000 (09:08 -0800)]
Add support for qualcomm clock nodes the the IPQ4018/IPQ4019 clock tree.

Summary: I've tested this with cpufreq_dt, SPI and USB.  They all seem to work fine.

Test Plan: * IPQ4018, boot

Subscribers: imp, andrew

Differential Revision: https://reviews.freebsd.org/D33665

2 years agoqcom_clk: add the qualcomm clock nodes for the IPQ4018
Adrian Chadd [Sun, 26 Dec 2021 17:07:21 +0000 (09:07 -0800)]
qcom_clk: add the qualcomm clock nodes for the IPQ4018

These clock nodes are used by the IPQ4018/IPQ4019 and derivatives.
They're also used by other 32 and 64 bit qualcomm parts; so it's
best to put these nodes here in a single qcom_clk driver and add
to it as we grow new Qualcomm SoC support.

Tested:

* IPQ4018, boot

Differential Revision: https://reviews.freebsd.org/D33665

2 years agoiwlwifi: attach to the build
Bjoern A. Zeeb [Mon, 27 Dec 2021 18:46:04 +0000 (18:46 +0000)]
iwlwifi: attach to the build

Add iwlwifi and iwlwififw to the module builds.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: plug memory modified after free
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:42:51 +0000 (17:42 +0000)]
iwlwifi: plug memory modified after free

In certain situations we saw a memory modified after free.  This was
tracked down to a pointer not NULLed after free and used in a different
code path.  It is unclear how the race happens pending further
investigation but setting the pointer to NULL after free and adding a
check in the 2nd code path handling the case gracefully helps for now.

While here improve another debug messge in sta handling.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: cherry-pick fixes from upstream iwlwifi-next
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:41:19 +0000 (17:41 +0000)]
iwlwifi: cherry-pick fixes from upstream iwlwifi-next

Cherry-pick f973795a8d19cbf3d03807704eb7c6ff65788d5a (Fix a double free
in iwl_txq_dyn_alloc_dma), db66abeea3aefed481391ecc564fb7b7fb31d742
(synchronize with FW after multicast commands),
d5d8ee526d1401173ad1261c3b6388a4f947e0a3 (remove session protection
upon station removal), and 8e967c137df3b236d2075f9538cb888129425d1a
(avoid clearing a just saved session protection id).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: add man pages
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:40:02 +0000 (17:40 +0000)]
iwlwifi: add man pages

Add and hook up man pages for iwlwifi and iwlwififw and install a copy
of the firmware license to /usr/share/docs/legal so it will always be
shipped with the installed system.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: turn off broadcast filtering for now
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:37:41 +0000 (17:37 +0000)]
iwlwifi: turn off broadcast filtering for now

Turn off broadcast filtering in iwlwifi for now as it gives me
or rather the firmware headaches.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: also depend on linuxkpi_wlan
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:36:04 +0000 (17:36 +0000)]
iwlwifi: also depend on linuxkpi_wlan

The 802.11 compat code is split off linuxkpi.ko into linuxkpi_wlan.ko
in case it is built as a module.  Depend on that.
While here adjust our module to a longer version to avoid conflicts.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: remove copyright and license from Makefiles
Bjoern A. Zeeb [Mon, 27 Dec 2021 17:34:40 +0000 (17:34 +0000)]
iwlwifi: remove copyright and license from Makefiles

We do not generally protect the Makefiles like this.
Remove the details and go with project style.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC with: bfcc09ddd422c95a1a2e4e794b63ee54c4902398
X-MFC with: f4c129f5fb1669b284d76a838b1e509f97c2d299

2 years agoLinuxKPI: add 802.11 compat code
Bjoern A. Zeeb [Sun, 26 Dec 2021 18:52:51 +0000 (18:52 +0000)]
LinuxKPI: add 802.11 compat code

Add 802.11 compat code for mac80211 and to a minimal degree cfg80211.
This allows us to compile and use basic functionality of wireless
drivers such as iwlwifi.

This is a constant work in progress but having it in the tree will
allow others to test and more easy to track changes and avoid having
snapshots no longer applying to branches.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: import beginning of a new version of netdevice.h
Bjoern A. Zeeb [Sun, 26 Dec 2021 18:29:29 +0000 (18:29 +0000)]
LinuxKPI: import beginning of a new version of netdevice.h

Import a netdevice update complementing the last remaining bits of
the old ifnet derived implementation.  Along add a (for now) task
based NAPI implementation.

This is the minimal set of chnages which are needed for the initial
support of wireless drivers.  The NAPI implementation has an option to
still switch to "direct dispatch" as it had been used by these drivers
before not relying on a deferred context along with some printf tracing.
This has been helpful in the last weeks for debugging and will be
cleaned once we have had broader testing and are sure this is fine as-is.
Should we need a more time-sensitive or load-sensitive response
in the future we can always switch to something more sophisticated.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-Differential Revision: D33075 (abandoned without feedback a while ago)

2 years agoLinuxKPI: add a work-in-progress skbuff implementation
Bjoern A. Zeeb [Sun, 26 Dec 2021 18:26:26 +0000 (18:26 +0000)]
LinuxKPI: add a work-in-progress skbuff implementation

This is a work-in-progress implementation of sk_buff compat code
used for wireless drivers only currently.
Bring in this version of the code as it has proven to be good enough
to have packets going for a few months.

The current implementation has several drawbacks including the need
for us to copy data between sk_buffs and mbufs.
Do not rely on the internals of this implementation.  They are highly
likely to change as we will improve the integration to FreeBSD mbufs.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agotcp_usr_rcvd: don't cast inp_ppcb to tcpcb before checking inp_flags
Gleb Smirnoff [Mon, 27 Dec 2021 18:41:51 +0000 (10:41 -0800)]
tcp_usr_rcvd: don't cast inp_ppcb to tcpcb before checking inp_flags

Fixes: f64dc2ab5be38e5366271ef85ea90d8cb1c7841a

2 years agoarm64: Fix "set-but-not-used" warnings in the pmap
Alan Cox [Mon, 27 Dec 2021 17:37:04 +0000 (11:37 -0600)]
arm64: Fix "set-but-not-used" warnings in the pmap

MFC after: 1 week

2 years agosctp: cleanup, on functional change intended.
Michael Tuexen [Mon, 27 Dec 2021 17:28:44 +0000 (18:28 +0100)]
sctp: cleanup, on functional change intended.

MFC after: 3 days

2 years agosctp: apply limit for socket buffers as indicated in comment
Michael Tuexen [Mon, 27 Dec 2021 17:15:29 +0000 (18:15 +0100)]
sctp: apply limit for socket buffers as indicated in comment

MFC after: 3 days

2 years agonfscommon: Return NFSERR_ATTRNOTSUPP for AUDIT/ALARM ACEs
Rick Macklem [Mon, 27 Dec 2021 16:03:41 +0000 (08:03 -0800)]
nfscommon: Return NFSERR_ATTRNOTSUPP for AUDIT/ALARM ACEs

FreeBSD only supports Allow/Deny ACEs in NFSv4 ACLs.
As such, it does not make sense to parse Audit/Alarm
ACEs.  Modify nfsrv_dissectace() so that it returns
NFSERR_ATTRNOTSUPP if an Audit/Alarm ACE is found in
the ACL being parsed.  The code has been #ifdef notnow'd,
since Audit/Alarm ACEs might be supported someday.

This should not have significant impact, since FreeBSD
reports to clients that only Allow/Deny ACEs are
supported and an attempt to set one would have failed
anyhow.

MFC after: 2 weeks

2 years agokldxref: add R_PPC64_ADDR64 handler
Alfredo Dal'Ava Junior [Mon, 27 Dec 2021 18:29:50 +0000 (15:29 -0300)]
kldxref: add R_PPC64_ADDR64 handler

Implements R_PPC64_ADDR64 handler for kldxref, addressing
"kldxref: unhandled relocation type 38" when running
"kldxref /boot/kernel"

Reviewed by: jhibbits
MFC after: 1 week
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33615

2 years agotests/libalias: Portrange
Lutz Donnerhacke [Sat, 3 Jul 2021 22:28:20 +0000 (00:28 +0200)]
tests/libalias: Portrange

Test ranges of allowed ports for aliasing.
 - Explicit default like ipfw(8) is doing
 - Regular range
 - Exhausting a very small range
 - Recovery

Includes a fix of an utility macro, which was not used before.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D31012

2 years agoipfilter userland: Revert the ipmon part of a6fb9bbea731
Cy Schubert [Mon, 27 Dec 2021 09:10:52 +0000 (01:10 -0800)]
ipfilter userland: Revert the ipmon part of a6fb9bbea731

a6fb9bbea731 caused incorrect formatting of ipmon log output.

Fixes: a6fb9bbea7318e993dfe0f8a7f00821f79850b26
MFC after: immediately

2 years agoipfilter userland: Path fixup no longer required
Cy Schubert [Mon, 27 Dec 2021 08:18:49 +0000 (00:18 -0800)]
ipfilter userland: Path fixup no longer required

Since the move of ipfilter from contrib to sbin adjusting the source path
is no longer required.

Fixes: 41edb306f05651fcaf6c74f9e3557f59f80292e1
MFC after: 1 month

2 years agokern: Remove CTLFLAG_NEEDGIANT from some more sysctls.
Alexander Motin [Mon, 27 Dec 2021 04:07:33 +0000 (23:07 -0500)]
kern: Remove CTLFLAG_NEEDGIANT from some more sysctls.

MFC after: 2 weeks

2 years agosound: Remove CTLFLAG_NEEDGIANT from some sysctls.
Alexander Motin [Mon, 27 Dec 2021 01:37:55 +0000 (20:37 -0500)]
sound: Remove CTLFLAG_NEEDGIANT from some sysctls.

While there, remove some dead code.

MFC after: 2 weeks

2 years agonfscommon: Add arguments for support of the dacl attribute
Rick Macklem [Mon, 27 Dec 2021 00:37:02 +0000 (16:37 -0800)]
nfscommon: Add arguments for support of the dacl attribute

NFSv4.1/4.2 has an alternative to the acl attribute, called
dacl, that includes support for the ACL_ENTRY_INHERITED flag,
called NFSV4ACE_INHERITED in NFSv4.

This patch adds a dacl argument to nfsrv_buildacl(),
nfsrv_dissectacl() and nfsrv_dissectace(), so that they
will handle NFSV4ACE_INHERITED when dacl == true.

Since these functions are always called with dacl == false
for this patch, semantics should not have changed.
A future patch will add support for dacl.

MFC after: 2 weeks

2 years agonetgraph: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Mon, 27 Dec 2021 00:42:53 +0000 (19:42 -0500)]
netgraph: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

2 years agoacpi_support: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Mon, 27 Dec 2021 00:37:08 +0000 (19:37 -0500)]
acpi_support: Remove CTLFLAG_NEEDGIANT from sysctls.

MFC after: 2 weeks

2 years agoacpica: Remove CTLFLAG_NEEDGIANT from most sysctls.
Alexander Motin [Mon, 27 Dec 2021 00:17:52 +0000 (19:17 -0500)]
acpica: Remove CTLFLAG_NEEDGIANT from most sysctls.

MFC after: 2 weeks

2 years agoclk: rename clknode_try_freq to clknode_test_freq
Adrian Chadd [Sun, 26 Dec 2021 14:16:02 +0000 (06:16 -0800)]
clk: rename clknode_try_freq to clknode_test_freq

This brings it in line with what the clk_*_freq routines are named.

2 years agoin_pcb: use jenkins hash over the entire IPv6 (or IPv4) address
Gleb Smirnoff [Sun, 26 Dec 2021 18:47:28 +0000 (10:47 -0800)]
in_pcb: use jenkins hash over the entire IPv6 (or IPv4) address

The intent is to provide more entropy than can be provided
by just the 32-bits of the IPv6 address which overlaps with
6to4 tunnels.  This is needed to mitigate potential algorithmic
complexity attacks from attackers who can control large
numbers of IPv6 addresses.

Together with: gallatin
Reviewed by: dwmalone, rscheff
Differential revision: https://reviews.freebsd.org/D33254

2 years agojail: network epoch protection for IP address lists
Gleb Smirnoff [Sun, 26 Dec 2021 18:45:50 +0000 (10:45 -0800)]
jail: network epoch protection for IP address lists

Now struct prison has two pointers (IPv4 and IPv6) of struct
prison_ip type.  Each points into epoch context, address count
and variable size array of addresses.  These structures are
freed with network epoch deferred free and are not edited in
place, instead a new structure is allocated and set.

While here, the change also generalizes a lot (but not enough)
of IPv4 and IPv6 processing. E.g. address family agnostic helpers
for kern_jail_set() are provided, that reduce v4-v6 copy-paste.

The fast-path prison_check_ip[46]_locked() is also generalized
into prison_ip_check() that can be executed with network epoch
protection only.

Reviewed by: jamie
Differential revision: https://reviews.freebsd.org/D33339

2 years agoclk: add call for nodes to get the programmed/decided frequency passed back
Adrian Chadd [Tue, 14 Dec 2021 18:01:08 +0000 (10:01 -0800)]
clk: add call for nodes to get the programmed/decided frequency passed back

Summary:

The existing call can only really be used for a node wishing to
configure its parent, but as we don't pass in a pointer to the freq,
we can't set it to what it would be for a DRY_RUN pass.

So for clock nodes that wish to try setting parent frequencies to see
which would be the best for its own target frequency, we really do need
a way to call in and pass in a flag /and/ a pointer to freq so it can be
updated for us as the clock tree is recursed through.

Reviewers: manu

Approved by: manu

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D33445

2 years agovm_reserv: fix zero-boundary error
Doug Moore [Sun, 26 Dec 2021 17:40:27 +0000 (11:40 -0600)]
vm_reserv: fix zero-boundary error

Handle specially the boundary==0 case of vm_reserv_reclaim_config,
by turning off boundary adjustment in that case.

Reviewed by: alc
Tested by: pho, madpilot

2 years agonet80211: adjust a printf to toeee80211_note
Bjoern A. Zeeb [Sun, 26 Dec 2021 17:26:58 +0000 (17:26 +0000)]
net80211: adjust a printf to toeee80211_note

Throughout net80211 there are multiple ways to log (debugging)
information.  Start to clenaup one as I kept hitting it to harmonize
the output.  The more we get away from printfs into either wrapper
functions or macros the more likely we can use holistic systematic
tracing in the future.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agonet80211: add debugging information
Bjoern A. Zeeb [Sun, 26 Dec 2021 17:25:57 +0000 (17:25 +0000)]
net80211: add debugging information

Add more STATE / DEBUG probes and enhance the output of one in order
to track state changes triggered by "ack" (or not).
This helped to narrow down causes from drivers or the LinuxKPI 802.11
compat framework which kept us in a scan -> auth -> scan loop.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agonet80211: format debug functions as single line
Bjoern A. Zeeb [Sun, 26 Dec 2021 17:24:04 +0000 (17:24 +0000)]
net80211: format debug functions as single line

Making use of the debug output was hard given debug lines were run in
parts through vlog (if_printf) and in (multiple) parts through printf(s).

Like some of the functions alreay have, use a local buffer to format
the string and then use a single if_printf;  in addition given these
functions are debug-only, add an extra printf in case we find our
buffers still to be too small so we can adjust for the future.
We already found that 128 characters are to short for some log messages.
Bump the buffer sizes collectively to 256 characters which also is
the maximum of if_vlog() so getting longer would need further changes
elsewhere.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agokern: Remove CTLFLAG_NEEDGIANT from some sysctls.
Alexander Motin [Sun, 26 Dec 2021 17:02:28 +0000 (12:02 -0500)]
kern: Remove CTLFLAG_NEEDGIANT from some sysctls.

MFC after: 2 weeks

2 years agotcp: remove delayed drop KPI
Gleb Smirnoff [Sun, 26 Dec 2021 16:48:24 +0000 (08:48 -0800)]
tcp: remove delayed drop KPI

No longer needed after tcp_output() can ask caller to drop.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33371

2 years agotcp: TCP output method can request tcp_drop
Gleb Smirnoff [Sun, 26 Dec 2021 16:48:19 +0000 (08:48 -0800)]
tcp: TCP output method can request tcp_drop

The advanced TCP stacks (bbr, rack) may decide to drop a TCP connection
when they do output on it.  The default stack never does this, thus
existing framework expects tcp_output() always to return locked and
valid tcpcb.

Provide KPI extension to satisfy demands of advanced stacks.  If the
output method returns negative error code, it means that caller must
call tcp_drop().

In tcp_var() provide three inline methods to call tcp_output():
- tcp_output() is a drop-in replacement for the default stack, so that
  default stack can continue using it internally without modifications.
  For advanced stacks it would perform tcp_drop() and unlock and report
  that with negative error code.
- tcp_output_unlock() handles the negative code and always converts
  it to positive and always unlocks.
- tcp_output_nodrop() just calls the method and leaves the responsibility
  to drop on the caller.

Sweep over the advanced stacks and use new KPI instead of using HPTS
delayed drop queue for that.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33370

2 years agorack: rack_do_compressed_ack_processing() can call tcp_drop()
Gleb Smirnoff [Sun, 26 Dec 2021 16:48:15 +0000 (08:48 -0800)]
rack: rack_do_compressed_ack_processing() can call tcp_drop()

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33369

2 years agorack: drop connection synchronously, when we can
Gleb Smirnoff [Sun, 26 Dec 2021 16:48:10 +0000 (08:48 -0800)]
rack: drop connection synchronously, when we can

For all functions that are leaves of tcp_input() call
ctf_do_dropwithreset_conn() instead of ctf_do_dropwithreset(), cause
we always got tp and we want it to be dropped.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33368

2 years agobbr: drop packet synchronously in ctf_do_dropwithreset_conn()
Gleb Smirnoff [Sun, 26 Dec 2021 16:48:06 +0000 (08:48 -0800)]
bbr: drop packet synchronously in ctf_do_dropwithreset_conn()

This function is always called from tcp_do_segment() method, that
can drop tcpcb and return unlocked.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33367

2 years agotcp: mechanically substitute call to tfb_tcp_output to new method.
Gleb Smirnoff [Sun, 26 Dec 2021 16:47:59 +0000 (08:47 -0800)]
tcp: mechanically substitute call to tfb_tcp_output to new method.

Made with sed(1) execution:

sed -Ef sed -i "" $(grep --exclude tcp_var.h -lr tcp_output sys/)

sed:
s/tp->t_fb->tfb_tcp_output\(tp\)/tcp_output(tp)/
s/to tfb_tcp_output\(\)/to tcp_output()/

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33366

2 years agotcp: welcome back tcp_output() as the right way to run output on tcpcb.
Gleb Smirnoff [Sun, 26 Dec 2021 16:47:42 +0000 (08:47 -0800)]
tcp: welcome back tcp_output() as the right way to run output on tcpcb.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D33365

2 years agoIPv4: fix redirect sending conditions
Bjoern A. Zeeb [Sun, 26 Dec 2021 15:33:48 +0000 (15:33 +0000)]
IPv4: fix redirect sending conditions

RFC792,1009,1122 state the original conditions for sending a redirect.
RFC1812 further refine these.
ip_forward() still sepcifies the checks originally implemented for these
(we do slightly more/different than suggested as makes sense).
The implementation added in 8ad114c082a159c0dde95aa35d2e3e108aa30a75
to ip_tryforward() however is flawed and may send a "multi-hop"
redirects (to a host not on the directly connected network).

Do proper checks in ip_tryforward() to stop us from sending redirects
in situations we may not.  Keep as much logic out of ip_tryforward()
and in ip_redir_alloc() and only do the mbuf copy once we are sure we
will send a redirect.

While here enhance and fix comments as to which conditions are handled
for sending redirects in various places.

Reported by: pi (on net@ 2021-12-04)
MFC after: 3 days
Sponsored by: Dr.-Ing. Nepustil & Co. GmbH
Reviewed by: cy, others (earlier versions)
Differential Revision: https://reviews.freebsd.org/D33274

2 years agonetstat: fix nhop prepend printing.
Alexander V. Chernikov [Sun, 26 Dec 2021 15:02:06 +0000 (15:02 +0000)]
netstat: fix nhop prepend printing.

If present, print nexthop L2 prepend data in hex.

MFC after: 1 week

2 years agotcp: virtualise net.inet.tcp.msl sysctl.
Alexander V. Chernikov [Sat, 4 Dec 2021 22:02:44 +0000 (22:02 +0000)]
tcp: virtualise net.inet.tcp.msl sysctl.

VNET teardown waits 2*MSL (60 seconds by default) before expiring
 tcp PCBs. These PCBs holds references to nexthops, which, in turn,
 reference ifnets. This chain results in VNET interfaces being destroyed
 and moved to default VNET only after 60 seconds.
Allow tcp_msl to be set in jail by virtualising net.inet.tcp.msl sysctl,
 permitting more predictable VNET tests outcomes.

MFC after: 1 week
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D33270

2 years agoadd exuberant ctags tags file to gitignore
Andriy Gapon [Sun, 26 Dec 2021 10:16:23 +0000 (12:16 +0200)]
add exuberant ctags tags file to gitignore

2 years agox86: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Sun, 26 Dec 2021 03:24:20 +0000 (22:24 -0500)]
x86: Remove CTLFLAG_NEEDGIANT from sysctls.

MFC after: 2 weeks

2 years agoLinuxKPI: Replace missed Giant with bus_topo_lock.
Alexander Motin [Sun, 26 Dec 2021 03:02:07 +0000 (22:02 -0500)]
LinuxKPI: Replace missed Giant with bus_topo_lock.

2 years agopccbb: Remove Giant mention in comments.
Alexander Motin [Sun, 26 Dec 2021 02:51:48 +0000 (21:51 -0500)]
pccbb: Remove Giant mention in comments.

MFC after: 2 weeks

2 years agohwpmc: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Sun, 26 Dec 2021 02:40:14 +0000 (21:40 -0500)]
hwpmc: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

2 years agouart: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Sun, 26 Dec 2021 02:30:02 +0000 (21:30 -0500)]
uart: Remove CTLFLAG_NEEDGIANT from sysctl.

MFC after: 2 weeks

2 years agoxen/blkfront: Remove CTLFLAG_NEEDGIANT from sysctl.
Alexander Motin [Sun, 26 Dec 2021 02:24:24 +0000 (21:24 -0500)]
xen/blkfront: Remove CTLFLAG_NEEDGIANT from sysctl.

It only converts bit field into string.  It does not need locking.

MFC after: 1 week

2 years agoamdtemp: Remove CTLFLAG_NEEDGIANT from sysctls.
Alexander Motin [Sun, 26 Dec 2021 02:03:54 +0000 (21:03 -0500)]
amdtemp: Remove CTLFLAG_NEEDGIANT from sysctls.

It seems to be needed only to serialize very old K8 registers access.
Introduce separate lock for that and remove Giant dependency.

MFC after: 2 weeks

2 years agostress2: Fix "set-but-not-unused" warnings
Peter Holm [Sat, 25 Dec 2021 07:27:25 +0000 (07:27 +0000)]
stress2: Fix "set-but-not-unused" warnings

2 years agovm_page: Move a comment
Doug Moore [Fri, 24 Dec 2021 22:10:30 +0000 (16:10 -0600)]
vm_page: Move a comment

fb38b29b5609 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
should have moved a comment block when it moved the function call that followed it.

Move the comment block now.

2 years agotegra/ahci: do not advertise enclosure management facility
Michal Meloun [Fri, 24 Dec 2021 19:25:36 +0000 (20:25 +0100)]
tegra/ahci: do not advertise enclosure management facility

It is not implemented in HW.

MFC after: 1 week

2 years agoarm64: Don't rely on host readelf for u-boot booti image generation
Jessica Clarke [Fri, 24 Dec 2021 19:25:20 +0000 (19:25 +0000)]
arm64: Don't rely on host readelf for u-boot booti image generation

readelf is not a bootstrap tool and so cannot be relied upon to exist.
On macOS there is no system readelf, and even on Linux or FreeBSD where
it does exist, BUILD_WITH_STRICT_TMPPATH builds won't be able to use it.
Instead of making it a bootstrap tool, just use nm as that suffices and
already is a bootstrap tool.

Fixes: 28482babd08a ("arm64: Use new arm_kernel_boothdr script for generating booti images.")
Reviewed by: emaste, mmel
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D32734

2 years agotegra124: Implement new get_gate method for tegra124 clocks.
Michal Meloun [Fri, 24 Dec 2021 19:13:33 +0000 (20:13 +0100)]
tegra124: Implement new get_gate method for tegra124 clocks.

MFC after: 1 week

2 years agovm: alloc pages from reserv before breaking it
Doug Moore [Fri, 24 Dec 2021 18:59:16 +0000 (12:59 -0600)]
vm: alloc pages from reserv before breaking it

Function vm_reserv_reclaim_contig breaks a reservation with enough
free space to satisfy an allocation request and returns the free space
to the buddy allocator. Change the function to allocate the request
memory from the reservation before breaking it, and return that memory
to the caller. That avoids a second call to the buddy allocator and
guarantees successful allocation after breaking the reservation, where
that success is not currently guaranteed.

Reviewed by: alc, kib (previous version)
Differential Revision: https://reviews.freebsd.org/D33644

2 years agotegra210: Implement new get_gate method for tegra210 clocks.
Michal Meloun [Fri, 24 Dec 2021 17:23:59 +0000 (18:23 +0100)]
tegra210: Implement new get_gate method for tegra210 clocks.

MFC after: 1 week

2 years agoextres/clk: Add a method to detect the HW state of the clock gate.
Michal Meloun [Fri, 24 Dec 2021 11:18:49 +0000 (12:18 +0100)]
extres/clk: Add a method to detect the HW state of the clock gate.

- add method to read gate enable/disable staust from HW
- show gate status in sysctl clock dump

MFC after: 1 week

2 years agoextres/clk: Improve sysctl dump of clocks.
Michal Meloun [Fri, 24 Dec 2021 07:38:32 +0000 (08:38 +0100)]
extres/clk: Improve sysctl dump of clocks.

Always recalculate the frequency, the cache is lazily initialized so it is not always up to date.
While I'm in mark sysctl as MPSAFE.

Discussed with: manu, adrian
MFC after: 1 week

2 years agoExtract the arm64 signal code to a new file
Andrew Turner [Tue, 14 Dec 2021 18:05:29 +0000 (18:05 +0000)]
Extract the arm64 signal code to a new file

This will be used by the vdso signal trampoline on arm64.

While here fix the license as this part of locore.S to correct the
copyright owner.

Sponsored by: The FreeBSD Foundation

2 years agoApply clang fix for crash or assertion failure compiling part of llvm
Dimitry Andric [Fri, 24 Dec 2021 11:46:00 +0000 (12:46 +0100)]
Apply clang fix for crash or assertion failure compiling part of llvm

Merge commit 77e8f4eeeeed from llvm git (by David Green):

  [ARM] Define ComplexPatternFuncMutatesDAG

  Some of the Arm complex pattern functions call canExtractShiftFromMul,
  which can modify the DAG in-place. For this to be valid and handled
  successfully we need to define ComplexPatternFuncMutatesDAG.

  Differential Revision: https://reviews.llvm.org/D107476

When building parts of llvm targeting armv6 on stable/12, the following
assertion can appear (or if assertions are disabled, clang is likely to
crash):

Assertion failed: (NodeToMatch->getOpcode() != ISD::DELETED_NODE && "NodeToMatch was removed partway through selection"), function SelectCodeCommon, file /usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp, line 3573.
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /usr/obj/usr/src/freebsd12-amd64/tmp/usr/bin/c++ -cc1 -triple armv6kz-unknown-freebsd12.3-gnueabihf -S --mrelax-relocations -disable-free -disable-llvm-verifier -discard-value-names -mrelocation-model static -mconstructor-aliases -target-cpu arm1176jzf-s -target-feature +vfp2 -target-feature +vfp2sp -target-feature -vfp3 -target-feature -vfp3d16 -target-feature -vfp3d16sp -target-feature -vfp3sp -target-feature -fp16 -target-feature -vfp4 -target-feature -vfp4d16 -target-feature -vfp4d16sp -target-feature -vfp4sp -target-feature -fp-armv8 -target-feature -fp-armv8d16 -target-feature -fp-armv8d16sp -target-feature -fp-armv8sp -target-feature -fullfp16 -target-feature +fp64 -target-feature -d32 -target-feature -neon -target-feature -sha2 -target-feature -aes -target-feature -fp16fml -target-feature +strict-align -target-abi aapcs-linux -mfloat-abi hard -fallow-half-arguments-and-returns -ffunction-sections -fdata-sections -O1 -std=c++14 -fdeprecated-macro -fno-rtti -fno-signed-char -faddrsig -fexperimental-new-pass-manager PPCISelLowering-009095.ii
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module 'PPCISelLowering-009095.cpp'.
4. Running pass 'ARM Instruction Selection' on function '@_ZN4llvm17PPCTargetLoweringC2ERKNS_16PPCTargetMachineERKNS_12PPCSubtargetE'

This crash or assertion is fixed by the upstream commit.

MFC after: 3 days

2 years agoadaspindown: check disk power mode before sending IDLE command
Andriy Gapon [Fri, 24 Dec 2021 09:02:22 +0000 (11:02 +0200)]
adaspindown: check disk power mode before sending IDLE command

If a disk is already in STANDBY mode, then setting IDLE mode can
actually spin it up.

Reviewed by: mav
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D33588

2 years agoFix clerical error in page alloc
Doug Moore [Fri, 24 Dec 2021 08:47:21 +0000 (02:47 -0600)]
Fix clerical error in page alloc

Fix a very recent change that introduced a page accounting error in
case of a reserveration being broken.
Reviewed by: alc
Fixes: fb38b29b5609 (page_alloc_br) vm_page: Remove extra test, dup code from page alloc
Differential Revision: https://reviews.freebsd.org/D33645

2 years agoarm64: Introduce and use pmap_pte_exists()
Alan Cox [Thu, 23 Dec 2021 18:50:14 +0000 (12:50 -0600)]
arm64: Introduce and use pmap_pte_exists()

Use pmap_pte_exists() instead of pmap_pte() when the caller expects a
mapping to exist at a particular level.  The caller benefits in two
ways from using pmap_pte_exists().  First, because the level is
specified to pmap_pte_exists() as a constant, rather than returned, the
compiler can specialize the implementation of pmap_pte_exists() to the
caller's exact needs, i.e., generate fewer instructions.  Consequently,
within a GENERIC-NODEBUG kernel, 704 bytes worth of instructions are
eliminated from the inner loops of various pmap functions.  Second,
suppose that the mapping doesn't exist.  Rather than requiring every
caller to implement its own KASSERT()s to report missing mappings, the
caller can optionally have pmap_pte_exists() provide the KASSERT().

Reviewed by: andrew, kib
Tested by: andrew (an earlier version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33597

2 years agovm_page: Remove extra test, dup code from page alloc
Doug Moore [Fri, 24 Dec 2021 04:45:47 +0000 (22:45 -0600)]
vm_page: Remove extra test, dup code from page alloc

Extract code common to functions vm_page_alloc_contig_domain and
vm_page_alloc_noobj_contig_domain into a new function.  Do so in a way
that eliminates a bound-to-fail reservation test after a reservation
is broken by a call from vm_page_alloc_contig_domain.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D33551

2 years agorpc: Delete AUTH_NEEDS_TLS(_MUTUAL_HOST) auth_stat values
Rick Macklem [Thu, 23 Dec 2021 22:31:53 +0000 (14:31 -0800)]
rpc: Delete AUTH_NEEDS_TLS(_MUTUAL_HOST) auth_stat values

I thought that these new auth_stat values had been agreed
upon by the IETF NFSv4 working group, but that no longer
is the case.  As such, delete them and use AUTH_TOOWEAK
instead.  Leave the code that uses these new auth_stat
values in the sources #ifdef notnow, in case they are
defined in the future.

MFC after: 1 week

2 years agocxgbei: Don't fail task setup if the socket is disconnected.
John Baldwin [Wed, 22 Dec 2021 20:53:58 +0000 (12:53 -0800)]
cxgbei: Don't fail task setup if the socket is disconnected.

When the initiator is reconnecting to the target, the connection may
temporarily be marked disconnected or not have an associated socket.
New I/O requests received by the initiator in this state should not
fail with ECONNRESET as that results in an I/O error back to userland.
Instead, they need to still succeed so that CAM can queue the requests
and send them once the connection is re-established.

Setting up DDP for zero-copy receive requires a socket, so just punt
on using DDP for these transfers.

Reported by: Jithesh Arakkan @ Chelsio
Sponsored by: Chelsio Communications

2 years ago[PowerPC] PowerMac timebase sync for G4
Brandon Bergren [Thu, 23 Dec 2021 21:45:24 +0000 (15:45 -0600)]
[PowerPC] PowerMac timebase sync for G4

Summary:
Disable timebase on (some) AIM platforms (tested on PowerMac G4) prior
to synchronization.

Some platforms use a GPIO to enable and disable timebase, while others
use a platform function.

This mirrors 0d69f00b on mpc85xx.

Todo:
 * Implement various G5 timebase controls.
 * Print out platform code on unknown G5s so we can collect it.
 * Change API to be give/take pairs like Linux does so it's possible to
   do a software sync protocol.

Reviewed By: #powerpc, jhibbits
Subscribers: mikael, markmi_dsl-only.net, luporl, alfredo
Tags: #powerpc
Differential Revision: https://reviews.freebsd.org/D29136

2 years agore: Avoid subobject overread when setting IDRn
Jessica Clarke [Thu, 23 Dec 2021 20:19:31 +0000 (20:19 +0000)]
re: Avoid subobject overread when setting IDRn

IDR0-IDR5 can be read byte-by-byte but must be written to as 4-byte
words. The current code to do this is rather clunky and ends up reading
past the end of the union's eaddr member due to MAC addresses only being
6 bytes. In practice this ends up being fine because the align_dummy
member will pad the union to a multiple of 4 bytes, but this is dodgy,
and on CHERI with subobject bounds enforcement enabled, as is done in
CheriBSD's pure-capability kernel, will trap.

Instead, make the buffer in use the right size, just use an array of
uint32_t's rather than a char buffer that's then cast to uint32_t * to
simplify it in the process, and zero-initialise it first to avoid
reading uninitialised data in the trailing bytes.

Found by: CHERI
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33617

2 years agoqca: add the TLMM code into the build
Adrian Chadd [Sun, 19 Dec 2021 04:06:49 +0000 (20:06 -0800)]
qca: add the TLMM code into the build

This adds the IPQ4018 TLMM code into the IPQ4018 build.

Differential Revision: https://reviews.freebsd.org/D33554

2 years agoqcom_tlmm: add initial gpio/pinmux controller (TLMM)
Adrian Chadd [Sun, 19 Dec 2021 04:03:40 +0000 (20:03 -0800)]
qcom_tlmm: add initial gpio/pinmux controller (TLMM)

The qualcomm TLMM (top level mode manager) is their gpio/pinmux hardware
controller.

Although the pinmux is generic enough to use for the IPQ/APQ series
chips, I'm directly calling the IPQ4018 routines to expedite bring-up.

Notably, I'm not yet implementing the interrupt support - it's not
required at this stage of bring-up.

Differential Revision: https://reviews.freebsd.org/D33554

2 years agoarm: add dwc3 as a compilable driver
Adrian Chadd [Thu, 23 Dec 2021 18:36:51 +0000 (10:36 -0800)]
arm: add dwc3 as a compilable driver

The IPQ4018/IPQ4019 cores use the DWC3 core.  So make it available
here.