Initial import. Needed by upcoming patches which port virtual_oss to
base.
Sponsored by: The FreeBSD Foundation
git-subtree-dir: contrib/libsamplerate
git-subtree-mainline: e9dd9f95f8
git-subtree-split: 69a539a327
This patch adds support for the cvitek reboot controller.
This controller is present on the Milk-V riscv SoCs.
Reviewed by: br, mhorne, jrtc27
Differential review: https://reviews.freebsd.org/D48532
This patch adds support for the cvitek reset controller.
This controller is present on the Milk-V riscv SoCs. The controller is
currently only used by the if_dwc driver.
Differential Revision: https://reviews.freebsd.org/D48531
Reviewed by: jrtc27, br
This patch adds support for the cvitek flavor of the DWC ethernet
controller. This controller is present on the Milk-V riscv SoCs.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D48530
dwc_attach will currently fail if clk_set_assigned fails, even if the
"assigned_clock" property was not specified. Since there are platforms
whose DTS files do not have this property (e.g. if_dwc_aw,
if_dwc_socfpga), do not return an error if clk_set_assigned
returns ENOENT.
Reviewed by: manu
Differential review: https://reviews.freebsd.org/D48529
This patch add support for cvitek SDHCI controller (only SD card mode).
This controller is present on Milk-V's riscv SoCs.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D48528
Rename ID_AA64MMFR0_ECV_CNTHCTL to ID_AA64MMFR0_ECV_POFF as this is the
field value when FEAT_ECV_POFF is implemented.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51370
Some ID registers use 0b0000 to indicate a feature is enabled, and
0b1111 to indicate it's not. In these cases we need to tell the kernel
to treat the value as a signed field.
Set the signed flag in fields we decode that should be signed.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51369
The function pf_map_addr() and source tracking operate on a single
address family. This made sense before introducing address family
translation. When combining af-to with route-to or with sticky-address,
the next-hop or the NAT address are of different address family than
the source address. For example in NAT64 scenaro an IPv6 source address
is translated to an IPv4 address and routed over IPv4 gateway.
Make source nodes dual-AF, that is have a separate source AF and
redirection AF. Store route AF in struct pf_kstate, export it to pfctl.
When loading rules with redirection pools with pfctl store address
family of each address. When printing states don't deduce next-hop's
address family from af-to, use the one stored in state.
Reviewed by: kp
Approved by: kp
Sponsored by: InnoGames GmbH
Differential Revision: https://reviews.freebsd.org/D51659
libopencsd is used to decode Arm CoreSight traces. It isn't needed
during the boot so can be moved to /usr/lib, and may change it's API
so can be marked as private as onlt the future hwt tool will use it.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D51380
When the SCTP, TCP, or UDP implementation send a packet, it does not
compute the corresponding checksum but defers that. The network layer
will determine whether the network interface selected for the packet
has the requested capability and computes the checksum in software,
if the selected network interface doesn't have the requested
capability.
Do this not only for packets being sent by the local SCTP, TCP,
and UDP stack, but also when forwarding packets. Furthermore, when
such packets are delivered to a local SCTP, TCP, or UDP stack, do not
compute or validate the checksum, since such packets never have been on
the wire.
This allows to support checksum offloading also in the case of local
virtual machines or jails.
Support for epair, vtnet, and tap interfaces will be added in
separate commits.
Reviewed by: kp, rgrimes, tuexen, manpages
MFC after: 4 weeks
Differential Revision: https://reviews.freebsd.org/D51475
As of FreeBSD 15.0, crsetgroups() *only* sets supplementary groups,
while crsetgroups_and_egid() will do both using an array of the same
style that previous versions used for crsetgroups() -- i.e., the first
element is the egid, and the remainder are supplementary groups.
Unlike the previous iteration of crsetgroups(), crsetgroups_and_egid()
is less prone to misuse as the caller must provide a default egid to use
in case the array is empty. This is particularly useful for groups
being set from data provided by userland.
Reviewed by: olce
Suggested by: olce
Differential Revision: https://reviews.freebsd.org/D51647
Now that we can legitimately have ngroups == 0 as a result of calling
crsetgroups(), set a flag when we've set groups for the sake of sanity
checking usage of crextend(). While it's true this flag will only
really be used under INVARIANTS, it's only the second flag bit that
we're adding in 16 years.
Reviewed by: olce
Differential Revision: https://reviews.freebsd.org/D51646
loader ip implementation is using pointer to structure ip to receive
the packet and is using this pointer to cast on other data types
(namely structure arphdr). Problem does arise when those data structures
are declared with different alignment rules and when/if the compiler
does check those rules. To work around and silence warnings, use
void * generic pointer instead.
Error seen with gcc 14 (-Werror=address-of-packed-member).
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D51662
We've been running newaliases(8) when cross-building VMs for a long
time, and it's not entirely clear why -- especially since we don't
do it when we're building a native VM image.
If someone knows why running newaliases is important we can add it
back later, but only after newaliases gets unbroken: As of last week
(a3d4ae7cf3) newaliases fails with EPERM on /etc/dma/dma.conf.
This should unbreak VM (and cloudware) cross-builds.
With hat: re@
net80211 keeps the rssi value in 0.5bm relative to the noise floor
(see comment in ieee80211_node.h). Do proper maths to get a plain
rssi value back (once further fixes are in net80211).
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D50930
In general sprinkle locking assertions and harmonized KASSERTs
throughout the upper part of the driver to document expectations.
In dwmmc_cmd_done() "cmd" should be set correctly and be used for
both MMCCAM and classic mmc rather than special-casing mmccam.
In dwmmc_next_operation() place variable declarations on the top
for both cases before the first debug and lock assertion calls;
then factor out common parts at the end and put both cases in the
same order.
By calling dwmmc_next_operation() directly from both dwmmc_request()
in the mmc case, and dwmmc_cam_request() in the mmccase (rather than)
chaining calls in the latter, we avoid unlocking the sc in the mmccam
case and have a consistent call path from both; also removing the
mmccam #ifdef from dwmmc_request() brings more clarity.
In dwmmc_next_operation() enhance the panic/error messages with
some extra information and assert that we come in with a cam pinfo
on CAM_ACTIVE_INDEX.
MFC after: 3 days
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D51628
Linux drivers may pass a typed PCI_ANY_ID (-1U) in which then leads
to a warning that the value gets truncated. Switch argument types
to unsigned int (or uint32_t as we use in struct pci_device_id) to
avoid the problem.
Sponsored by: The FreeBSD Foundation
Discussed in: D50008
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D51652
The last argument (maxlen) to linuxkpi_pci_iomap_range and
linuxkpi_pci_iomap is an unsigned long not an int. LinuxKPI is
not using that argument in the end but fix it where needed.
While here adjust the name to 'maxlen' and remove the "mmio_" to
bar and off.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D51651
In some blocks of #defines spacing, trailing \ and indentation of a
second line differed. Some of them are currently fine on a single
line but future additions may not fit in that scheme.
Harmonize them into a #define X\t\t\t...\\n<4 spaces>Y scheme.
No functional changes.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D51650
acpi_check_dsm() and acpi_evaluate_dsm_typed() take a guid_t argument
and not a char *. For in-tree Linux based drivers this leads to a
compile error due to a warning. Fix the function argument type and
cast internally.
While this made the long statements in the wrapper functions for *_dsm_*
even less readable split them up using a local variable.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D51649
sys_aio_cancel() loops over pending jobs for the process, cancelling
some of them. To cancel a job with a cancel callback, it must drop the
job list mutex. It uses flags, KAIOCB_CANCELLING and KAIOCB_CANCELLED,
to make sure that a job isn't double-cancelled. However, when iterating
over the list it uses TAILQ_FOREACH_SAFE and thus assumes that the next
job isn't going to be removed while the lock is dropped. Of course,
this assumption is false.
We could simply start search from the beginning after cancelling a job,
but that might be quite expensive. Instead, introduce the notion of a
marker job, used to keep track of one's position in the queue. Use it
in sys_aio_cancel() to resume iteration after a job is cancelled.
Reported by: syzkaller
Reviewed by: kib, jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51626
POSIX.1 states that `dbm_nextkey` must return an invalid key
(i.e., `key.dptr == NULL`) after the end of the database was reached.
The current implementation of `hash_seq` will incorrectly restart
the key sequence after the end of the database is reached.
Fix this by checking the "current bucket" index when R_NEXT is passed.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51635
Reviewed by: markj
Cleanup tcp_hpts.h by
* move definition used only in tcp_hpts.c to that file
* fix a typo
* remove duplicate declarion of tcp_min_hptsi_time
* rearange declarations for simpler reading
Approved by: tuexen
MFC after: 1 week
Sponsored by: Netflix, Inc.
Don't use ticks in variable names or constant when they don't have
a relation to ticks. Use slots or usecs.
No functional change intended.
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: Netflix, Inc.
tcp_tv_to_usectick(), tcp_tv_to_mssectick(), and tcp_tv_to_lusectick()
are not related to ticks. Therefore remove the trailing 'tick'.
No functional change intended.
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: Netflix, Inc.
Failing to reset the cookie between messages can lead to an attempt
to interpret a zeroed buffer as a struct nlattr, causing a length
calculation to underflow, resulting in a memcpy() call where the
length exceeds the actual size of the buffer.
MFC after: 1 week
PR: 283797
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D51634
I meant to review the diff again to make sure that __FreeBSD_version had
not progressed in the interim, but failed to do so- belatedly bump it
for a struct ucred ABI change.
Fixes: be1f7435ef ("kern: start tracking cr_gid outside of [...]")
This is the (mostly) kernel side of de-conflating cr_gid and the
supplemental groups. The pre-existing behavior for getgroups() and
setgroups() is retained to keep the user <-> kernel boundary
functionally the same while we audit use of these syscalls, but we can
remove a lot of the internal special-casing just by reorganizing ucred
like this.
struct xucred has been altered because the cr_gid macro becomes
problematic if ucred has a real cr_gid member but xucred does not. Most
notably, they both also have cr_groups[] members, so the definition
means that we could easily have situations where we end up using the
first supplemental group as the egid in some places. We really can't
change the ABI of xucred, so instead we alias the first member to the
`cr_gid` name and maintain the status quo.
This also fixes the Linux setgroups(2)/getgroups(2) implementation to
more cleanly preserve the group set, now that we don't need to special
case cr_groups[0].
__FreeBSD_version bumped for the `struct ucred` ABI break.
For relnotes: downstreams and out-of-tree modules absolutely must fix
any references to cr_groups[0] in their code. These are almost
exclusively incorrect in the new world, and cr_gid should be used
instead. There is a cr_gid macro available in earlier FreeBSD versions
that can be used to avoid having version-dependant conditionals to refer
to the effective group id. Surrounding code may need adjusted if it
peels off the first element of cr_groups and uses the others as the
supplemental groups, since the supplemental groups start at cr_groups[0]
now if &cr_groups[0] != &cr_gid.
Relnotes: yes (see last paragraph)
Co-authored-by: olce
Differential Revision: https://reviews.freebsd.org/D51489
It is known that nvidia modules, like the drm modules that are already
present, will panic if loaded in early boot rather than later. Pop them
into our list to deny loading them if someone were to add, e.g.,
nvidia-modeset_load="YES", to their loader.conf. This doesn't prevent
them from being loaded if one drops to the loader prompt, but it does
prevent the standard user from easy foot-shooting if they find old or
inaccurate information out in the wild.
Reviewed by: imp, kbowling
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D51644
Enabling and disabling LLVM assertions changes the ABI. There have
been multiple reports on the freebsd-current@ mailing list of broken
'cc'.
Out of caution, you may wish to do a clean build while crossing this
commit after building the reverted commit if you do not set
LLVM_ASSERTIONS in your src.conf.
Discussed with: kevans, jrtc27
This reverts commit 9b3055d0d4.
Add a test to verify swapon's behavior when attaching to media that's too small.
This also adapts existing tests to accommodate kernel page sizes larger than
the default 4KB.
Approved by: kib, chs (previous version)
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D51641
This package has been newly split off during man page reorganization and
should be considered part of the "base" component rather than being
ignored. Update pkgbase release and bsdinstall scripts for this change.
Reviewed by: ivy
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51519
Looks like during the capsicum setup the return value for cap_syslogd
is checked twice rather than checking the return value of cap_net
after initializing the casper service.
Signed-off-by: Nathan Huff <nhuff@acm.org>
Fixes: 897240c7d6 ("syslogd: Enter capability mode")
Pull-request: https://github.com/freebsd/freebsd-src/pull/1796
Use bool for isrmdir argument to
ufs_dirremove()/softdep_setup_remove()/newdirrem(), where it is used as
bool.
Use u_int for isrmdir argument to
ufs_dirrewrite()/softdep_setup_directory_change()
where it is 0/1/ino. Without the change to unsigned, the
if (isrmdir > 1)
test is broken on volumes with many inodes.
Use newparent instead of isrmdir for the argument name in this case.
Reviewed by: markj, olce
Tested by: pho
Fixes: 610319c766
Fixes: 98eb6f0eaa
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D51617
There is no reason to change the font in order to select a keymap or a
font.
This was done in the syscons(4) era to ensure that a font with the
appropriate character set was used for kbdmap or vidfont's localized
menu, but vt is always UTF-8 and this is no longer necessary.
PR: 235565
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51640