]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoctf: Add v3 support to CTF tools, ctf{convert,dump,merge}
Mark Johnston [Mon, 7 Mar 2022 13:54:18 +0000 (08:54 -0500)]
ctf: Add v3 support to CTF tools, ctf{convert,dump,merge}

ctfdump handles v2 and v3.  ctfconvert now emits only CTFv3, whereas
ctfmerge can merge v2 and v3 containers into v3 containers.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34364

2 years agolibctf: Handle CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:53:27 +0000 (08:53 -0500)]
libctf: Handle CTFv3 containers

In general, the patch adds indirection to minimize the amount of code
that needs to know about differences between v2 and v3.  Specifically,
some new ctf_get_ctt_* functions are added, and new LCTF_* macros are
added to use the underlying container's version to do the right thing.

CTF containers can have parent/child relationships, wherein a type ID in
one container refers to a type in the parent.  It is permitted for the
parent and child to have different versions.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34363

2 years agolinker: Permit CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:53:05 +0000 (08:53 -0500)]
linker: Permit CTFv3 containers

Reviewed by: Domagoj Stolfa
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34362

2 years agofbt: Add support for CTFv3 containers
Mark Johnston [Mon, 7 Mar 2022 13:45:53 +0000 (08:45 -0500)]
fbt: Add support for CTFv3 containers

The general aim in this and subsequent patches is to minimize the
amount of code that directly references CTF types such as ctf_type_t,
ctf_array_t, etc.  To that end, introduce some routines similar to the
existing fbt_get_ctt_size() (which exists to deal with differences
between v1 and v2) and change ctf_lookup_by_id() to return a void
pointer.

Support for v2 containers is preserved.

MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34361

2 years agoctf: Add definitions for CTFv3
Mark Johnston [Mon, 7 Mar 2022 13:44:02 +0000 (08:44 -0500)]
ctf: Add definitions for CTFv3

These are based on definitions added to binutils' libctf.  Specifically:
- Type IDs are now encoded in 32 bits rather than 16, changing the
  layout of ctf_type_t, ctf_array_t, ctf_member_t and ctf_lmember_t.
- Type info is encoded in 32 bits rather than 16.  The type "kind" is
  extended from 5 bits to 6, and the type "vlen" is extended from 10
  bits to 25.

The main upside is that we remove the current limit, imposed by CTFv2,
of 2^{15} distinct types in the main kernel executable.  Other limits,
such as that on the number of elements in an enum, imposed by the vlen
limit, are also raised.

This change adds v2 and v3 flavours of macros and type definitions which
differ between the two versions.  Compatibility is preserved for now by
having generic names refer to the v2 definitions, so, e.g., ctf_type_t
is still a v2 type.

No functional change intended.

Reviewed by: Domagoj Stolfa
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34360

2 years agolinker: Simplify CTF container handling
Mark Johnston [Mon, 7 Mar 2022 13:43:42 +0000 (08:43 -0500)]
linker: Simplify CTF container handling

Use sys/ctf.h to provide various definitions required to parse the CTF
header.  No functional change intended.

Reviewed by: Domagoj Stolfa, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34359

2 years agoctf: Import ctf.h from OpenBSD
Mark Johnston [Mon, 7 Mar 2022 13:42:57 +0000 (08:42 -0500)]
ctf: Import ctf.h from OpenBSD

Use it instead of the existing ctf.h from OpenSolaris.  This makes it
easier to use CTF in the core kernel, and to extend the CTF format to
support wider type IDs.

The imported ctf.h is modified to depend only on _types.h, and also to
provide macros which use the "parent" bit of a type ID to refer to types
in a parent CTF container.

No functional change intended.

Reviewed by: Domagoj Stolfa, emaste
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34358

2 years agopowerpc: FreeBSD kernel compatibility cleanup
Alfredo Dal'Ava Junior [Mon, 7 Mar 2022 17:30:26 +0000 (14:30 -0300)]
powerpc: FreeBSD kernel compatibility cleanup

Adjust FreeBSD kernel backward compatibility list

Reviewed by: jhibbits, pkubaj
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D33421

2 years agoRework the arm64 sigtramp code to be a trampoline
Andrew Turner [Wed, 29 Dec 2021 17:40:42 +0000 (17:40 +0000)]
Rework the arm64 sigtramp code to be a trampoline

To help with switching to a vdso sigtramp switch to passing through the
sigcode function when entering a signal. This ensures the return address
is within the function.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33690

2 years agobsddialog: new utility for TUI dialogs and widgets
Alfonso S. Siciliano [Sun, 6 Mar 2022 21:44:17 +0000 (22:44 +0100)]
bsddialog: new utility for TUI dialogs and widgets

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34101

2 years agotests: Fix the test plan for closefrom_test
Mark Johnston [Sun, 6 Mar 2022 17:56:33 +0000 (12:56 -0500)]
tests: Fix the test plan for closefrom_test

Fixes: f3f3e3c44d3b ("fd: add close_range(..., CLOSE_RANGE_CLOEXEC)")
Reported by: Jenkins

2 years agonetmap: add a tunable for the maximum number of VALE switches
Vincenzo Maffione [Sun, 6 Mar 2022 17:28:44 +0000 (17:28 +0000)]
netmap: add a tunable for the maximum number of VALE switches

The new dev.netmap.max_bridges sysctl tunable can be set in
loader.conf(5) to change the default maximum number of VALE
switches that can be created. Current defaults is 8.

MFC after: 2 weeks

2 years agonetmap: fix refcount bug in netmap allocator
Vincenzo Maffione [Sun, 6 Mar 2022 16:39:16 +0000 (16:39 +0000)]
netmap: fix refcount bug in netmap allocator

Symptom: when a single extmem memory region is provided to netmap
multiple times, for multiple interfaces, the memory region is
never released by netmap once all the existing file descriptors
are closed.

Fix the relevant condition in netmap_mem_drop(): release the memory
when the last user of netmap_adapter is gone, rather then when
the last user of netmap_mem_d is gone.

MFC after: 2 weeks

2 years agolibc __sfvwrite(): roll back FILE buffer pointer on fflush error
Konstantin Belousov [Sun, 6 Mar 2022 08:59:39 +0000 (10:59 +0200)]
libc  __sfvwrite(): roll back FILE buffer pointer on fflush error

__sfvwrite() advances the pointer before calling fflush.  If fflush()
fails, it is not enough to roll back inside it, because we cannot know
how much was advanced by the caller.

Reported by: Peter <pmc@citylink.dinoex.sub.org>
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Fixes: 86a16ada1ea608408cec370171d9f59353e97c77

2 years agobuf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS
Konstantin Belousov [Wed, 16 Feb 2022 15:30:17 +0000 (17:30 +0200)]
buf_alloc(): Stop using LK_NOWAIT, use LK_NOWITNESS

Despite the buffer taken from cache or free list, it still can be
locked, due to 'lockless lookup' in getblkx() potentially operating on
the freed buffers.  The lock is transient, but prevents the use of
LK_NOWAIT there for the goal of neutralizing WITNESS.

Just use LK_NOWITNESS.

Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agossh: regen sk_config.h after 73104d583850
Ed Maste [Sun, 6 Mar 2022 00:59:51 +0000 (19:59 -0500)]
ssh: regen sk_config.h after 73104d583850

2 years agossh: generate SK config file using private cbor and fido2 libs
Ed Maste [Tue, 1 Mar 2022 21:39:16 +0000 (16:39 -0500)]
ssh: generate SK config file using private cbor and fido2 libs

Specify -lprivatecbor and -lprivatefido2 in OpenSSH's configure.ac, and
pass -I paths to libcbor and libfido2's contrib src location.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34440

2 years agoDelete a blank that messed up punctuation.
Jens Schweikhardt [Sat, 5 Mar 2022 21:52:52 +0000 (22:52 +0100)]
Delete a blank that messed up punctuation.

2 years ago/etc/hosts: Wording changes to better match RFC 1918
Pedro F. Giffuni [Mon, 28 Feb 2022 04:07:34 +0000 (23:07 -0500)]
/etc/hosts: Wording changes to better match RFC 1918

Summary: No functional change.

Subscribers: imp

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

2 years agoahci/siis/mvs: Fix panics after 3394d4239b.
Alexander Motin [Sat, 5 Mar 2022 01:49:05 +0000 (20:49 -0500)]
ahci/siis/mvs: Fix panics after 3394d4239b.

Full CCB header overwrites made frees go into wrong zones, causing
kernel panics.  Instead of copying full header use xpt_setup_ccb(),
since the only field I see used from all the header is target_id.

PR: 262263

2 years agolibbsddialog: Add _XOPEN_SOURCE_EXTENDED for widechar form
Alfonso S. Siciliano [Sat, 5 Mar 2022 01:20:37 +0000 (02:20 +0100)]
libbsddialog: Add _XOPEN_SOURCE_EXTENDED for widechar form

Add _XOPEN_SOURCE_EXTENDED to use curses' get_wch() and to avoid a
building error after next "bsddialog 0.2" import.

Approved by: bapt (mentor)
Differential Revision: https://reviews.freebsd.org/D34419

2 years agox86: Defer early TSC timecounter calibration to SI_SUB_CPU
Mark Johnston [Sat, 5 Mar 2022 00:34:43 +0000 (19:34 -0500)]
x86: Defer early TSC timecounter calibration to SI_SUB_CPU

If we can't determine the TSC frequency using CPU registers, we need to
give a chance for Hyper-V drivers to register a timecounter (during
SI_SUB_HYPERVISOR) since an emulated 8254 might not be available.
Thus, split probe_tsc_freq() into early and late stages, and wait until
the latter to attempt calibration using a reference clock.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported and tested by: khng, Shawn Webb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34444

2 years agoamd64: Call clock_init() after finishidentcpu()
Mark Johnston [Sat, 5 Mar 2022 00:32:39 +0000 (19:32 -0500)]
amd64: Call clock_init() after finishidentcpu()

As in commit c3d830cf7c71, we should finalize CPU identification before
probing the TSC frequency.

Fixes: 84369dd52369 ("x86: Probe the TSC frequency earlier")
Reported by: khng

2 years agoice(4): Fix build error when ALTQ is enabled
Eric Joyner [Fri, 4 Mar 2022 22:11:14 +0000 (14:11 -0800)]
ice(4): Fix build error when ALTQ is enabled

The previous commit (56429daea2) that updated the driver included a
bug where a variable was undefined when ALTQ was enabled; this fixes
that issue to declare the missing variable. This wasn't caught before
because we don't use ALTQ, and so it fell on the Jenkins CI's LINT
builds to catch it.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reported by: Jenkins CI
MFC after: 3 days
MFC with: 56429daea2
Sponsored by: Intel Corporation

2 years agoFix indentation in usr.bin/diff/pr.c
Dimitry Andric [Mon, 28 Feb 2022 20:06:19 +0000 (21:06 +0100)]
Fix indentation in usr.bin/diff/pr.c

In commit 6fa5bf0832ef the pr(1) related code in diff was moved around,
but some part of the indentation was messed up, and one line was
duplicated. Remove the duplicated line, and fix up the indentation.

Reviewed by: bapt
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D34398

2 years agoboottrace.4: Reference tslog(4)
Mateusz Piotrowski [Fri, 4 Mar 2022 19:42:27 +0000 (20:42 +0100)]
boottrace.4: Reference tslog(4)

2 years agotslog.4: Document TSLOG
Mateusz Piotrowski [Fri, 4 Mar 2022 19:33:22 +0000 (20:33 +0100)]
tslog.4: Document TSLOG

Based on commit messages and Colin Percival's presentation
from BSDCan 2018 [1].

[1]: https://papers.freebsd.org/2018/bsdcan/percival-Profiling_the_FreeBSD_kernel_boot.files/percival-Profiling_the_FreeBSD_kernel_boot.pdf

Reviewed by: cperciva, debdrup
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34430

2 years agorc.conf: Fix a typo
Mateusz Piotrowski [Fri, 4 Mar 2022 19:14:18 +0000 (20:14 +0100)]
rc.conf: Fix a typo

Reported by: Pau Amma <pauamma@gundo.com>
MFC after: 3 days
MFC with: 8719e8a951b78

2 years agotime.3: Update ERRORS section
Mateusz Piotrowski [Fri, 4 Mar 2022 14:09:32 +0000 (15:09 +0100)]
time.3: Update ERRORS section

time() is now implemented using clock_gettime(2) instead of
gettimeofday(2).

Reviewed by: debdrup
Fixes: 358ed16f7505 Use clock_gettime(CLOCK_SECOND)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34438

2 years agoix(4): Add control of 2.5/5G autonegotiation speeds
Piotr Pietruszewski [Fri, 4 Mar 2022 18:37:59 +0000 (10:37 -0800)]
ix(4): Add control of 2.5/5G autonegotiation speeds

This change enables the user to control 2.5G and 5G autonegotiation
speeds via advertise_speed sysctl for X550T devices. Due to reported
interoperability issues with switches, 2.5G and 5G speeds will not be
advertised by default.

Signed-off-by: Piotr Pietruszewski <piotr.pietruszewski@intel.com>
Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Tested by: gowtham.kumar.ks@intel.com
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D26245

2 years agoixv(4): Allow PF to control the VF link state
Piotr Pietruszewski [Fri, 4 Mar 2022 18:33:02 +0000 (10:33 -0800)]
ixv(4): Allow PF to control the VF link state

This patch adds checks of a VF link state provided by PF via mailbox
API. Such change enables the PF to disable a VF administratively.

Since command needed by the PF to control the VF is introduced in
mailbox api version 1.2, this patch also bumps supported mailbox api
version to 1.2.

Co-authored-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed By: kbowling@
Tested by: lukasz.szczepaniak@intel.com
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D32004

2 years agoice(4): Update to 1.34.2-k
Eric Joyner [Fri, 4 Mar 2022 18:25:25 +0000 (10:25 -0800)]
ice(4): Update to 1.34.2-k

- Adds FW logging support
  - Once enabled, this lets the firmware print event and error messages
    to the log, increasing the visibility into what the hardware is
    doing; this is useful for debugging
- General bug fixes
- Adds inital DCB support to the driver
  - Notably, this adds support for DCBX to the driver; now with the
    fw_lldp sysctl set to 1, the driver and adapter will adopt a DCBX
    configuration sent from a link partner
  - Adds statistcs sysctls for priority flow control frames
  - Adds new configuration sysctls for DCB-related features: (VLAN) user
    priority to TC mapping; ETS bandwidth allocation; priority flow
    control
- Remove unused SR-IOV files (until support gets added)

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Tested by: jeffrey.e.pieper@intel.com
MFC after: 3 days
MFC with: 213e91399be438f0a975
Relnotes: yes
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34024

2 years agovt(4): note that VGA palette configuration is not supported
Ed Maste [Thu, 3 Mar 2022 22:01:44 +0000 (17:01 -0500)]
vt(4): note that VGA palette configuration is not supported

PR: 261311
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34431

2 years agorc.d/ggated: Simplify service script
Mateusz Piotrowski [Fri, 4 Mar 2022 14:53:01 +0000 (15:53 +0100)]
rc.d/ggated: Simplify service script

- Use the standard *_flags variable for additional flags.
- Style: do not create unnecessary variables
- Do not set the defaults in the service script. This is what
  /etc/defaults/rc.conf is for.
- Do not set additional flags via commands_args. ggated_flags are
  already included in the final invocation. See rc.subr(8) for details.
- Document the meaning of ggated_config in /etc/defaults/rc.conf.

Approved by: eugen (src)
Fixes: c068632981eb Add ggated rc script
Differential Revision: https://reviews.freebsd.org/D34439

2 years agoctime.3: Add a cross-reference to clock_gettime(2)
Mateusz Piotrowski [Fri, 4 Mar 2022 16:48:02 +0000 (17:48 +0100)]
ctime.3: Add a cross-reference to clock_gettime(2)

MFC after: 1 week

2 years agoocs_fc: Ignore flogi failure when the remote node is pt2pt winner
Ram Kishore Vegesna [Fri, 4 Mar 2022 14:40:32 +0000 (20:10 +0530)]
ocs_fc: Ignore flogi failure when the remote node is pt2pt winner

Updated commit 79c56c9af583, do not proceed with discovery
if flogi fails in pt2pt winner case.

MFC after: 3 days

2 years agostats.7: Fix a typo
Mateusz Piotrowski [Fri, 4 Mar 2022 11:35:55 +0000 (12:35 +0100)]
stats.7: Fix a typo

MFC after: 3 days

2 years agostress2: Added a new test scenario checing for a long fsck_ffs runtime
Peter Holm [Fri, 4 Mar 2022 11:06:45 +0000 (12:06 +0100)]
stress2: Added a new test scenario checing for a long fsck_ffs runtime

2 years agoocs_fc: Support persistent topology feature
Ram Kishore Vegesna [Thu, 3 Mar 2022 16:00:27 +0000 (21:30 +0530)]
ocs_fc: Support persistent topology feature

Summary: Enable persistent topology across power cycles/firmware resets.

Reviewed by: mav

MFC after: 3 days

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

2 years agoocs_fc: Do not respond to unsolicited NOP BLS command.
Ram Kishore Vegesna [Thu, 3 Mar 2022 12:46:56 +0000 (18:16 +0530)]
ocs_fc: Do not respond to unsolicited NOP BLS command.

Summary: Drop unsolicited BLS commands other than ABTS.

Reviewed by: mav

MFC after: 3 days

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

2 years agoocs_fc: Ignore flogi failure when the discovery is already done.
Ram Kishore Vegesna [Thu, 3 Mar 2022 11:44:03 +0000 (17:14 +0530)]
ocs_fc: Ignore flogi failure when the discovery is already done.

Summary:
Some targets are not responding to the FLOGI in point-to-point topology,
If the pt2pt discovery is done, Ignore the FLOGI failure.

MFC after: 3 days

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

2 years agotests: readlink: fix atf_test_case call [NFC]
Kyle Evans [Fri, 4 Mar 2022 03:48:21 +0000 (21:48 -0600)]
tests: readlink: fix atf_test_case call [NFC]

This was meant to read `basic`, rather than a duplicate of `f_flag`.  It
is largely irrelevant, though, as atf_test_case mostly just makes
sure that the proper functions are defined.

Sponsored by: Klara, Inc.

2 years agoImprove timeout precision of pthread_cond_timedwait().
Alexander Motin [Fri, 4 Mar 2022 03:03:09 +0000 (22:03 -0500)]
Improve timeout precision of pthread_cond_timedwait().

This code was not touched when all other user-space sleep functions were
switched to sbintime_t and decoupled from hardclock.  When it is possible,
convert supplied times into sbinuptime to supply directly to msleep_sbt()
with C_ABSOLUTE.  This provides the timeout resolution of few microseconds
instead of 2 milliseconds, plus avoids few clock reads and conversions.

Reviewed by: vangyzen
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D34163

2 years agoFix the size returned for NT_FPREGSET.
John Baldwin [Fri, 4 Mar 2022 01:53:06 +0000 (17:53 -0800)]
Fix the size returned for NT_FPREGSET.

Sponsored by: University of Cambridge, Google, Inc.

2 years agoUse vnsz2log directly in assertion on its relation to sizeof(struct vnode).
John Baldwin [Fri, 4 Mar 2022 01:52:07 +0000 (17:52 -0800)]
Use vnsz2log directly in assertion on its relation to sizeof(struct vnode).

This reduces the size of diffs required to support different values of
vnsz2log.  In CheriBSD, kernels for CHERI architectures have vnodes
larger than 512 bytes and require a value of 9.

Reviewed by: mjg
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34418

2 years agoAdd simple kyua tests for the mod* system calls.
John Baldwin [Fri, 4 Mar 2022 01:51:45 +0000 (17:51 -0800)]
Add simple kyua tests for the mod* system calls.

Reviewed by: markj
Obtained from: CheriBSD
Sponsored by: University of Cambridge, Google, Inc.
Differential Revision: https://reviews.freebsd.org/D34417

2 years agoiwlwifi: update man pages
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:27:00 +0000 (00:27 +0000)]
iwlwifi: update man pages

Update man pages given auto-loading is now enabled by default and
no user configuration is needed to load the driver.
Also note that the iwlwifi driver will appear the first time in 13.1-R.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Relnotes: yes

2 years agoLinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:06:34 +0000 (00:06 +0000)]
LinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO

Implement MODULE_PNP_INFO() support in LinuxKPI for the Linux
MODULE_DEVICE_TABLE.

This will allow us to auto-load LinuxKPI PCI drivers (drm-kmod do
not currently as they attach to vgapci0 which in turn grabs the PCI
to my understanding) and make any loading from loader or kld_list in
rc.conf unnecessary; see devmatch(8) for more information.

We need to ensure there is a DRIVER_MODULE() (or probably just
a DECLARE_MODULE but that makes not much difference) before the
MODULE_PNP_INFO (which we otherwise would not need).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: imp, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D26651

2 years agoLinuxKPI: remove duplicate include
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:04:19 +0000 (00:04 +0000)]
LinuxKPI: remove duplicate include

Remove a duplicate bus.h include from pci.h.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoiwlwifi: adjust the LinuxKPI pci return for now
Bjoern A. Zeeb [Thu, 3 Mar 2022 22:24:13 +0000 (22:24 +0000)]
iwlwifi: adjust the LinuxKPI pci return for now

Rather than having LinuxKPI return BUS_PROBE_DEFAULT, return
"one less" so that on conflict of IDs others would be preferred.

This means that iwm(4) will attach instead of iwlwifi(4) for the
chipsets iwm(4) supports and iwlwifi(4) only for the other--in iwm(4)
unsupported--chipsets.  This is done so that we can enable auto-loading
of drivers but for the upcoming 13.1-Release people with working iwm(4)
will not yet be affected by iwlwifi(4).

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

2 years agoLinuxKPI: allow a driver to override the default pci probe result
Bjoern A. Zeeb [Fri, 18 Feb 2022 21:58:01 +0000 (21:58 +0000)]
LinuxKPI: allow a driver to override the default pci probe result

Add bsd_probe_return which a driver can set in their 'struct pci_driver'
definition to set a driver-sepcific LinuxKPI pci return value.
This is helpful in case of multiple drivers with overlapping IDs,
such as iwlwifi(4) and iwm(4).

Contrary to an earlier version we now assume 0 is not BUS_PROBE_SPECIFIC
(which no driver should really return these days) but the bss initialized
value (bsd_probe_return unset) and we will return BUS_PROBE_DEFAULT.

Suggested by: jhb
Reviewed by: jhb
Reviewed by: hselasky, imp (earlier versions)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
X-MFC: new struct members need to go to the end for stable/13
Differential Revision: https://reviews.freebsd.org/D33915

2 years agomanpages: Fix use of At macro
Mateusz Piotrowski [Thu, 3 Mar 2022 23:03:44 +0000 (00:03 +0100)]
manpages: Fix use of At macro

The versions for the At macro from 1 to 7 must be prefixed with "v".

MFC after: 3 days

2 years agoRevert "Expand __diagused to include the KTR kernel diagnostic option."
Mateusz Guzik [Thu, 3 Mar 2022 20:26:59 +0000 (20:26 +0000)]
Revert "Expand __diagused to include the KTR kernel diagnostic option."

This reverts commit 55339af296ca2a360a82e46d6699fd1b57ecf815.

Induces warnings for kernels built with KTR but without debug.

Discussed with: scottl

2 years agorc.conf: Document zfskeys
Mateusz Piotrowski [Thu, 3 Mar 2022 19:03:09 +0000 (20:03 +0100)]
rc.conf: Document zfskeys

Fixes: 33ff39796ffe Add zfskeys rc.d script for auto-loading encryption keys
MFC after: 3 days
Reviewed by: allanjude
Sponsored by: Modirum
Sponsored by: Klara, Inc
Differential Revision: https://reviews.freebsd.org/D34427

2 years agopfctl.8: Use the serial comma
Kristof Provost [Thu, 3 Mar 2022 16:53:36 +0000 (17:53 +0100)]
pfctl.8: Use the serial comma

Pointed out by: Pau Amma.
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif_epair: fix build with RSS and INET or INET6 disabled
Santiago Martinez [Thu, 3 Mar 2022 09:44:43 +0000 (10:44 +0100)]
if_epair: fix build with RSS and INET or INET6 disabled

Reviewed by: kp
MFC after: 1 week

2 years agocache: hide hash stats behind DEBUG_CACHE
Mateusz Guzik [Thu, 3 Mar 2022 17:21:13 +0000 (17:21 +0000)]
cache: hide hash stats behind DEBUG_CACHE

They take a long time to dump and hinder sysctl -a when used with
DIAGNOSTIC.

2 years agofd: add close_range(..., CLOSE_RANGE_CLOEXEC)
Mateusz Guzik [Thu, 3 Mar 2022 12:45:11 +0000 (13:45 +0100)]
fd: add close_range(..., CLOSE_RANGE_CLOEXEC)

For compatibility with Linux.

MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34424

2 years agoxhci(4): Add quirk for "TUSB73x0 USB3.0 xHCI Controller".
Hans Petter Selasky [Thu, 3 Mar 2022 16:32:20 +0000 (17:32 +0100)]
xhci(4): Add quirk for "TUSB73x0 USB3.0 xHCI Controller".

Tested by: br@
MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agoipfilter: Reliably print the interface name
Cy Schubert [Thu, 3 Mar 2022 06:43:48 +0000 (22:43 -0800)]
ipfilter: Reliably print the interface name

When printing the interface name from the ipstate_t struct the interface
name in is_ifp may not always be avaiable when reading it from kmem
(tested on FreeBSD and NetBSD). However the is_ifname (the interface
name character string) is almost always available -- it is not available
when the source of the packet is a process running on the firewall
itself. Rather than print both interface name strings, print only the
one.

MFC after: 1 week

2 years agoipfilter: Obtain the interface name more efficiently
Cy Schubert [Thu, 3 Mar 2022 06:40:18 +0000 (22:40 -0800)]
ipfilter: Obtain the interface name more efficiently

Rather than use a kmem read to determine the interface name used by a
nat_t structure through a pointer, nat_ipfs->netif->if_xname, obtain it
directly from nat_ifnames in the nat_t structure itself using the new
FORMAT_IF macro.

MFC after: 1 week

2 years agoipfilter: Introduce the new FORMAT_IF macro
Cy Schubert [Thu, 3 Mar 2022 06:21:59 +0000 (22:21 -0800)]
ipfilter: Introduce the new FORMAT_IF macro

Interface names stored in the ipstate_t and ipnat_t structures can be
NULL. This occurs when an application, such as named, is running on the
firewall machine itself. For example an application, i.e. named, running
on the firewall itself will cause a state table display and NAT mapping
display to show a null ingress interface and its egress interface. This
is perfectly valid but confusing to human eyes. Rather than print
nothing, print "(null)".

MFC after: 1 week

2 years agostress2: Reworked and cleaned up this test scenaio.
Peter Holm [Thu, 3 Mar 2022 13:29:18 +0000 (14:29 +0100)]
stress2: Reworked and cleaned up this test scenaio.

2 years agoAdd serial-number to hw.fdt sysctl area if found in fdt.
Mike Karels [Wed, 23 Feb 2022 20:42:30 +0000 (14:42 -0600)]
Add serial-number to hw.fdt sysctl area if found in fdt.

Add serial-number sysctl if that fdt property exists and is a printable
string.  While here, ensure that the hw.fdt sysctl values fit in the
buffers provided so that they will be NUL-terminated.  Tested on
Raspberry Pi 3B+ and 4.

MFC after: 5 days
Reviewed by: manu imp
Differential Revision: https://reviews.freebsd.org/D34356

2 years agoibcore: Fix multiple includes of same header file.
Hans Petter Selasky [Thu, 3 Mar 2022 11:51:05 +0000 (12:51 +0100)]
ibcore: Fix multiple includes of same header file.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agousbhid(4): Be more restrictive about what requests are allowed from user-space.
Hans Petter Selasky [Thu, 3 Mar 2022 09:24:02 +0000 (10:24 +0100)]
usbhid(4): Be more restrictive about what requests are allowed from user-space.

MFC after: 1 month
Sponsored by: NVIDIA Networking

2 years agousb(4): Factor out the usb_check_request() function.
Hans Petter Selasky [Thu, 3 Mar 2022 09:22:41 +0000 (10:22 +0100)]
usb(4): Factor out the usb_check_request() function.

No functional change.

MFC after: 1 week
Sponsored by: NVIDIA Networking

2 years agobhyve: add varfile option to nvlist of lpc device
Corvin Köhne [Thu, 3 Mar 2022 07:45:20 +0000 (22:45 -0900)]
bhyve: add varfile option to nvlist of lpc device

Use seperate nvlist entries for the romfile and the varfile.

While here, don't leak varfd in bootrom_loadrom().

Reviewed by:    jhb, markj
Differential Revision:  https://reviews.freebsd.org/D33433

2 years agovt_vga: fix colour in pixel blocks with more than 4 colours
Ed Maste [Wed, 2 Mar 2022 16:40:00 +0000 (11:40 -0500)]
vt_vga: fix colour in pixel blocks with more than 4 colours

VGA hardware provides many different graphics and data access modes,
each with different capabilities and limitations.

VGA vt(4) graphics mode operates on blocks of pixels at a time.  When a
given pixel block contains only two colours the vt_vga driver uses write
mode 3.  When the block contains more than two colours it uses write
mode 0.  This is done because two-colour write mode 3 is much more
efficient.

In practice write mode 3 is used most of the time, as there is often a
single foreground colour and single background colour across the entire
console.  One common exception requiring the use of mode 0 is when the
mouse cursor is drawn over a background other than black, as we need
black and white for the cursor in addition to the background colour.

VGA's default 16-colour palette provides the same set of colours as the
system console, but in a different order.  Previously we configured a
non-default VGA palette that had the same colours at the same indexes.
However, this caused anything drawn before the kernel started (drawn by
the loader, for instance) to change colours once the kernel configured
the new, non-default palette.

In 5e251aec8636 we switched to leaving the default VGA palette in place,
translating console colour indexes to VGA colour indexes as necessary.
This translation was missed for the write mode 0 case for pixel blocks
with more than two colours.

PR: 261751
Reviewed by: adrian
MFC after: 1 week
Fixes: 5e251aec8636 ("vt(4): Use default VGA palette")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34412

2 years agohms(4): Change probe priority to BUS_PROBE_GENERIC
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:24 +0000 (02:35 +0300)]
hms(4): Change probe priority to BUS_PROBE_GENERIC

to give ietp(4) and bcm5974(4) drivers precedence over hms(4).

MFC after: 2 month

2 years agoietp(4): Driver for Elantech I2C touchpad
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:24 +0000 (02:35 +0300)]
ietp(4): Driver for Elantech I2C touchpad

MFC after: 2 month
Tested by: Matt Daw <matt.daw_AT_gmail_DOT_com>

2 years agoiichid(4): Add support for ASUS C300 chromebook.
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
iichid(4): Add support for ASUS C300 chromebook.

Some chromebooks e.g. ASUS C300 have no valid _CID and _DSM ACPI
objects required for device identification and HID descriptor address
detection. Add quirk to allow required data to be hardcoded in to
driver.

MFC after: 2 month

2 years agoiichid(4): Implement I2CRDWR command in hid_ioctl method
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
iichid(4): Implement I2CRDWR command in hid_ioctl method

This command is intended to be compatible with I2CRDWR ioctl.
It is required to perform arbitrary I2C transfers by device
drivers which can switch between HID and native non-HID modes.

MFC after: 2 month

2 years agobcm5974: wsp(4) driver version with HID attachment.
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
bcm5974: wsp(4) driver version with HID attachment.

MFC after: 2 month
Tested by: Greg V (Type 4 touchpads)

2 years agousbhid(4): Implement USB_REQUEST command in hid_ioctl method
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
usbhid(4): Implement USB_REQUEST command in hid_ioctl method

This command is intended to be compatible with USB_REQUEST ioctl.
It is required to perform arbitrary control endpoint requests by device
drivers which can switch between HID and native non-HID modes.

MFC after: 2 month

2 years agohid: Add hid_ioctl method to HID interface
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
hid: Add hid_ioctl method to HID interface

hid_ioctl method executes arbitrary transport backend command.
Format of the command is defined by hardware transport driver.

It is intended to assist HID device drivers to execute non-HID commands
on hybrid devices like Elan and Apple touchpads which can be switched
between HID and proprietary modes.

MFC after: 2 month

2 years agoig4(4): Add PNP info for ACPI attachment
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
ig4(4): Add PNP info for ACPI attachment

MFC after: 2 month

2 years agohid: Add missed dependency on usbdevs.h for static builds
Vladimir Kondratyev [Wed, 2 Mar 2022 23:35:23 +0000 (02:35 +0300)]
hid: Add missed dependency on usbdevs.h for static builds

MFC after: 2 month

2 years agocxgbe: Move page pods KTR traces under VERBOSE_TRACES.
John Baldwin [Wed, 2 Mar 2022 23:32:21 +0000 (15:32 -0800)]
cxgbe: Move page pods KTR traces under VERBOSE_TRACES.

2 years agocxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.
Navdeep Parhar [Wed, 2 Mar 2022 22:30:15 +0000 (14:30 -0800)]
cxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.

MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agohwpmc_arm64_md.c: Correct architecture name in assertions.
Brett Gutstein [Wed, 2 Mar 2022 22:57:40 +0000 (14:57 -0800)]
hwpmc_arm64_md.c: Correct architecture name in assertions.

Obtained from: CheriBSD

2 years agoMFV d1b143ee9a5: libbsdxml (expat) 2.4.6
Eric van Gyzen [Wed, 2 Mar 2022 20:07:27 +0000 (14:07 -0600)]
MFV d1b143ee9a5: libbsdxml (expat) 2.4.6

Update contrib/expat from 2.4.3 to 2.4.6 to fix multiple vulnerabilities.

Reviewed by: delphij
MFC after: 2 weeks
Relnotes: yes
Security: yes; see contrib/expat/Changes since 2.4.3
Sponsored by: Dell EMC Isilon

2 years agoVendor import of expat 2.4.6
Eric van Gyzen [Wed, 2 Mar 2022 20:00:38 +0000 (14:00 -0600)]
Vendor import of expat 2.4.6

Sponsored by: Dell EMC Isilon

2 years agocxgbe(4): Dump some more debug registers in cim_dump_regs.
Navdeep Parhar [Wed, 2 Mar 2022 18:55:55 +0000 (10:55 -0800)]
cxgbe(4): Dump some more debug registers in cim_dump_regs.

MFC after: 3 days
Sponsored by: Chelsio Communications

2 years agopfctl tests: Ethernet rule parsing tests
Kristof Provost [Fri, 21 Jan 2022 15:48:03 +0000 (16:48 +0100)]
pfctl tests: Ethernet rule parsing tests

A few basic test cases for Ethernet rule parsing.

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

2 years agopfctl: print ethernet rules when called with '-n'
Kristof Provost [Fri, 21 Jan 2022 15:37:21 +0000 (16:37 +0100)]
pfctl: print ethernet rules when called with '-n'

Just as pfctl already does for other rules we print the ethernet rules
we would have loaded if '-n' is specified.

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

2 years agopf tests: extend ether test to verify mac address masks
Kristof Provost [Thu, 20 Jan 2022 17:33:40 +0000 (18:33 +0100)]
pf tests: extend ether test to verify mac address masks

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

2 years agopf: support masking mac addresses
Kristof Provost [Thu, 20 Jan 2022 17:31:45 +0000 (18:31 +0100)]
pf: support masking mac addresses

When filtering Ethernet packets allow rules to specify a mac address
with a mask. This indicates which bits of the specified address are
significant. This allows users to do things like filter based on device
manufacturer.

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

2 years agopf tests: Ensure 'pfctl -F ethernet' works
Kristof Provost [Tue, 18 Jan 2022 08:41:30 +0000 (09:41 +0100)]
pf tests: Ensure 'pfctl -F ethernet' works

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

2 years agopfctl: support flushing ethernet rules
Kristof Provost [Mon, 17 Jan 2022 16:38:28 +0000 (17:38 +0100)]
pfctl: support flushing ethernet rules

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

2 years agopf tests: slightly more complect captive portal setup
Kristof Provost [Wed, 13 Oct 2021 13:21:43 +0000 (15:21 +0200)]
pf tests: slightly more complect captive portal setup

Combine anchor, dummynet and rdr to produce a more complex captive
portal setup.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32484

2 years agopf tests: basic test for ether anchors
Kristof Provost [Tue, 12 Oct 2021 09:27:55 +0000 (11:27 +0200)]
pf tests: basic test for ether anchors

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32483

2 years agopf: add anchor support for ether rules
Kristof Provost [Fri, 1 Oct 2021 17:05:50 +0000 (19:05 +0200)]
pf: add anchor support for ether rules

Support anchors in ether rules.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32482

2 years agopfctl: support lists of mac addresses
Kristof Provost [Thu, 30 Sep 2021 15:09:57 +0000 (17:09 +0200)]
pfctl: support lists of mac addresses

Teach the 'ether' rules to accept { mac1, mac2, ... } lists, similar to
the lists of interfaces or IP addresses we already supported for layer 3
filtering.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32481

2 years agopf tests: test match keyword and dummynet
Kristof Provost [Wed, 29 Sep 2021 15:45:15 +0000 (17:45 +0200)]
pf tests: test match keyword and dummynet

Ensure that the 'match' keyword works with dummynet

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32480

2 years agopf tests: test dummynet for ether traffic
Kristof Provost [Tue, 28 Sep 2021 16:21:26 +0000 (18:21 +0200)]
pf tests: test dummynet for ether traffic

Test that we can set dummynet information on L2, which is processed by
L3 later (assuming it's not overruled by L3 rules, of course).

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32223

2 years agopf: support dummynet on L2 rules
Kristof Provost [Mon, 27 Sep 2021 12:50:30 +0000 (14:50 +0200)]
pf: support dummynet on L2 rules

Allow packets to be tagged with dummynet information. Note that we do
not apply dummynet shaping on the L2 traffic, but instead mark it for
dummynet processing in the L3 code. This is the same approach as we take
for ALTQ.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32222

2 years agopfctl: Document ethernet rule configuration
Kristof Provost [Mon, 22 Feb 2021 14:12:59 +0000 (15:12 +0100)]
pfctl: Document ethernet rule configuration

Document how 'ether' rules can be set, and what options they support.

Reviewed by: bcr
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31751

2 years agopfctl: Document displaying Ethernet rules
Kristof Provost [Mon, 22 Feb 2021 12:04:03 +0000 (13:04 +0100)]
pfctl: Document displaying Ethernet rules

Document the new 'pfctl -s ether' functionality.

Reviewed by: bcr
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31750

2 years agopfctl: Don't print (ether) to / from if they're not set
Kristof Provost [Wed, 17 Feb 2021 16:38:04 +0000 (17:38 +0100)]
pfctl: Don't print (ether) to / from if they're not set

If we're not filtering on a specific MAC address don't print it at all,
rather than showing an all-zero address.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31749