Commit graph

292408 commits

Author SHA1 Message Date
Mark Johnston 1794a0a87e liquidio: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston 443f33481e msk: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston aaa878e956 mpc85xx: Use device_set_desc()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston eb634b9f4f wbwd: Use device_set_descf()
No functional change intended.
2024-06-16 16:37:26 -04:00
Mark Johnston 48f5a429c9 iicbus: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston b67f248523 nvmf: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston 44d36c9731 netmap: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston 48ef9cff9c amdsmn: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston 1878529d2f amdsbwd: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:26 -04:00
Mark Johnston 5823a09f79 cavium/thunder: Use device_set_desc()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:25 -04:00
Mark Johnston 4f0ff49fee arcmsr: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-16 16:37:25 -04:00
Mark Johnston 5515e8874a wg: Implement if_transmit unconditionally
Commit bf454ca88b made wg_transmit() defined only when "device netmap"
is configured, as if_wg's if_transmit implementation should never be
called otherwise, but this breaks a requirement that interfaces
implement both or neither of if_transmit and if_qflush.

Restore the old behaviour of unconditionally defining wg_transmit().  It
contains an assertion that the interface is in netmap mode.

Reported by:	peterj
MFC after:	2 weeks
Fixes:	bf454ca88b ("wg: Add netmap support")
2024-06-16 13:33:45 -04:00
Mark Johnston 46bb2dca53 kasan: Increase the size of the bootstrap PTP reservation
We were undercounting in the case where the boot stack crosses a 2MB
boundary, resulting in a panic during locore execution.

MFC after:	1 week
Fixes:	756bc3adc5 ("kasan: Create a shadow for the bootstack prior to hammer_time()")
2024-06-16 13:33:13 -04:00
Mark Johnston 4441dd4094 vm_phys: Fix a typo
Fixes:	b16b4c22d2 ("vm_page: Implement lazy page initialization")
Reported by:	Steffen Nurpmeso <steffen@sdaoden.eu>
2024-06-16 13:33:00 -04:00
Bojan Novković 774549fe06 riscv pmap: Release PTP reference on leaf ptpage allocation failure
d0941ed fixed an edge case invloving mlock() and superpage creation
by creating and inserting a leaf pagetable page for mlock'd superpages.
However, the code does not properly release the reference to the
pagetable page in the error handling path.
This commit fixes the issue by adding calls to 'pmap_abort_ptp'
in the error handling path.

Reported by: alc
Approved by: markj (mentor)
Fixes: d0941ed
Differential Revision: https://reviews.freebsd.org/D45580
2024-06-16 18:19:27 +02:00
Bojan Novković e8816b4b66 riscv pmap: Introduce 'pmap_abort_ptp'
This commit moves code for releasing pagetable page references
into a separate function. No functional change intended.

Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D45579
2024-06-16 18:19:27 +02:00
Bojan Novković 858ead4bce powerpc_mmu_radix: Release PTP reference on leaf ptpage allocation failure
0013741 fixed an edge case invloving mlock() and superpage creation
by creating and inserting a leaf pagetable page for mlock'd superpages.
However, the code does not properly release the reference to the
pagetable page in the error handling path.
This commit fixes the issue by adding calls to 'pmap_abort_ptp'
in the error handling path.

Reported by: alc
Approved by: markj (mentor)
Fixes: 0013741
Differential Revision: https://reviews.freebsd.org/D45582
2024-06-16 18:19:27 +02:00
Bojan Novković 200de4dc07 powerpc_mmu_radix: Introduce 'pmap_abort_ptp'
This commit moves code for releasing pagetable page references
into a separate function. No functional change intended.

Approved by: markj (mentor)
Differential Revision:  https://reviews.freebsd.org/D45581
2024-06-16 18:19:26 +02:00
Bojan Novković 5d4545a227 arm64 pmap: Release PTP reference on leaf ptpage allocation failure
808f5ac fixed an edge case invloving mlock() and superpage creation
by creating and inserting a leaf pagetable page for mlock'd superpages.
However, the code does not properly release the reference to the
pagetable page in the error handling path.
This commit fixes the issue by adding calls to 'pmap_abort_ptp'
in the error handling path.

Reported by: alc
Approved by: markj (mentor)
Fixes: 808f5ac
Differential Revision:	https://reviews.freebsd.org/D45578
2024-06-16 18:19:26 +02:00
Bojan Novković b53b21e8f8 amd64 pmap: Release PTP reference on leaf ptpage allocation failure
aa3bcaa fixed an edge case invloving mlock() and superpage creation
by creating and inserting a leaf pagetable page for mlock'd superpages.
However, the code does not properly release the reference to the
pagetable page in the error handling path.
This commit fixes the issue by adding calls to 'pmap_abort_ptp'
in the error handling path.

Reported by: alc
Approved by: markj (mentor)
Fixes: aa3bcaa
Differential Revision: https://reviews.freebsd.org/D45577
2024-06-16 18:19:26 +02:00
Gordon Bergling 018a361f89 virtio(4): Fix two typos in KASSERT messages
- s/emtpy/empty/

MFC after:	5 days
2024-06-16 18:02:46 +02:00
Gordon Bergling d1e652bf04 camcontrol.8: Fix a typo in the manual page
- s/emtpy/empty/

MFC after:	3 days
2024-06-16 18:01:12 +02:00
Doug Moore 28af3eb62b Revert "swap_pager: small improvement to find_least"
This reverts commit dd0e5c02ab.
2024-06-16 10:37:16 -05:00
Pedro F. Giffuni fc3907ce00 fparseln: Update license
Remove 3rd and 4th clauses in christos' license. OK christos.

Obtained from:	NetBSD
2024-06-15 18:30:27 -05:00
Pedro F. Giffuni 9a39435c0b Revert "fparseln: Update NetBSD version strings"
This reverts commit 1a968da448.

I was mistakenly looking at the version strings in the CVS attic
but the function was moved to libc/stdio where it matches the
current string.
2024-06-15 17:46:56 -05:00
Pedro F. Giffuni 1a968da448 fparseln: Update NetBSD version strings
The correponding changes (mostly ANSIfication) were done long ago locally.
No functional change.

Obtained from:	NetBSD (libutil CVS Attic)
2024-06-15 15:32:06 -05:00
Wei Hu d0cb4674df Hyper-V: move memory alloc call for tlb hypercall out of smp_rendezvous
The allocation call could result in sleep lock violation if it is in
smp_rendezvous. Move it out. Also move the pcpu memory pointer to
vmbus_pcpu_data since it is only used on Hyper-V.

PR:		279738
Reported by:	gbe
Fixes:		2b887687ed
MFC after:	2 weeks
Sponsored by:	Microsoft
2024-06-15 14:07:58 +00:00
Peter Holm d26c565597 stress2: Revert change accidentally added in ff4a72c159 2024-06-15 08:33:14 +02:00
Chuck Tuffli ad9cc86bf6 linux: Translate Linux NVME ioctls to the lower layers.
The lower layers implement a ABI compatible Linux ioctl for a few of the
Linux IOCTLs. Translate them and pass them down. Since they are ABI
compatible, just use the nvme ioctl name.

Co-Authored-by: Warner Losh <imp@bsdimp.com>
Reviewed by:	chuck
Differential Revision:	https://reviews.freebsd.org/D45416
2024-06-14 16:40:20 -06:00
Warner Losh 1bce7cd885 nvme: Add Linux copatible ioctls
Add the NVME_IOCTL_ID, NVME_IOCTL_ADMIN_CMD, and NVME_IOCTL_IO_CMD Linux
compatible ioctls. These may be run on either an I/O (ns) dev or a nvme
(admin) dev. Linux allows both on either device, and programs use this
and aren't careful about having the right device open. Emulate this
feature, and implement these ioctls. The data is passed in into the
kernel in host byte order (not converted to le). Results are returned in
host order.

The timeout field is ignore, and the metadata and metadata_len fields
must be zero.

The addr field can be null, even when the data_len is non zero (FreeBSD's
ioctl interface prohibits this, Linux's just ignores the inconsistency).

Only the cdw10 is returned from the command: the status is not returned
in 'result' field. XXX need to verify that this is what Linux does on an
error signaled from the drive.

No external include file is yet available for this: most programs that
call this interface either use a linux-specific path <linux/nvme.h> or
have their own private copy of the data. It's unclear the best thing to
do.

Also, create a /dev/nvmeXnY as an alias for /dev/nvmeXnsY.

These changes allow a native build of nvme-cli to work for everything
that doesn't depend on sysfs entries in /sys, calls that use metadata,
send / receive drive data and sed functionality not in our nvme driver.

Sponsored by:		Netflix
Co-Authored-by:		Chuck Tuffli <chuck@freebsd.org>
Reviewed by:		chuck
Differential Revision:	https://reviews.freebsd.org/D45415
2024-06-14 16:40:08 -06:00
Warner Losh 5198178f3e cdefs.h: Add POSIX.1-2024 values
Sponsored by:		Netflix
2024-06-14 16:38:55 -06:00
Mark Johnston 517c585458 vm_phys: Make sure that vm_phys_enq_chunk() stays in bounds
vm_phys_enq_chunk() inserts a run of pages into the buddy queues.  When
lazy initialization is enabled, only the first page of each run is
initialized; vm_phys_enq_chunk() thus initializes the page following the
just-inserted run.

This fails to account for the possibility that the page following the
run doesn't belong to the segment.  Handle that in vm_phys_enq_chunk().

Reported by:	KASAN
Reported by:	syzbot+1097ef4cee8dfb240e31@syzkaller.appspotmail.com
Fixes:	b16b4c22d2 ("vm_page: Implement lazy page initialization")
2024-06-14 15:55:02 -04:00
Alexander Motin 80b4232924 nvme: Fix panic on detach after ce75bfcac9
MFC after: 2 weeks
2024-06-14 15:32:10 -04:00
Alexander Leidinger 2d08f6b577 rc.subr: add some sanity checks for service jails
Add some sanity checks when service jails are used in jails:
 - children.max > 0
 - children.max - children.cur > 0

The nesting is too deep at those places to have a sane formatting, so no
line wrapping at the usual column.
If someone has a better idea how to format this: feel free to go ahead.
2024-06-14 20:15:46 +02:00
Alexander Leidinger a70ecfb117 rc.subr: add new sysv option for service jails
Clarify that the "sysvipc" svcj option inherits from the host / parent.
Add "sysvipcnew" which creates a new SysV namespace for the service
jail.
Sanity check that only one of them is used.
2024-06-14 20:15:45 +02:00
Alan Somers 2909ddd17c ctld: plug memory leaks
MFC after:	2 weeks
Reviewed by:	mav
Sponsored by:	Axcient
Reported by:	valgrind
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1288
2024-06-14 12:08:38 -06:00
Mitchell Horne 134f7b5fa9 riscv: improve commentary around initial stvec
Make it explicit why we must set the trap vector before enabling virtual
memory.

Reviewed by:	br, jhb, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45474
2024-06-14 15:02:05 -03:00
Mitchell Horne 3ff981587f riscv: Don't handle missing kernel L3 pages
This code path should never be hit, if it does it means we did not
bootstrap correctly. Turn it into a panic like we do on amd64 and arm64.

Reviewed by:	markj, jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45326
2024-06-14 15:02:05 -03:00
Mitchell Horne 0e4e77072f riscv: adjust physmem reservation
Make sure we do this BEFORE pmap_bootstrap().

Reviewed by:	markj, jhb
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D45325
2024-06-14 15:02:05 -03:00
John F. Carr cadc9c7db7 boot/efi: Fix warning for non-standard formats when debugging
Add -Wno-format for zfs_module and regroup. This fixes warnings when
EFI_DEBUG is defined.

PR: 279071
Reviewed-by: imp
2024-06-14 11:11:05 -06:00
John F. Carr 97ab935d56 rk_pinctrl: fix error check
The parse_bias method returns a signed int, with a value of -1 when
the device tree reports nothing of the bias configuration. Convert the
local 'bias' from unsigned to signed to properly check this condition.

PR:		229721
Reviewed by:	mhorne
MFC after:	3 days
2024-06-14 13:42:27 -03:00
Adam Retter fb1028dcd4 hda: add support for Tiger Lake-H
PR:		272682
Reported by:	Miguel Salcedo
Reviewed by:	emaste
2024-06-14 12:24:59 -04:00
Ed Maste aa6fb1d277 tzsetup: ask local/UTC question only on x86
Storing local time in the RTC is a legacy of 1990s PCs; it's not
relevant on other platforms of interest to FreeBSD.

While here switch to C99 bool.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	allanjude (earlier), imp (earlier)
Differential Revision: https://reviews.freebsd.org/D45575
2024-06-14 12:15:48 -04:00
Warner Losh 4fd5b8aed8 boot1.chrp: Include memset
Normally, memset isn't used. However for OPT_INIT_ALL=zero it is. Always
include it since we're not space constrained and latter-day loaders won't
include a copy if it's not actually used.

Reviewed by: emaste
Sponsored by: Netflix
2024-06-14 09:34:05 -06:00
Warner Losh ec7358885d libkern.h: Make more self-sufficient
libkern.h uses KASSERT, which fails when building in the boot
loader. This is hacked around in a number of other places, but it's
easier to just include sys/kassert.h here. Those other hacks still work,
but are no longer really needed and can be torn down over time.

Reviewed by: emaste
Sponsored by: Netflix
2024-06-14 09:34:05 -06:00
Reid Linnemann de4bfd6b99 udp_var: correct intoudpcb macro unintended identifier dependency
Change 483fe9651 embedded struct inpcb into struct udpcb and updated the
intoudpcb macro to use __containerof to locate it. This change accidentally
introduced a dependency on the identifier inp being defined in the block the
macro is expanded in. This should have been the macro argument ip. This change
makes this simple correction.

No functional change intended.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2024-06-14 17:28:28 +02:00
Ed Maste 70e3e1bde9 tzsetup: add detail for -s option
Skipping the UTC question via -s will not create or delete
/etc/wall_cmos_clock.

Reported by:	Tomoaki AOKI
Reviewed by:	imp, allanjude, jrm
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45576
2024-06-14 10:02:31 -04:00
Doug Moore 2a21cfe60f pctrie: avoid typecast
Have PCTRIE_RECLAIM_CALLBACK typecast one function pointer type to
another, to relieve the writer of the call back function from having
to cast its first argument from void* to member type.

Reviewed by:	rlibby
Differential Revision:	https://reviews.freebsd.org/D45586
2024-06-14 02:19:03 -05:00
Mark Johnston fbff6d54da vm_phys: Fix vm_phys_find_range() after commit 69cbb18746
vm_phys_seg_paddr_to_vm_page() expects a PA that's in bounds, but
vm_phys_find_range() purposefully returns a pointer to the end of the
last page in a segment.

Fixes:	69cbb18746 ("vm_phys: Add a vm_phys_seg_paddr_to_vm_page() helper")
2024-06-14 00:18:26 -04:00
Mark Johnston aede0d3bad amd64/vmm: Make vmm.h more self-contained
CTASSERT is defined in kassert.h, so include that here.  No functional
change intended.

MFC after:	1 week
2024-06-13 21:19:00 -04:00