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)
- 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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
- 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)
- 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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)