Commit Graph

283905 Commits

Author SHA1 Message Date
Andrew Turner
0731b0a9f1 Print registers on an arm64 spinlock data abort
When checking if the spinlock count is correct in a data abort we can
panic without printing the registers. These are useful to debug the
abort, e.g. by giving the fault address register.

Reviewed by:	kib
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40228
2023-05-24 17:20:06 +01:00
Andrew Turner
b81e1c6b72 Don't print leading 0's in the arm64 esr
We don't print leading zeros for other registers, so do the same with
ESR_EL1.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40129
2023-05-24 17:20:06 +01:00
Andrew Turner
800b39cf99 arm64: Remove CNTHCTL_EL2 from arm64.h
It is also in hypervisor.h where it belongs.

Sponsored by:	Arm Ltd
2023-05-24 17:20:05 +01:00
Dag-Erling Smørgrav
5afab0e5e5 ldns: Upgrade to 1.8.3.
Merge commit 'cf3e3d5bd0a1fae39c74c7db5a4e8b10732d0766'

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40226
2023-05-24 15:50:18 +00:00
Alexander V. Chernikov
12cfa3c1bd ifconfig: fix interface address ordering with Netlink. 2023-05-24 15:34:21 +00:00
Mike Karels
1186ef86c3 RELNOTES: add note about moving /usr/home to /home
Document change to pw and hence bsdinstall.
2023-05-24 10:32:07 -05:00
Mike Karels
aa1a1e7dc4 mksnap_ffs.8: update /home examples
The default location for home directories is moving from /usr/home
to /home.  Update the examples accordingly.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D40205
2023-05-24 10:31:50 -05:00
Ed Maste
d1639e43c5 cpuset: increase userland maximum size to 1024
Hardware with more than 256 CPU cores is now available and will become
increasingly common.  Bump CPU_MAXSIZE (used for userland cpuset_t
sizing) to 1024 to define the ABI for FreeBSD 14.

This change is reapplied after a change to decouple cpuset from bhyve:
commit e17eca3276 ("vmm: Avoid embedding cpuset_t ioctl ABIs").

PR:		269572, 271213 [exp-run]
Reviewed by:	mjg, jhb
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39941

(cherry picked from commit 76887e84be)
2023-05-24 10:59:05 -04:00
Randall Stewart
57a3a161a9 tcp: request tracking is not http specific.
This change is a name change only. TCP Request tracking can track sendfile and even non-sendfile requests. The
names however in the current code use http, and they should not. The feature is not http specific. Lets change the
name so they more properly reflect whats going on. This also fixes conflicts with http_req which caused application pain.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D40229
2023-05-24 06:35:36 -04:00
Mitchell Horne
08637d5d15 ofw_cpu: quiet secondary CPU devices
We already do plenty to announce the different CPUs in dmesg. Follow the
ACPI CPU strategy of reporting the first CPU device, but quieting the
rest for non-verbose boot. This cuts down slightly on dmesg output.

Reviewed by:	manu, jhb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40243
2023-05-24 10:28:26 -03:00
Mitchell Horne
5edffecc4b ofw_cpu: whitespace cleanup
Reviewed by:	jhb, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40242
2023-05-24 10:28:26 -03:00
Mark Johnston
2c0a6d0e7b bhyvectl: Update usage of vm_run()
Fixes:	e17eca3276 ("vmm: Avoid embedding cpuset_t ioctl ABIs")
2023-05-24 08:23:22 -04:00
Andrew Turner
255adf35c0 Export arm64 VFP handling functions
These will be used by bhyve to manage the host VFP registers, e.g.
saving the host state before entering a guest.

Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D40130
2023-05-24 11:55:38 +01:00
Andrew Turner
419f8fc7fb Add more arm64 special registers
These will be used by bhyve

Reviewed by:	markj
Sponsored by:	Arm Ltd
Sponsored by:	Innovate UK
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40128
2023-05-24 11:55:38 +01:00
Zachary Leaf
012ea67d2d arm64 pmap: introduce PHYS_TO_PTE macro
Introduce macro for PHYS_TO_PTE, setting the groundwork for future
support of various Arm VMSA extensions.

For extensions such as 52-bit VA/PA (FEAT_LPA2), the representation of
an address between a PTE and PA are not equivalent. This macro will
allow converting between the different representations.

Currently PHYS_TO_PTE is a NOP. Replace all instances where we go from
PA to PTE with new PHYS_TO_PTE macro.

Reviewed by:	markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39828
2023-05-24 11:55:38 +01:00
Zachary Leaf
0f54e49d4b arm64 pmap: introduce PTE_TO_PHYS macro
Introduce macro for PTE_TO_PHYS, setting the groundwork for future
support of various Arm VMSA extensions.

For extensions such as 52-bit VA/PA (FEAT_LPA2), the representation of
an address between a PTE and PA are not equivalent. This macro will
allow converting between the different representations.

Currently going from PTE to PA is achieved by masking off the upper and
lower attributes. Retain this behaviour but replace all instances with
the new macro instead.

Reviewed by:	alc, markj
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39827
2023-05-24 11:55:38 +01:00
Alexander V. Chernikov
6e3a9d7f2c ifconfig: introduce ifconfig_context to store current global state.
The structure consists of all current context - arguments,
open sockets, current family and so on.

Pass this structure as a first argument to most of the af_ menthods.
This allows to propagate and update shared data without using
 global variables.

The diff is pretty large, but de-facto mechanical. All changes
 except the structure setup in ifconfig[_netlink].c are one-line
 mechanical changes.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D40239
MFC after:	2 weeks
2023-05-24 10:40:34 +00:00
Alexander V. Chernikov
44cd85d42e ifconfig: cleanup warnings #1
Cleanup compiler warnings in preparation to set Wextra and remove WARNS?=2

Differential Revision: https://reviews.freebsd.org/D40238
MFC after:	2 weeks
2023-05-24 10:40:34 +00:00
Bjoern A. Zeeb
ad513b4dba LinuxKPI: add utsname for init_utsname() with release
A wireless dirver is requesting release from the result of
init_utsname().  Populate the field on startup.

MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40248
2023-05-24 08:41:28 +00:00
Bjoern A. Zeeb
c1b6e9121e LinuxKPI: uuid: add guid_gen() and guid_copy()
Add function used by a wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40249
2023-05-24 08:34:28 +00:00
Mark Johnston
80764cdb73 bhyve: Remove the exitcode stats structure
This structure isn't used for anything, and only counts a subset of
vmexit types.  Moreover, it is not accurate since there is no
synchronization between vcpu threads.  Simply remove it.

No functional change intended.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40245
2023-05-23 21:17:02 -04:00
Mark Johnston
e17eca3276 vmm: Avoid embedding cpuset_t ioctl ABIs
Commit 0bda8d3e9f ("vmm: permit some IPIs to be handled by userspace")
embedded cpuset_t into the vmm(4) ioctl ABI.  This was a mistake since
we otherwise have some leeway to change the cpuset_t for the whole
system, but we want to keep the vmm ioctl ABI stable.

Rework IPI reporting to avoid this problem.  Along the way, make VM_RUN
a bit more efficient:
- Split vmexit metadata out of the main VM_RUN structure.  This data is
  only written by the kernel.
- Have userspace pass a cpuset_t pointer and cpusetsize in the VM_RUN
  structure, as is done for cpuset syscalls.
- Have the destination CPU mask for VM_EXITCODE_IPIs live outside the
  vmexit info structure, and make VM_RUN copy it out separately.  Zero
  out any extra bytes in the CPU mask, like cpuset syscalls do.
- Modify the vmexit handler prototype to take a full VM_RUN structure.

PR:		271330
Reviewed by:	corvink, jhb (previous versions)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40113
2023-05-23 21:15:59 -04:00
Bjoern A. Zeeb
0be82d56b4 fwget: update pci_network_mediatek for mt7996
Add support for another chipset and fix mt7915 to not match on
all IDs.
2023-05-23 23:41:24 +00:00
Bjoern A. Zeeb
6a1c503736 LinuxKPI: add thermal.h to dummy files for now
Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-23 23:23:59 +00:00
Bjoern A. Zeeb
1213a6bea8 LinuxKPI: skbuff: add napi_build_skb() and skb_mark_for_recycle()
Add more (skeleton) functions used by wireless drivers.

MFC after:	10 days
2023-05-23 23:18:35 +00:00
Yan Ka Chiu
7e49aa86a2
ifconfig(8): Teach ifconfig to attach and run itself in a jail
Add -j <jail> flag to ifconfig to allow ifconfig to attach and run inside a
jail. This allow parent to configure network interfaces of its children
even if ifconfig is not available in child's tree (e.g. Linux Jails)

Reviewed by:	emaste, khng, melifaro
Event:		Kitchener-Waterloo Hackathon 202305
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D40213
2023-05-23 16:39:22 -04:00
Dimitry Andric
3741ffdb14 Fix typo in sys/conf/kern.mk's InitAll warning message
I missed this one in commit 3006f6df02.

Fixes:		3006f6df02
MFC after:	3 days
2023-05-23 19:56:46 +02:00
Dimitry Andric
c32736222c Enable -ftrivial-auto-var-init flags for gcc >= 12
Now that gcc >= 12 supports -ftrivial-auto-var-init, add it to
bsd.compiler.mk's "init-all" feature.

PR:		271047
Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40208
2023-05-23 19:44:45 +02:00
Dimitry Andric
3006f6df02 Update -ftrivial-auto-var-init flags for clang >= 16
As of clang 16, the -ftrivial-auto-var-init=zero option no longer needs
-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
to enable the option. Only add it for older clang versions.

PR:		271047
Reviewed by:	emaste
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D40208
2023-05-23 19:44:45 +02:00
Simon J. Gerraty
75e02c458a libsecureboot ensure correct BUILD_UTC
If using stat(1) on BUILD_UTC_FILE we should use -L incase
it is a symlink.

If we have new enough bmake though we can just use ${BUILD_UTC_FILE:mtime}
2023-05-23 09:02:00 -07:00
Dag-Erling Smørgrav
5063211781 ctags: Error out if writing to stdout failed.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	cracauer, allanjude
Differential Revision:	https://reviews.freebsd.org/D40200
2023-05-23 17:31:28 +02:00
Christos Margiolis
7900879eec rc.resume: remove obsolete comment
Reviewed by:	markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40235
2023-05-23 18:26:56 +03:00
Christos Margiolis
ff624eb636 kinst: use dtrace_dis_get_byte() instead of own copy
No functional change intended.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39872
2023-05-23 18:12:18 +03:00
Johannes Totz
2cf8ef5910 rc.suspend: execute rc-scripts with suspend keyword
For symmetry with rc.resume, give rc.suspend the ability to execute
rc-scripts. Use the suspend keyword for that.

Use-case is for setting a wake-up time, e.g. via efiwake.

Reviewed by:	christos
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D39965
2023-05-23 18:11:31 +03:00
Christos Margiolis
98ab9802af dtrace: rename rp to frame in dtrace_getreg()
Reviewed by:	mhorne, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40231
2023-05-23 17:44:47 +03:00
Christos Margiolis
ed35c7cf77 dtrace.1: fix mandoc -Tlint
Reviewed by:	markj
Approved by:	markj (mentor)
Differential Revision:	https://reviews.freebsd.org/D40230
2023-05-23 17:29:19 +03:00
Mark Johnston
30038a8b4e md: Get rid of the pbuf zone
The zone is used solely to provide KVA for mapping BIOs so that we can
pass mapped buffers to VOP_READ and VOP_WRITE.  Currently we preallocate
nswbuf/10 bufs for this purpose during boot.

The intent was to limit KVA usage on 32-bit systems, but the
preallocation means that we in fact consumed more KVA than needed unless
one has more than nswbuf/10 (typically 25) vnode-backed MD devices
in existence, which I would argue is the uncommon case.

Meanwhile, all I/O to an MD is handled by a dedicated thread, so we can
instead simply preallocate the KVA region at MD device creation time.

Event:		BSDCan 2023
Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D40215
2023-05-23 10:27:10 -04:00
Christos Margiolis
21a16d55cc dtrace: add register bindings for arm64
Reviewed by:	mhorne, markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39956
2023-05-23 17:19:25 +03:00
Christos Margiolis
db05f9fbfb dtrace: implement dtrace_instr_size() for arm64
Reviewed by:	markj
Approved by;	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39955
2023-05-23 17:19:15 +03:00
Christos Margiolis
27ff920e6a dtrace: remove ifdef around dtrace_instr_size()
Architectures that are not included in the #ifdef won't be able to
compile libdtrace. This was tested on an ARM64 build. If the ifdef is
removed, libdtrace can be compiled with no problems, otherwise it fails
at libdtrace.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39948
2023-05-23 17:19:04 +03:00
Christos Margiolis
1e136a9cbd dtrace(1): add -d flag to dump D script post-dt_sugar
By specifying the -d flag, libdtrace will dump the D script after it has
applied syntactical sugar transformations (e.g if/else). This is useful
for both understanding what dt_sugar does, as well as debugging it.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38732
2023-05-23 17:18:39 +03:00
Kristof Provost
81877287a9 if_ovpn: ensure we never re-use sequence numbers
if_ovpn already notified userpsace when there was a risk of sequence
number re-use, but it trusted userspace to actually rotate the key.

Convert the internal sequence number counter to 64 bits so we can detect
overflows and then refuse to send packets.

Event:		BSDCan 2023
Reviewed by:	Leon Dang <ldang@netgate.com>
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40187
2023-05-23 16:11:26 +02:00
Kristof Provost
c4a32455d9 pf: remove the use of caddr_t
Replace caddr_t with void *, or more accurate types.

Suggested by:	glebius
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D40186
2023-05-23 16:11:13 +02:00
Christos Margiolis
ecca318085 kinst: replace KINST_TRAMP_INIT
The current implementation of KINST_TRAMP_INIT is working only on amd64,
where the breakpoint instruction is one byte long, which might not be
the case for other architectures (e.g in RISC-V it's either 2 or 4
bytes). This patch introduces two machine-dependent constants,
KINST_TRAMP_FILL_PATTERN and KINST_TRAMP_FILL_SIZE, which hold the fill
instruction and the size of that instruction in bytes respectively.

Reviewed by:	markj
Approved by:	markj (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39504
2023-05-23 16:58:36 +03:00
Mitchell Horne
940e6d36de riscv: Print less CPU info
Change the reporting strategy to more closely follow what arm64
implements:
 - Always print the one-line CPU summary when a core comes online
 - Only print the additional fields (e.g. ISA) when they differ from the
   CPU before it

In the common case of identical CPUs this results in informative but
non-repetitive output. For example, in QEMU:

  CPU 0  : Vendor=Unspecified Core=Unknown (Hart 0)
    marchid=0x80032, mimpid=0x80032
    MMU: 0x7<Sv39,Sv48,Sv57>
    ISA: 0x112d<Atomic,Compressed,Double,Float,Mult/Div>
  real memory  = 8589934592 (8192 MB)
  avail memory = 8332300288 (7946 MB)
  FreeBSD/SMP: Multiprocessor System Detected: 6 CPUs
  CPU 1  : Vendor=Unspecified Core=Unknown (Hart 1)
  CPU 2  : Vendor=Unspecified Core=Unknown (Hart 2)
  CPU 3  : Vendor=Unspecified Core=Unknown (Hart 3)

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40024
2023-05-23 10:19:46 -03:00
Mitchell Horne
7245ffd10e riscv: MMU detection
Detect and report the supported MMU for each CPU. Export the
capabilities to the rest of the kernel and use it in pmap_bootstrap() to
check for Sv48 support.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39814
2023-05-23 10:19:26 -03:00
Mitchell Horne
78a3420c20 riscv: Print ISA extensions
Report the CPU's single-letter ISA extensions in printcpuinfo().

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39813
2023-05-23 10:19:26 -03:00
Mitchell Horne
b37dc09033 riscv: Rework CPU identification (second part)
Modify when and how we perform parsing and reporting. Most notably,
everything now executes on CPU 0.

The de-facto standard way to enumerate CPU features (ISA extensions) on
RISC-V is by parsing each CPU's ISA string. We currently obtain this
information from the device tree, and in the future will be able to pull
it from ACPI tables.

Eliminate the SYSINIT from identcpu.c. We still need to walk the /cpus
list in the device tree, but now do this one CPU at a time, as a step in
the identify_cpu() procedure. This is slightly less error prone, and
allows us to parse ISA features for CPU 0 much earlier.

Make use of the SMP hooks cpu_mp_start() and cpu_mp_announce() to
identify and print secondary CPU info, respectively. This causes
secondary processor identification to be printed much earlier in boot;
everything is done by SI_SUB_CPU, SI_ORDER_THIRD. Adjust some other
printf() calls so that we get enough useful info to debug under
bootverbose.

Reviewed by:	markj (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39811
2023-05-23 10:06:29 -03:00
Mitchell Horne
b0d45b023e riscv: Call identify_cpu() earlier for CPU 0
It is advantageous to have knowledge of ISA features as early as
possible. For example, the presence of newer virtual memory extensions
may be useful to pmap_bootstrap().

To achieve this, split out the printf() parts of identify_cpu() into a
separate function, printcpuinfo(). This latter function will be called
later in boot after the console has been initialized.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39810
2023-05-23 10:00:25 -03:00
Mitchell Horne
88b4d124ef riscv: Rework CPU identification (first part)
Make better use of the RISC-V identification CSRs: mvendorid, marchid,
and mimpid. This code was written before these registers were
well-specified, or even available to the kernel. It currently fails to
recognize any CPU or platform.

Per the privileged specification, mvendorid contains the JEDEC vendor ID,
or zero.

The marchid register denotes the CPU microarchitecture. This is either
one of the globally allocated open-source implementation IDs, or the
field has a custom encoding. Therefore, for known vendors (SiFive) we
can also maintain a list of known marchid values. If we can not give a
name to the CPU but marchid is non-zero, then just print its value in
the report.

The mimpid (implementation ID) could be used in the future to more
uniquely identify the micro-architecture, but it really remains to be
seen how it gets used. For now we just print its value.

Thank you to Danjel Qyteza <danq1222@gmail.com> who submitted an early
version of this change to me, although it has been almost entirely
rewritten.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39809
2023-05-23 10:00:25 -03:00