Commit Graph

145130 Commits

Author SHA1 Message Date
Hans Petter Selasky
ee29897fc3 time(3): Declare the minimum and maximum hz values supported.
Reviewed by:	kib@ and imp@
MFC after:      1 week
Sponsored by:   NVIDIA Networking
Differential Revision:	https://reviews.freebsd.org/D37072
2022-10-23 10:04:50 +02:00
Bjoern A. Zeeb
0080f30ff1 LinuxKPI: 802.11: add changes to support debugfs in iwlwifi
Add new fields (also have to move a struct up, no changes there)
in order to make iwlwifi debugfs support compile.

Sposnored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-22 20:42:35 +00:00
Bjoern A. Zeeb
92daf3a606 iwlwifi: prepare to support debugfs
Import two files left out initially from the driver needed for debugfs
support [1].  Adjust the driver further to make it compile on FreeBSD.
This is currently turned off and needs more LinuxKPI/lindebugfs work.
Being in the tree will allow us to collaboratively work on it and
then we can enable it for good.

Obtained from:	Linux wireless-testing (tag: wt-2022-10-19) [1]
		2c9078b9abcb884e27360340aaa7dfd4c0de29b3
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-22 17:40:17 +00:00
Bjoern A. Zeeb
71ebd2d00b iwlwifi: constify another argument of iwl_print_hex_dump()
This is needed when enabling debugfs as it passes a const in which
would otherwise be dropped.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-10-22 17:33:18 +00:00
John Grafton
4c9db9566e linprocfs: Add net/route.
PR:			266482
Reviewed by:		melifaro, me
Differential revision:	https://reviews.freebsd.org/D36949
MFC after:		1 week
2022-10-22 13:52:58 +03:00
Colin Percival
b7761f1f08 x86/busdma: Limit reserved pages if low nsegs
When bus_dmamap_create is called, if bouncing might be required we
reserve enough pages for a maximum-length request, subject to the
MAX_BPAGES constraint (32 MB on amd64; 32 MB or 2 MB on i386
depending on the amount of RAM).

Since pages used for bouncing are typically non-consecutive, each
bounced page will typically constitute a busdma segment; as such, we
are unlikely to ever successfully use more pages than the nsegments
limit.  Limit the number of pages reserved to nsegments.

On FreeBSD/Firecracker, this reduces bounce page memory consumption
from 32 MB to 512 kB, making VMs with 128 MB of RAM usable.

Reviewed by:	imp, mav
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D37082
2022-10-21 22:47:33 -07:00
Kirk McKusick
243a0eda9a Increase the maximum size of the journaled soft-updates journal.
The size of the journaled soft-updates journal should be big enough
to hold two minutes of filesystem metadata-update activity. The
maximum size of the soft updates journal was set in the 1990s. At
the time it was assummed that disk arrays would top out at 16 drives
and disk writes per drive would top out at 500 per second. Today's
I/O subsystems are considerably bigger and faster than those limits.
Thus this delta removes the hard upper limit and lets tunefs(8) and
newfs(8) set the upper bound based on the size of the filesystem and
its cylinder groups.

Sponsored by: The FreeBSD Foundation
2022-10-21 11:00:00 -07:00
Wei Hu
443e6eccbd arm64: Hyper-V: fix a commit error caused duplicated lines in vmbus_aarch64.c
Remove those duplicated lines.

Reported by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Fixes:	6cf00ef80c
Sponsored by:	Microsoft
2022-10-21 11:09:17 +00:00
Souradeep Chakrabarti
3f8f02b2ab arm64: Hyper-V: enablement for ARM64 in Hyper-V (Part 2)
This is the second part of the ARM64 Hyper-V enablement.
These changes here are mostly with Make, release changes and also
changes required in vmbus.c hyperv.c and common files in hyperv.

Reviewed by:	whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D36467
2022-10-21 09:46:22 +00:00
Souradeep Chakrabarti
0c38e1c338 arm64: Hyper-V: vmbus: use the IRQ resource from vmbus_res
In ARM64 gen2 Hyper-V, use IRQ resource from vmbus_res, which is owning
the IRQ for current device tree. It allows the MMIO resource to be
successfully allocated for vmbus from parent acpi_syscontainer.
Reviewed by:	whu
Tested by:	Souradeep Chakrabarti <schakrabarti@microsoft.com>
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D37064
2022-10-21 08:40:32 +00:00
Richard Scheffenegger
83c1ec92e4 tcp: ECN preparations for ECN++, AccECN (tcp_respond)
tcp_respond is another function to build a tcp control packet
quickly. With ECN++ and AccECN, both the IP ECN header, and
the TCP ECN flags are supposed to reflect the correct state.

Also ensure that on receiving multiple ECN SYN-ACKs, the
responses triggered will reflect the latest state.

Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D36973
2022-10-20 21:48:27 +02:00
Hans Petter Selasky
3346ae0d24 xhci(4): Don't allocate an IRQ vector if hw.usb.xhci.use_polling=1 is set.
This is useful for debugging purposes.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-10-20 19:23:42 +02:00
Warner Losh
e32e6e42fa arm: Remove unused ffs.S
We've not used ffs.S since we retired armv[45] support. Remove it from
the tree.

Suggested by:		andrew in D37069
Sponsored by:		Netflix
2022-10-20 10:48:31 -06:00
Warner Losh
91dc225a7b conf: Document why we have ARM64 and RISCV options
These are needed for the 'cpu ARM64' and 'cpu RISCV' options in these
architecture's config files. cpu lines are non-optional in config(8), so
we must define them here. There's no other use for them in the tree.

Sponsored by:		Netflix
2022-10-20 10:48:31 -06:00
Warner Losh
f94d74ff3a arm: Fix name of config file in comment
This file was never named GENERICV6 in the FreeBSD tree. It entered the
tree in b9413b5512 as GENERIC.

Sponsored by:		Netflix
2022-10-20 10:48:31 -06:00
Warner Losh
f9d615746f arm: Remove useless armv6/armv7 options
Cleanup another remnant of the armv4/armv5 support. Now that we always
define armv6 or armv7, these lines can be deleted (execpt hwpmc_armv7.c
which now needs just one line). Since we don't do anything different
between armv6 and armv7 from a config file selection point of view,
delete them from options.arm. We are extremely unlikely to grow anything
new here during the remaining lifetime of 32-bit arm in FreeBSD.

Sponsored by:		Netflix
Reviewed by:		kevans, andrew
Differential Revision:	https://reviews.freebsd.org/D37069
2022-10-20 10:48:31 -06:00
Mitchell Horne
a9b24e4dc2 riscv: fix relocation handling for R_RISCV_64
It requires the addend. In practice this doesn't seem to be a problem,
since relocations of this type are all with an addend of zero.
Obviously, we still want to handle this correctly if that ever changes.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37039
2022-10-20 12:01:29 -03:00
Mitchell Horne
330acb1883 riscv: reject CPUs with mmu-type "riscv,none"
According to riscv/cpus.yaml in the device-tree docs, this property may
exist but indicate that the CPU does not have an MMU. Detect this
possibility.

Reviewed by:	jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36980
2022-10-20 12:01:29 -03:00
Mitchell Horne
6f4c938b2b riscv: drop a dead declaration
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-10-20 12:01:29 -03:00
Alexander Motin
2a31a06bf1 Add random VMware device IDs.
Just to make dmesg look nicer there.

MFC after:	1 week
2022-10-20 10:19:24 -04:00
Gleb Smirnoff
24cf7a8d62 inpcb: provide pcbinfo pointer argument to inp_apply_all()
Allows to clear inpcb layer of TCP knowledge.
2022-10-19 15:15:53 -07:00
Gleb Smirnoff
b6a816f116 inpcb: garbage collect so_sototcpcb()
It had very little use and required inpcb layer to know tcpcb.
2022-10-19 15:15:53 -07:00
Gleb Smirnoff
b2c558c898 cxgbe: include headers required to include t4_tom.h
Before the change we would get struct tcpcb forward declaration
only with help of pollution via in_pcb.h.
2022-10-19 15:15:53 -07:00
Gleb Smirnoff
e1401f7579 cxgbe: use standard sototcpcb() accessor macro to get socket's tcpcb
Reviewed by:		np
Differential revision:	https://reviews.freebsd.org/D37041
2022-10-19 15:15:32 -07:00
Mark Johnston
2dba2288aa uma: Never pass cache zones to memguard
Items allocated from cache zones cannot usefully be protected by
memguard.

PR:		267151
Reported and tested by:	pho
MFC after:	1 week
2022-10-19 14:36:36 -04:00
Konstantin Belousov
e9adbcdf2e tmpfs: report minimal hole size
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
85cff1455a tmpfs: implement FIOSEEKDATA and FIOSEEKHOLE
providing the support for lseek(2) SEEK_DATA and SEEK_HOLE.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
934bfc128e Add vm_page_any_valid()
Use it and several other vm_page_*_valid() functions in more places.

Suggested and reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
5bd45b2ba3 swap_pager_find_least(): assert that the function is called on the right object type
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
33ce178835 vn_bmap_seekhole: check that passed offset is non-negative
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
8b32cdec9c tmpfs: order include files alphabetically
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
7f055843ac tmpfs: change return type of tmpfs_pages_check_avail() to bool
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37024
2022-10-19 20:24:07 +03:00
Konstantin Belousov
555a861d68 device_get_path(): take sbuf directly
This allows to fix a bug where sbuf allocation done in the context of
dev_wired_cache_match() must use non-sleepable allocations.

Suggested by:	jhb
Reviewed by:	jhb, takawata
Discussed with:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36899
2022-10-19 19:39:40 +03:00
Konstantin Belousov
8cf783bde3 device_get_path(): handle case when dev is root
PR:	266862
Based on submission by:	takawata
Reviewed by:	jhb, takawata
Disscussed with:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36899
2022-10-19 19:39:33 +03:00
Konstantin Belousov
d9c5a9ea49 device_get_path(): do not drop the error from BUS_GET_DEVICE_PATH()
Later it would silently converted to ENOMEM always, because any error
was reported as NULL return path.

Reviewed by:	jhb, takawata
Discussed with:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36899
2022-10-19 19:39:26 +03:00
Konstantin Belousov
23d2fcfbb2 subr_bus.c: some style
Wrap long lines in devctl2_ioctl DEV_GET_PATH and dev_wired_cache_match()

Reviewed by:	jhb, takawata
Discussed with:	imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36899
2022-10-19 19:39:17 +03:00
Alan Somers
f6e5319550 fusefs: fix VOP_ADVLOCK with SEEK_END
When the user specifies SEEK_END, unlike SEEK_CUR, VOP_ADVLOCK must
adjust lock offsets itself.

Sort-of related to bug 266886.

MFC after:	2 weeks
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D37040
2022-10-18 19:11:49 -06:00
Gleb Smirnoff
c37384665f tcp: style the struct tcpcb definition
- Use C99 types uintXX_t instead of u_intXX_t.
- Try to make space/tab usage a little bit more consistent.
- Shorten comments to fit into 80 chars.

Not a functional change, just making future changes easier to read.
2022-10-18 18:00:30 -07:00
Rick Macklem
ae7816576e nfsd: Make the pNFS server update Change for Setxattr/Rmxattr
When the NFS server does the Setxattr or Rmxattr operation,
the Change attribute (va_filerev) needs to be updated.

Without this patch, that was not happening for the
pNFS server configuration.  This patch does a Setattr
against the DS file to make the Change attribute
change.

This bug was discovered during a recent IETF NFSv4 testing
event, where the Change attribute wasn't changed in the
operation reply.

MFC after:	1 month
2022-10-18 15:47:07 -07:00
Gleb Smirnoff
e03b7883e9 mbuf: don't include lock.h conditionally
Using keywords from opt_global.h in the system headers allows to
create cryptic kernel build failures, that depend on the options
used in the kernel config, very hard to debug and understand.

Fixes:	063d811465
2022-10-18 08:34:03 -07:00
Zhenlei Huang
5be5d0d5cb geom_part: Check number of GPT entries and size of GPT entry
Current specification does not have upper limit of the number of
partition entries and the size of partition entry. In
799eac8c3d Andrey V. Elsukov introduced a
limit maximum number of GPT entries to 4k, but that is for write routine
(gpart create) only. When attaching disks that have large number of GPT
entries exceeding the limit, or disks with large size of partition
entry, it is still possible to exhaust kernel memory.

1. Reuse the limit of the maximum number of partition entries.
2. Limit the maximum size of GPT entry to 1k.

In current specification (2.10) the size of GPT entry is 128 *
2^n while n >= 0, and the size - 128 is reserved. 1k should be
sufficient enough for foreseen future.

PR:		266548
Discussed with:	imp
Reviewed by:	markj
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D36717
2022-10-18 11:03:02 -04:00
Takanori Watanabe
7b5d62bb73 ofw: add BUS_GET_DEVICE_PATH interface to openfirm/fdt, somewhat incomplete.
This add BUS_GET_DEVICE_PATH interface,
which shows device tree of openfirm/fdt.

In qemu-system-arm64 with "virt" machine with device-tree firmware,
% devctl getpath OFW cpu0

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37031
2022-10-18 16:55:47 +09:00
Colin Percival
469ad86031 amd64: Add FIRECRACKER kernel configuration
This kernel configuration supports the Firecracker VMM environment.

Relnotes:	FreeBSD can now run inside the Firecracker VMM
		via the amd64 FIRECRACKER kernel configuration.
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36672
2022-10-17 23:02:22 -07:00
Colin Percival
13f34e211b PVH: Set bootmethod to PVH
Now that we can PVH boot on a non-Xen hypervisor, we shouldn't set
machdep.bootmethod to "XEN".  Instead, set it to "PVH"; there are
other ways to discern the hypervisor.

Reviewed by:	royger
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36191
2022-10-17 23:02:22 -07:00
Colin Percival
c4a4011c74 PVH: support whitespace cmdline splitting
For historical reasons, Xen kernel command lines have options
separated by commas.  Every other FreeBSD platform uses whitespace;
this is also necessary in PVH in order to support the Firecracker
VMM.  Allow options to be separated by any combination of commas
and whitespace.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36190
2022-10-17 23:02:22 -07:00
Colin Percival
a8ea154064 x86: Distinguish Xen from non-Xen PVH boots
The PVH boot protocol, introduced by Xen, is now used by some non-Xen
platforms (e.g. the Firecracker VM) as well.  In order to accommodate
these, we use CPUID to detect Xen and only perform Xen-specific setup
when running on that platform.

The "isxen" function duplicates some work done by identcpu.c later in
the boot process; but we need it here since this is the very first C
code which runs when PVH booting (even before hammer_time).

In many places the existing code had
        xc_printf(...);
        HYPERVISOR_shutdown(SHUTDOWN_crash);
making use of Xen functionality to print a message and shut down; in
the places where this idiom can be reached in the non-xen case, we
replace it idiom with a CRASH(...) macro which calls those in the Xen
case and halts in the non-Xen case.

Reviewed by:	royger
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35801
2022-10-17 23:02:22 -07:00
Colin Percival
023a025b5c x86: Add support for PVH version 1 memmap
Version 0 of PVH booting uses a Xen hypercall to retrieve the system
memory map; in version 1 the memory map can be provided via the
start_info structure.

Using the memory map from the version 1 start_info structure allows
FreeBSD to use PVH booting on systems other than Xen, e.g. on the
Firecracker VM.

Reviewed by:	royger
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35800
2022-10-17 23:02:22 -07:00
Colin Percival
d1ca8cc638 x86: Add MPTABLE_LINUX_BUG_COMPAT option
Linux has two bugs in its handling of the x86 MP table:
1. It assumes that there is always 640 kB of base memory, and looks for
the MP table in the top kB of this even if the memory map indicates
that memory location does not exist.
2. It ignores that entry_count field and instead iterates through the
MP table by scanning until it runs out of bytes in the table.

The Firecracker VM (and probably other related VMs) relies on both of
these bugs.  With the MPTABLE_LINUX_BUG_COMPAT option, we search for
the MP table at address 639k even if that isn't in the memory map; and
replace a zeroed entry_count with a value computed from scanning the
table until we run out of table bytes.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35799
2022-10-17 23:02:22 -07:00
Colin Percival
2297a1633d Add NO_LEGACY_PCIB kernel option to i386, amd64
On systems without a PCI bus, legacy_pcib_identify by default creates
one anyway:
    legacy_pcib_identify: no bridge found, adding pcib0 anyway

This commit adds a kernel option NO_LEGACY_PCIB which disables this,
allowing systems to be fully PCI-free.

Reviewed by:	imp
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D35798
2022-10-17 23:02:22 -07:00
Colin Percival
c4b68e7e53 ns8250: Check if flush via FCR succeeded
The emulated UART in the Firecracker VMM (aka the implementation in the
rust-vmm/vm-superio project) includes FIFOs but does not implement the
FCR register, which is used by ns8250_flush to flush the FIFOs.

Check the LSR to see if there is still data in the FIFOs and call
ns8250_drain if necessary.

Discussed with:	emaste, imp, jrtc27
Sponsored by:	https://patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D36979
2022-10-17 23:02:21 -07:00