Commit graph

148768 commits

Author SHA1 Message Date
Emmanuel Vadot
d10e2facd6 arm64: dtb: Add rk3566-quartz64-a.dts to the build
We can boot on this board.

(cherry picked from commit 2303980cfcb1e709c17b108ce66a25a8e7eea337)
2023-10-18 16:33:37 +02:00
Emmanuel Vadot
fd4760cbda arm64: rockchip: rk_clk_composite: Remove gate code
It was a bad idea to have composite clock directly managing gates.
All clocks drivers have been rewrite to not use this functionality
and directly export the gate. We can now remove this code.

(cherry picked from commit db34f02028f30bbf099bf1bce7ce66184f51b332)
2023-10-18 16:33:35 +02:00
Emmanuel Vadot
57209137eb arm64: rockchip: rk3399_pmucru: Finish exporting all clocks
- All used clocks are now exported.
- Use the macros from rk_cru.h so code is similar to other rk clock drivers.

(cherry picked from commit 829b06ad8f6f3317777c2395a090a898fdcd550c)
2023-10-18 16:33:33 +02:00
Emmanuel Vadot
66765585ab arm64: rockchip: Remove CRU_GATE macro
It's unused now

(cherry picked from commit 5b7fe78032a0d07995c1c1c005d82c3a1fe8a056)
2023-10-18 16:33:32 +02:00
Emmanuel Vadot
1469218c9c arm64: rockchip: rk3399_pmucru: Use GATE macro
It make it easier to read the code and the register number

(cherry picked from commit 3d2ccc352db54b9fb11c4c1373a577e3e9d25114)
2023-10-18 16:33:31 +02:00
Emmanuel Vadot
14652ce3f5 arm64: rockchip: rk3328_cru: Use GATE macro
It make it easier to read the code and the register number

(cherry picked from commit 7c6c426f29831799d1eae1ca5d4036a219b52fca)
2023-10-18 16:33:29 +02:00
Emmanuel Vadot
4bb49357e0 arm64: rockchip: rk3568_cru: Rewrite
Rewrite correctly the clocks for cru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:  a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
(cherry picked from commit 50a0f1ce28b7f04fc23915fb06124242632a013c)
2023-10-18 16:33:28 +02:00
Emmanuel Vadot
90b135d8c2 arm64: rockchip: rk3568_pmucru: Rewrite
Rewrite correctly the clocks for pmucru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:	a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
(cherry picked from commit 7b6ae431cf70cd8683270b3e315a14e61d666522)
2023-10-18 16:33:26 +02:00
Emmanuel Vadot
dda809fb31 arm64: rockchip: clk: Define PLIST macro in rk_cru.h
We use it in all clock drivers so no need to define it everywhere

(cherry picked from commit 8ae54db63970e9370d3d88f6eb57c102e085a128)
2023-10-18 16:33:25 +02:00
Emmanuel Vadot
26bf8fff64 xilinx: reset: Remove debug printfs
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 257405d707d77bc55b38e7c2bb83b8a9247a86ae)
2023-10-18 16:32:37 +02:00
Emmanuel Vadot
b4cd14485a i2c: Add Microcrystal RV3032 RTC driver
This is a simple RTC driver for the rv3032 from Microcrystal.
Just the basic functionality is implemented (no timer, alarm etc ..).

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41995

(cherry picked from commit 1d6a6a524409662992ca96bc91ae69b2a2a5ff35)
2023-10-18 16:32:19 +02:00
Emmanuel Vadot
7b824791e7 i2c: Add cadence iic driver
This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64)
so only enable it there for now.

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

(cherry picked from commit 137b58e4d2044adc200d13c8989d3746a0a4bd7f)
2023-10-18 16:32:17 +02:00
Emmanuel Vadot
c133589105 iicbus: Move opencores i2c driver into controller subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41914

(cherry picked from commit 125f5c5b48b1fdccf364b821ce48bfdbd9687ed1)
2023-10-18 16:32:15 +02:00
Emmanuel Vadot
96edbfe36b iicbus: Move i2c sensors drivers into new sensor subdirectory
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41913

(cherry picked from commit 7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074)
2023-10-18 16:32:14 +02:00
Emmanuel Vadot
83dcc494a7 iicbus: conf: Fix pcf8574 entry
It lives in the gpio subdirectory

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41912

(cherry picked from commit 918a10c9f792d2c2f78b75626f7bf2abc85a0fff)
2023-10-18 16:32:12 +02:00
Emmanuel Vadot
cd2f6226e7 iicbus: Move ADC drivers into a new adc subfolder
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41911

(cherry picked from commit 06589d6e029c6ff64a7816d743e0a508abe6193b)
2023-10-18 16:32:11 +02:00
Emmanuel Vadot
26dd10a4f3 iicbus: Move adm1030 and adt746x to new pwm subdirectory
Those are (mainly) pwm controller so move it under a new subdirectory.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41910

(cherry picked from commit 22d7dd834bc5cd189810e414701e3ad1e98102e4)
2023-10-18 16:32:10 +02:00
Emmanuel Vadot
8d715e2f49 iicbus: Move Silergy pmic/regulators under pmic/silergy subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41909

(cherry picked from commit 062944cc4227e7bd002e4de2be48ec9b710bfaa5)
2023-10-18 16:32:08 +02:00
Emmanuel Vadot
5e25c410bd iicbus: Move remaining rtc driver into rtc subfolder
No reason that they should live directly under iicbus

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41908

(cherry picked from commit 2f16049c985a364e2bd2b256f5bef9af17e10c62)
2023-10-18 16:32:07 +02:00
Emmanuel Vadot
a5b3cbe6cc iicbus: Move twsi under a new controller subdirectory
The folder is a mess so start moving stuff into sub-directories.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41907

(cherry picked from commit 580d00f42fdd94ce43583cc45fe3f1d9fdff47d4)
2023-10-18 16:32:05 +02:00
Emmanuel Vadot
1e685c7dd5 if_cgem: Rewrite clock part
- pclk and hclk are mandatory so always try to get them.
   Don't make it fatal if it fails as some platform (like Zynq) don't
   have a proper clock driver.
 - Always use pclk for the reference clock.
 - Try to get all the possible clocks and enable them.

Reviewed-by:	mhorne
Tested-by:	Milan Obuch <bsd@dino.sk>
Differential Revision:	https://reviews.freebsd.org/D41857
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4c52dde5bda099936d43820da84e569dccc6f475)
2023-10-18 16:31:13 +02:00
Emmanuel Vadot
770b790eab if_cgem: Cleanup compatible and add new ones
- Remove cdns,gem, it's the generic binding but for all platform that include
  this one we need specific drivers setup so remove it.
- Remove cdns,macb, it's the generic binding for Atmel AT91 which we don't suport
- Remove cadence,gem, it's not an official binding and seems to be only used in some
  obscure ARM11 SoC.
- Note that the cdns,zynq* are deprecated
- Add the new Xilinx compatible for zynq and zynqmp

Reviewed-by:	mhorne
Tested-by:	skibo, Milan Obuch <bsd@dino.sk>
Differential Revision:	https://reviews.freebsd.org/D41856
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit bdbbbbb32104569fccd786d9cc07d17f6231a713)
2023-10-18 16:31:11 +02:00
Emmanuel Vadot
0af2307d59 sdhci: fdt: Correctly export clock per the binding
The binding says that we can have one or two clocks to export.
The first one is the actual sdclock while the second is the sample clock.
Both have the same parent, clk_xin.
Correctly export the clocks for RK3399 and ZynqMP.
No need to use a high ID as before, we have our own clock domain so use
ids starting at 1 as all exported clocks should be.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41810
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 81a4fe38a6ce818bb7cba548bb2c697429fa9479)
2023-10-18 16:31:10 +02:00
Emmanuel Vadot
62b14a7531 sdhci: fdt: Always try to get the phy and the syscon
Per the bindings the phy and the syscon can always be present not just
for RK3399.

Reviewed-by:	bz
Differiential Revision:	https://reviews.freebsd.org/D41809
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 0ee5d6fcfc63be48fd7c1b461917dfb880dc7f72)
2023-10-18 16:31:08 +02:00
Emmanuel Vadot
d6a1d41df4 sdhci: fdt: Always enable clock for ZynqMP and RK3399
Those two (in fact all of the supported one in this driver except RK3568) always
needs the clocks to be enabled.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41808
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 9377d7049c846d1e35c8fc8809c23e6413909fca)
2023-10-18 16:31:07 +02:00
Emmanuel Vadot
023ba06b4f sdhci: fdt: Remove sdhci_generic compatible string
This was used when we had our own DTS, it's not used anymore.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41807
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 8c7e747491ad636d6ee4069a74ddb24814870540)
2023-10-18 16:31:05 +02:00
Emmanuel Vadot
20d6c796fa arm64: zynqmp: Add clock driver
Add clock and reset drivers for the ZynqMP SoC.
The clocks are discovered by talking to the firmware as the topology isn't
fixed on this SoC.

Differential Revision:	https://reviews.freebsd.org/D41812
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4e579ad047720775ab580b74192c7de8a3386fea)
2023-10-18 16:31:03 +02:00
Emmanuel Vadot
ab8f34675a arm64: zynqmp: Add firmware driver
The ZynqMP SoC have a MCU running a firmware to control clocks, resets,
fpga loading etc ...
Add a driver that can be use to communicate with it.
For now only the clock and reset part are implemented.

Differential Revision:	https://reviews.freebsd.org/D41811
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 9e88711f28dc9afa7d68ae8dd027d2399a2a290b)
2023-10-18 16:31:01 +02:00
Emmanuel Vadot
62ce4a798f cpufreq_dt: Find the closest frequency
When building the frequencies table we convert the value in the DTS to
megahertz and loose precision. While it's not a problem for most of the
DTS it is when the expected frequency value is strict down to the hertz.
So it's either we don't truncate the value and have some ugly and long
values in the sysctls or we just find the closest frequency.
Do the latter.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D41762
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 17c17872ca98df0e2b9f9c7a2c41ef73f7dee21a)
2023-10-18 16:30:22 +02:00
Gordon Bergling
44e3ce37f2 uma.h: Fix a typo in a source code comment
- s/setable/settable/

(cherry picked from commit fc9f1d2c6391b1a4b133aab56ace625b72c9ea85)
2023-10-18 07:57:16 +02:00
Dmitry Chagin
133ada6bff linux(4): Drop the outdated comment, nosys is fine since 39024a89
MFC after:		1 week

(cherry picked from commit 03f5bd1e462576838e79145379ce314e2e03e4b3)
2023-10-18 08:52:33 +03:00
Dmitry Chagin
c9ec2fb86c linux(4): Drop the outdated comments about sixth register on i386 int0x80
This is well documented in the Linux syscall(2).

MFC after:		1 week

(cherry picked from commit 5bdd74cc05e6c7d110688feacdbd22b6dffe5d72)
2023-10-18 08:52:33 +03:00
Olivier Certner
b6b76c1c09 groupmember(), realgroupmember(): Return a bool instead of an int
Requested by:           mhorne
Reviewed by:            mhorne
MFC after:              2 weeks
MFC to:                 stable/14 releng/14.0
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40958
Differential Revision:  https://reviews.freebsd.org/D40959

(cherry picked from commit ffd3ef8ee0253ffaf214cf711251d112f6a2bcf6)
(cherry picked from commit 845b7c80887ac84c82ee776836ef86d68ea71c94)
2023-10-17 16:42:59 -03:00
Olivier Certner
f482bc9584 cr_canseeothergids(): Use real instead of effective group membership
Using the effective group and not the real one when testing membership
has the consequence that unprivileged processes cannot see setuid
commands they launch until these have relinquished their privileges.
This is also in contradiction with how the similar cr_canseeotheruids()
works, i.e., by taking into account real user IDs.

Fix this by substituting groupmember() with realgroupmember().  While
here, simplify the code.

PR:                     272093
Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40642
Differential Revision:  https://reviews.freebsd.org/D40644

(cherry picked from commit 91658080f1a598ddda03943a783c9a941199f7d2)
(cherry picked from commit 0452dd841336cea7cd979b13ef12b6ea5e992eff)
2023-10-17 16:42:59 -03:00
Olivier Certner
d1fde7841f New realgroupmember()
Like groupmember(), but taking into account the real group instead of
the effective group.  Leverages the new supplementary_group_member()
function.

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40641
Differential Revision:  https://reviews.freebsd.org/D40643

(cherry picked from commit 2a2bfa6ad92e9c82dcc55733ad2fd58fd2ea7559)
(cherry picked from commit 5d9f38405a10fdcd9fc108c940dcf2642e9f1833)
2023-10-17 16:42:59 -03:00
Olivier Certner
f3de805ace groupmember(): Extract the supplementary group search in a separate function
This is in preparation for the introduction of the new realgroupmember()
function, which does the same search into supplementary groups as
groupmember().

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40640

(cherry picked from commit b725f232f3b09b4bcbc426854fe1545234c66965)
2023-10-17 16:42:59 -03:00
Olivier Certner
e1153205a7 Fix 'security.bsd.see_jail_proc' by using cr_bsd_visible()
As implemented, this security policy would only prevent seeing processes
in sub-jails, but would not prevent sending signals to, changing
priority of or debugging processes in these, enabling attacks where
unprivileged users could tamper with random processes in sub-jails in
particular circumstances (conflated UIDs) despite the policy being
enforced.

PR:                     272092
Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40628

(cherry picked from commit 5817169bc4a06a35aa5ef7f5ed18f6cb35037e18)
2023-10-17 16:42:58 -03:00
Olivier Certner
3ad322db89 New cr_bsd_visible(): Whether BSD policies deny seeing subjects/objects
This is a new helper function that leverages existing code: It calls
successively cr_canseeotheruids(), cr_canseeothergids() and
cr_canseejailproc() (as long as the previous didn't deny access).  Will
be used in a subsequent commit.

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40627

(cherry picked from commit e4a7b4f99cfd4931468c0866da4ae8b49cf5badb)
2023-10-17 16:42:58 -03:00
Olivier Certner
9dad3ed1d1 cr_canseejailproc(): New privilege, no direct check for UID 0
Use priv_check_cred() with a new privilege (PRIV_SEEJAILPROC) instead of
explicitly testing for UID 0 (the former has been the rule for almost 20
years).

As a consequence, cr_canseejailproc() now abides by the
'security.bsd.suser_enabled' sysctl and MAC policies.

Update the MAC policies Biba and LOMAC, and prison_priv_check() so that
they don't deny this privilege.  This preserves the existing behavior
(the 'root' user is not restricted, even when jailed, unless
'security.bsd.suser_enabled' is not 0) and is consistent with what is
done for the related policies/privileges (PRIV_SEEOTHERGIDS,
PRIV_SEEOTHERUIDS).

Reviewed by:            emaste (earlier version), mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40626

(cherry picked from commit 7974ca1cdbee949f5e453eea112be265b425c407)
2023-10-17 16:42:58 -03:00
Zhenlei Huang
fd9de12a71 sctp: Various fixes for loader tunables
The following sysctl variables are actually loader tunables. Add sysctl
flag CTLFLAG_TUN to them so that `sysctl -T` will report them correctly.

 1. net.inet.sctp.tcbhashsize
 2. net.inet.sctp.pcbhashsize
 3. net.inet.sctp.chunkscale

The loader tunable 'net.inet.sctp.tcbhashsize' and 'net.inet.sctp.chunkscale'
are only used during vnet initializing, thus it make no senses to make them
writable tunable.

Validate the values of loader tunables on vnet initialize, reset them to
theirs defaults if invalid to prevent potential kernel panics.

Reviewed by:	tuexen, #transport, #network
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42007

(cherry picked from commit dac91eb7660324677d8a2f71bd6f192422355ba1)
2023-10-16 23:15:37 +08:00
Zhenlei Huang
3a97686fc1 tcp: Simplify the initialization of loader tunable 'net.inet.tcp.tcbhashsize'
No functional change intended.

Reviewed by:	cc, rscheff, #transport
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41998

(cherry picked from commit 38ecc80b2a4e5e11ece83ca4df63632f0b6fa394)
2023-10-16 23:15:37 +08:00
Kristof Provost
ff15498894 netlink: move NETLINK define to opt_global.h
Move the NETLINK define into opt_global.h so we can rely on it being
set correctly, without having to remember to include opt_netlink.h.
This ensures that the NETLINK define is correctly set. If not we
may end up with unloadable modules, due to missing symbols (such as
nlmsg_get_group_writer).

PR:		274306
Reviewed by:	imp, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42179

(cherry picked from commit ab393e9548f8cc0ee28499c411963b798ebb38a5)
2023-10-16 09:42:33 +02:00
Konstantin Belousov
23a55498a8 vkbd: correct ref count on cloned cdevs
(cherry picked from commit 6e92fc930943a85f311e986a02e2b3dae9e37126)
2023-10-16 10:16:01 +03:00
Konstantin Belousov
5230afce76 tun/tap: correct ref count on cloned cdevs
PR:	273418

(cherry picked from commit 27f1ec0be24b45559793e486a4fa5a2e7fdadc17)
2023-10-16 10:16:01 +03:00
Martin Matuska
b2d6bc7597 zfs: merge openzfs/zfs@95785196f (zfs-2.2-release) into stable/14
OpenZFS release 2.2.0

This commit adjusts the version numbers only.

Obtained from:	OpenZFS
OpenZFS commit:	95785196f2
OpenZFS tag:	zfs-2.2.0
2023-10-14 20:29:47 +02:00
Alan Somers
8fca98f688 fusefs: sanitize FUSE_READLINK results for embedded NULs
If VOP_READLINK returns a path that contains a NUL, it will trigger an
assertion in vfs_lookup.  Sanitize such paths in fusefs, rejecting any
and warning the user about the misbehaving server.

PR:		274268
Sponsored by:	Axcient
Reviewed by:	mjg, markj
Differential Revision: https://reviews.freebsd.org/D42081

(cherry picked from commit 662ec2f781521c36b76af748d74bb0a3c2e27a76)
2023-10-14 11:57:09 -06:00
Mark Johnston
29de7af6ee mrsas: Fix callout locking in mrsas_complete_cmd()
callout_stop() requires the associated lock to be held.

This is a bit hacky, but I believe it's safe since the subsequent
mrsas_cmd_done() call will also acquire the SIM lock to stop a different
callout.

PR:		265484
Reviewed by:	imp
Tested by:	Jérémie Jourdin <jeremie.jourdin@advens.fr>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39559

(cherry picked from commit 4640df1b0a49697840b81f6bcd269a483514c6aa)
2023-10-14 11:29:11 -04:00
Mateusz Guzik
bdd19ce53c vfs: convert recycles_count and recycles_free_count to mere u_long
Only vnlru ever updates them.

This also removes recycles_count updates from hand-rolled debug vnode
recycling via sysctl.

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

(cherry picked from commit 37544d9768110fd67527db7f2a3f7bb6fc977582)
2023-10-13 23:41:48 +00:00
Mateusz Guzik
e4f85a24f9 vfs: count recycles by vnlru and by vn_alloc separately
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit a92fc3122d2becfbf5a627af6eda5cedfac57c31)
2023-10-13 23:41:48 +00:00
Mateusz Guzik
c1ffb1ffee vfs: count calls to uma_reclaim in vnlru
(cherry picked from commit bb679b0c49094757f2aef3d8fe46c41dc8192fea)
2023-10-13 23:41:48 +00:00