Commit Graph

280183 Commits

Author SHA1 Message Date
Juraj Lutter
3cf65f8a7f sh(1): Allow non-printing characters in prompt strings
Introduce new prompt format characters:

- '\[' starts the sequence of non-printing chatacters
- '\]' ends the sequence of non-printing characters

Within these sequences, the following characters are now supported:

- '\a' emits ASCII BEL (0x07, 007) character
- '\e' emits ASCII ESC (0x1b, 033) character
- '\r' emits ASCII CR (0x0d, 015) character
- '\n' emits ASCII CRLF sequence

These can be used to embed ANSI sequences into prompt strings.

Example in .shrc:

PS1="\[\e[7m\]\u@\h\[\e[0m\]:\w \\$ "

This tries to maintain some degree of compatibility with GNU bash,
that uses GNU readline library (which behaves slightly different from
BSD editline): It has two "non-printing boundary" characters:

- RL_PROMPT_START_IGNORE (\001)
- RL_PROMPT_END_IGNORE (\002)

while BSD editline only has one (when using EL_PROMPT_ESC setting), so
for this purpose, ASCII \001 was chosen and both \[ and \] emits
this character.

And while here, enlarge PROMPTLEN from 128 to 192 characters.

Reviewed by:		jilles
Approved by:		jilles
Differential Revision:	https://reviews.freebsd.org/D37701
2022-12-22 19:10:48 +01:00
Mateusz Guzik
65308195e8 bsdinstall: s/to small/too small/
Reported by:	Sulev-Madis Silber <ketas@si.pri.ee>
2022-12-22 17:57:08 +00:00
Rick Macklem
6032cf3d6f nfscl: Improve the console message for NFSERR_NOFILEHANDLE
Since a NFSERR_NOFILEHANDLE reply from an NFSv4 server
usually means that the file system is not exported on
the server, change the console log message to indicate
that.

MFC after:	1 week
2022-12-22 09:35:15 -08:00
Mike Karels
c7a0637417 bspatch.1: fix missing argument
Fix typo

MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D37727
2022-12-22 11:13:32 -06:00
Rick Macklem
ab3c59a107 rpc.tlsservd: Check for a tls syscall failure.
Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after:	1 week
2022-12-22 09:10:27 -08:00
Andrew Turner
2eee99f794 Allow CPUs to be missing in the Arm PMU driver
To support running on some emulators we allow CPU start to fail if the
CPU we are starting is not present. The PMU driver will then check if
the CPU is present and fail to attach if any are missing.

To allow the PMU to be used in such an environment don't fail to attach
when a CPU is missing.

Sponsored by: Arm Ltd
2022-12-22 14:24:40 +00:00
Andrew Turner
f9ccec823a Add support for the new Arm Generic UART _HID
Historically the ACPI _HID for both the Arm PL011 and Generic UARTs
was ARMH0011. In the Arm Base Boot Requirements 2.0 the Generic UART
_HID is changed to ARMHB000. Use this new value in the PL011 driver
where we support both UART types.

This has been observed in some recent EDK2 builds.

Sponsored by: Arm Ltd
2022-12-22 14:24:40 +00:00
Andrew Turner
5ec1d020bd Fix the SPDX-License-Identifier in DMC-620 files
The SPDX-License-Identifier was wrong in the Arm CoreLink DMC-620
driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause
identifier. According to [1] all files should use BSD-2-Clause.

[1] https://tools.spdx.org/app/check_license/

Reported by:	emaste
Sponsored by:	Arm Ltd
2022-12-22 10:36:18 +00:00
Andrew Turner
753c7fc9e6 Fix the SPDX-License-Identifier in CMN-600 files
The SPDX-License-Identifier was wrong in the Arm CoreLink CMN-600
driver files. It used the incorrect FreeBSD variant of the BSD-2-Clause
identifier. According to [1] all files should use BSD-2-Clause.

[1] https://tools.spdx.org/app/check_license/

Reported by:	emaste
Sponsored by:	Arm Ltd
2022-12-22 10:36:18 +00:00
Andrew Turner
751d88119f Fix loading the hwpmc module when ACPI is enabled
In 0a9a4d2cd6 a check for OPT_ACPI was added to the hwpmc Makefile
to fix loading the module in a kernel where ACPI has been disabled.
This broke loading the module when ACPI was enabled in the build as
OPT_ACPI isn't a Makefile macro so was always disabled.

Move this check to the C files where the DEV_ACPI macro does exist.

Reviewed by:	gnn
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D37773
2022-12-22 10:36:18 +00:00
Jessica Clarke
c1a2798faa arm64: Don't include td_inhibitors when checking td_ast in do_ast
The td_ast member is an int so only 4 bytes, yet we were using an 8 byte
load and thus also got td_inhibitors in the upper bits. The code prior
to the commit that introduced td_ast did also do a bogus 8 byte load of
td_flags but masked the flags so arguably was correct, if dodgy. Now
that we're using the right width for the load we can also fold the
immediate offset back into the load; because td_ast is at an odd
multiple of 4 bytes from the start of struct thread the normal scaled
load couldn't be used with such an immediate offset when doing an 8 byte
load due to its limited immediate range, but we can use a scaled load
once more now that the offset is a multiple of the load width.

Reviewed by:	andrew, kib
Fixes:		c6d31b8306 ("AST: rework")
Differential Revision:	https://reviews.freebsd.org/D37751
2022-12-22 10:23:10 +00:00
Rene Ladan
e2f3742ab8 gpioevents: fix some white-space errors
Fixes:		453db42291 - gpioevents: add support for pull-down and floating input pins.
Approved by:	manu (implicit)
MFC after:	1 week
2022-12-22 11:16:32 +01:00
Rene Ladan
453db42291 gpioevents: add support for pull-down and floating input pins.
The pin-mode (ft, pd, pu for floating, pull-down, pull-up) is
specified after the intr-config (no, eb, ef, er) for each pin.

Tested on my Raspberry Pi 1B.

PR:		268504
Approved by:	manu
MFC after:      1 week
2022-12-22 10:13:59 +01:00
Søren Schmidt
702b53dd2a Add initial support for the RK356X SOC Ethernet QoS controller (DesignWare)
Eqos driver works in all combinations of single/double ports with different layout.
2022-12-22 03:38:10 +00:00
Bartosz Sobczak
777e472cd8
irdma(4): Upgrade driver to 1.1.5-k
This is to upgrade current irdma driver version (in support of RDMA on
Intel(R) Ethernet Controller E810) to 1.1.5-k

change summary:
- refactor defines for hardware registers
- rereg_mr verb added in libirdma
- fix print warning during compilation
- rt_ros2priority macro fix
- irdma.4 validated with mandoc
- fixing nd6_resolve usage
- added libirdma_query_device
- sysctl for irdma version
- aeq_alloc_db fix
- dwork_flush protected with qp refcount
- PFC fixes

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	erj@
Sponsored by:	Intel Corporation
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36944
2022-12-21 17:13:42 -08:00
Rick Macklem
3fe0cb6695 rpc.tlsclntd: Check for a tls syscall failure.
Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after:	1 week
2022-12-21 15:12:06 -08:00
John Baldwin
3266131908 Fix spelling of NO_WINFINITE_RECURSION.
Reported by:	dim
Fixes:		2e08e4b75e zfs: Fix build with GCC 12.
2022-12-21 14:45:29 -08:00
Justin Hibbits
ec22a3a259 DrvAPI: Trivial mechanical conversions for various drivers
Mechanically convert the following drivers, with trivial changes:
* ipw(4)
* igc(4)
* enetc(4)
* malo(4)
* nfe(4)
* bxe(4)
* awg(4)
* otus(4)
* rtwn(4)
* bnxt(4)
* ath(4)

Sponsored by:	Juniper Networks, Inc.
2022-12-21 15:36:59 -05:00
Justin Hibbits
79422a716d ixl: Fix a mechanical mess-up in DrvAPI conversion
ixl_iw.c is not compiled by default, and I missed this in code
inspection.

Reported by:	erj@
Sponsored by:	Juniper Networks, Inc.
2022-12-21 15:36:59 -05:00
Emmanuel Vadot
ccd8c4488a linuxkpi: seq_read: Fix off by one error
strscpy needs the buffer length not the string length (so including
the '\0').

Reviewed by:	bz
Fixes:	f697b9432d ("linuxkpi: drm-kmod debugfs support")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37771
2022-12-21 21:11:31 +01:00
John Baldwin
2e08e4b75e zfs: Fix build with GCC 12.
Silence -Winfinite-recursion for ldo.c in lua and -Wstringop-overread
for nvpair.c.

Reviewed by:	mm
Differential Revision:	https://reviews.freebsd.org/D37631
2022-12-21 10:49:23 -08:00
John Baldwin
1aa6d44dec Disable -Wzero-length-bounds for the kernel for GCC 12.
The mlx5 driver and some other OFED bits use a somewhat dubious
pattern of:

  struct foo {
      uint64_t arg[0];
      /* Real members of a struct */
  };

The code then treats 'arg' as if it were really a kind of union
such that foo.arg[N] functions similarly to (uint64_t *)foo[N].
This uses of foo.arg[N] then trigger this warning.

No real bugs were found by this warning though, so just turn it off
globally.

Reviewed by:	hselasky, kib
Differential Revision:	https://reviews.freebsd.org/D37630
2022-12-21 10:48:15 -08:00
John Baldwin
2637ed558b Disable -Wdangling-pointer for the kernel for GCC 12.
Some of the warnings raised in the kernel seem to be outright bugs in
the compiler (e.g. the cases in ata_xpt.c and scsi_xpt.c).  Other
cases are not fatal and it didn't seem to find any legitimate bugs in
the kernel.

Differential Revision:	https://reviews.freebsd.org/D37629
2022-12-21 10:46:26 -08:00
John Baldwin
488c498b09 Disable errors for -Wnonnull for the kernel for GCC 12.
The USB code and some other places raise false positives when a NULL
pointer is passed to an inlined function along with a separate length
and the compiler can't determine that the separate length of 0
prevents the use of the NULL pointer.

Differential Revision:	https://reviews.freebsd.org/D37627
2022-12-21 10:46:06 -08:00
John Baldwin
95d146592f iee80211_hwmp: Don't dereference NULL ni in debug printf.
In this call to IEEE80211_NOTE, ni is always NULL due to the assignment
a few lines earlier at the start of the function.  If debug traces are
enabled, then this will pass an invalid pointer as the 'mac' pointer to
ieee80211_note_mac.  Use IEEE80211_DPRINTF which doesn't take a 'ni'
argument instead.

Reported by:	GCC -Wstringop-overread
Reviewed by:	bz, emaste
Differential Revision:	https://reviews.freebsd.org/D37626
2022-12-21 10:45:45 -08:00
John Baldwin
9f0c0e6eed mrsas: Don't leak a stack pointer value in the softc.
mrsas_issue_blocked_cmd stores a pointer to an on-stack variable
in its softc so that the driver can call wakeup() on the correct
pointer.  Once the loop around tsleep() has finished however, the
pointer is no longer needed and any further use would be invalid.
Clear sc->chan to NULL after the loop.

Reported by:	GCC -Wdangling-pointer
Differential Revision:	https://reviews.freebsd.org/D37628
2022-12-21 10:45:26 -08:00
John Baldwin
e53fcff184 bhyve: Simplify spinup_ap_realmode slightly.
There is no reason to modify the passed in rip variable.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37647
2022-12-21 10:33:34 -08:00
John Baldwin
7224a96a55 bhyve: Tidy vCPU pthread startup.
Set the thread affinity in fbsdrun_start_thread next to where the
thread name is set.  This keeps all the pthread initialization
operations at the start of a thread in one place.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37646
2022-12-21 10:33:18 -08:00
John Baldwin
8487443792 bhyve: Don't access vcpumap[vcpu] directly in parse_cpuset().
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37645
2022-12-21 10:33:04 -08:00
John Baldwin
a20c00c60e bhyve: Allocate struct vm_exit on the stack in vm_loop.
The global vmexit[] array is no longer needed to smuggle the rip
value from fbsdrun_addcpu() to vm_loop().

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37644
2022-12-21 10:32:45 -08:00
John Baldwin
ceb0d0b0f1 bhyve: Remove some no-op code for setting RIP.
fbsdrun_addcpu() read the current vCPU's RIP register from the kernel
via vm_get_register() to pass along through some layers to vm_loop()
which then set the register via vm_set_register().  However, this is
just always setting the value back to itself.

Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37643
2022-12-21 10:32:24 -08:00
John Baldwin
461663ddba bhyve: Simplify setting vCPU capabilities.
- Enable VM_CAP_IPI_EXIT in fbsdrun_set_capabilities along with other
  capabilities enabled on all vCPUs.

- Don't call fbsdrun_set_capabilities a second time on the BSP in
  spinup_vcpu.

- To preserve previous behavior, don't unconditionally enable
  unrestricted guest mode on the BSP (this unbreaks single-vCPU guests
  on Nehalem systems, though supporting such setups is of dubious
  value).  Other places that enbale UG on the BSP are careful to check
  the result of the operation and fail if it is not available.

- Don't set any capabilities in spinup_ap().  These are now all
  redundant with earlier settings from spinup_vcpu().

- While here, axe a stale comment from fbsdrun_addcpu().  This
  function is now always called from the main thread for all vCPUs.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37642
2022-12-21 10:31:16 -08:00
John Baldwin
e7d5d2d187 bhyve: Remove unused return value from spinup_ap.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37641
2022-12-21 10:31:02 -08:00
John Baldwin
007d9ca5dd bhyve: Remove handler for VM_EXITCODE_SPINUP_AP.
Since commit 0bda8d3e9f, bhyve always enables VM_EXITCODE_IPI exits
instead, so this handler is no longer used.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37640
2022-12-21 10:30:45 -08:00
Sergey A. Osokin
bb1f0401d6 bsd-family-tree: macOS 13 added
MFC after:	3 days
2022-12-21 12:02:49 -05:00
Ruslan Bukin
dc08d52d1e smmu: fix FDT and !FDT builds.
Reviewed by:	andrew
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D37762
2022-12-21 15:53:09 +00:00
Ruslan Bukin
4b4e8cb53a smmu: set guest address space range to 48-bit, which is a hardware
limit in our configuration.

Reviewed by:	andrew
Sponsored by:	UKRI
Differential Revision:	https://reviews.freebsd.org/D37756
2022-12-21 15:53:05 +00:00
Søren Schmidt
e00b6e254f Attach Motorcomm YT8511 GbE PHY driver to the build. 2022-12-21 14:39:05 +00:00
Justin Hibbits
402810d32e Convert iflib(4) and iflib-based drivers to the DrvAPI
Summary:
Convert iflib(4) and the following drivers:
* axgbe
* em
* ice
* ixl
* vmxnet

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	kbowling, #iflib
Differential Revision: https://reviews.freebsd.org/D37768
2022-12-21 09:20:06 -05:00
Andrew Turner
7ebc4c9bf7 Use hwreset_array in the Rockchip tsadc driver
The order of asserting/deasserting the resets doesn't matter so use
the new hwreset_array to manage them all.

Reviewed by:	manu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37358
2022-12-21 11:25:27 +00:00
Andrew Turner
969935b86b Add support for an array of hwresets
In some drivers we need to assert and deassert a group of hardware
resets in any order. To support this add a new hwreset_array that
manages all hwresets defined for a device.

Reviewed by:	bz, manu, mmel
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37357
2022-12-21 11:25:23 +00:00
Kirk McKusick
52011f5f92 Format cleanups.
No functional change intended.

Differential Revision: https://reviews.freebsd.org/D33424
2022-12-20 18:30:36 -08:00
Zhenlei Huang
21ad3e27fa jail: Fix output of IPv[46] addresses of DDB show prison
Reviewed by:	melifaro, jamie
Approved by:	kp (mentor)
Fixes:		eb8dcdeac2 jail: network epoch protection for IP address lists
Differential Revision:	https://reviews.freebsd.org/D37732
2022-12-21 09:53:28 +08:00
Zhenlei Huang
ab591c874b netlink: Use NET_EPOCH_[CALL|WAIT] macros
Reviewed by:	melifaro, kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D37730
2022-12-21 09:40:05 +08:00
Zhenlei Huang
73336a6fd8 routing: Use NET_EPOCH_[CALL|WAIT] macros
Reviewed by:	melifaro, kp
Approved by:	kp (mentor)
Differential Revision:	https://reviews.freebsd.org/D37729
2022-12-21 09:33:31 +08:00
Zhenlei Huang
2e543af13a geom_part: Fix potential integer overflow when checking size of the table
`hdr_entries` and `hdr_entsz` are both uint32_t as defined in UEFI spec.
Current spec does not have upper limit of the number of partition
entries and the size of partition entry, it is potential that malicious
or corrupted GPT header read from untrusted source contains large size of
entry number or size.

PR:		266548
Reviewed by:	oshogbo, cem, imp, markj
Approved by:	kp (mentor)
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36709
2022-12-21 09:04:30 +08:00
John Baldwin
54f3a781a2 .github: Switch to v3 of actions/checkout.
GitHub is emitting a warning that v2 is deprecated due to using
Node.js 12.

Reported by:	GitHub
Reviewed by:	arichardson, emaste
Differential Revision:	https://reviews.freebsd.org/D37769
2022-12-20 16:27:17 -08:00
Justin Hibbits
5674838159 inet6: Fix LINT build
mli_delete_locked() is the only function that takes a const ifnet.
Since it's a static function there's no advantage to keeping it const.
Since `if_t` is not a const struct (currently) the compiler throws an
error passing the ifp around to ifnet functions.

Fixes:		eb1da3e525
Sponsored by:	Juniper Networks, Inc.
2022-12-20 15:23:49 -05:00
John Baldwin
3845cce70d ktls_tests: Ignore errors from close for receive error tests.
For tests that send invalid data to a TLS socket to trigger read
errors the kernel may end up dropping the connection before close is
called at the conclusion of the test resulting in spurious ECONNRESET
errors from close.  Ignore any errors from close for these tests.

PR:		268390
Reported by:	olivier, Michal Gulbicki <michalx.gulbicki@intel.com>
Reviewed by:	markj
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37717
2022-12-20 11:38:28 -08:00
John Baldwin
f0c143b356 ktls_tests: Ignore spurious errors from shutdown(2).
For some of the "bad size" tests, the remote end can notice the error
and drop the connection before the test program returns from write to
call shutdown.  In that case, shutdown fails with ENOTCONN.  Permit
these ENOTCONN errors without failing the test.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D37693
2022-12-20 11:38:07 -08:00