Commit Graph

19986 Commits

Author SHA1 Message Date
Ed Maste
79ead08497 makefs: remove unused variable
Reported by:	Clang
Sponsored by:	The FreeBSD Foundation
2023-04-17 08:22:12 -04:00
Ed Maste
10854bf517 makefs: use unsigned and %u for rock_ridge_move_count
For diff reduction against NetBSD's makefs.  Based on NetBSD git mirror
commit 00991aee8248.

With this change our makefs cd9660 support should be in sync up to
NetBSD commit bdae6c9dc792 ("makefs(8): Nix trailing whitespace.").

Sponsored by:	The FreeBSD Foundation
2023-04-17 08:21:28 -04:00
Ed Maste
e5551216d8 makefs: call brelse from bread
This matches NetBSD and rationalizes makefs with the kernel API.

This reverts commit 370e009188.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
Obtained from:	NetBSD 0a62dad69f62, 0c4125e1a19f, cb6a5a3575fd
Differential Revision:	https://reviews.freebsd.org/D39070
2023-04-16 15:45:17 -04:00
Ed Maste
c753f49f70 makefs: remove unused cd9660 options
Makefs defined "follow-symlinks" and "help" options, but they did
nothing.  Remove them.

Obtained from:	OpenBSD a8f1645688c2
Sponsored by:	The FreeBSD Foundation
2023-04-16 09:38:02 -04:00
Ihor Antonov
8935a39932 daemon: use kqueue for all events
Refactor daemon to use kqueue/kevent instead of signals.

This changes allows to simplify the code in several ways:
- the execution flow is now linear, no async events.
- several variables became redundant and got removed.
- all event handling is now concentrated inside of the event loop, which
  makes code reading and comprehension easier.
- new kqueuex(2) call is used for CLOEXEC, but maintained closing the
  kq fd prior to execve() to ease later MFC

No UX/API changes are intended.

Reviewed by:	kevans
Pull Request:	https://github.com/freebsd/freebsd-src/pull/701
2023-04-14 00:12:21 -05:00
Corvin Köhne
158adced65
bhyve: save softc of ACPI devices
This will be useful for writing device specific ACPI tables or DSDT
methods.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39322
2023-04-13 08:00:09 +02:00
Corvin Köhne
305edaa479
bhyve: add QEMU_FWCFG_INDEX_MAX_CPUS item
Requested-by:		coreboot
Reviewed by:		<If someone else reviewed your modification.>
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39315
2023-04-12 09:35:33 +02:00
Corvin Köhne
b6e67875a3
bhyve: add hook for PCI header of passthru devices
Most register of the PCI header are either constant values or require
emulation anyway. The command and status register are the only exception which
require hardware access. So, we're adding an emulation handler for all
other register.

As this emulation handler will be reused by some future features like
GPU passthrough, we directly export it.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33010
2023-04-12 09:22:24 +02:00
Corvin Köhne
931bb7bf1c
bhyve: define array to protect passthru regs
GPU passthrough requires a special handling of some PCI config register.
Therefore, we need a flexible approach for implementing it. Adding an
array of handler meets this condition.

Start by using the default handler for all accesses to the PCI config
space. In upcoming commits, we can start to split the default handler
into several handler for each register that requires emulation.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39291
2023-04-12 09:22:19 +02:00
Corvin Köhne
e976464a50
bhyve: allow device specific DSDT entries
This feature will be used by future commits to implement a device
specific method (_DSM) for TPM devices.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39321
2023-04-12 08:33:47 +02:00
Corvin Köhne
ab34ea4711
bhyve: check for errors when writing device specific DSDT entries
At the moment, this function can't fail. This behaviour will change in
the future. In preparation to that, convert the return type to int in
order to be able to check for errors.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39422
2023-04-12 08:33:29 +02:00
Corvin Köhne
0926566f6f
bhyve: allow building device specific ACPI tables
Some ACPI devices require a device specific acpi table. E.g. a TPM2
device requires a TPM2 table. Use the acpi_device_emul struct to define
such a device specific table.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39320
2023-04-12 08:27:04 +02:00
Ed Maste
af7624ed31 makefs: use %s and __func__ in printf messages
For diff reduction against NetBSD.

Obtained from:	NetBSD 0c4125e1a19f
Sponsored by:	The FreeBSD Foundation
2023-04-11 11:21:36 -04:00
Corvin Köhne
0d29d750b9
bhyve: do not exit if LPC finds no host selector
The host selector is only required when the user likes to use the same
LPC device IDs as the physical LPC device. This is an uncommon use case.
For that reason, it makes no sense to exit when we don't find the host
selector.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39311
2023-04-11 08:39:21 +02:00
Ed Maste
22db5e5d03 makefs: set the validation entry system type
Obtained from:	NetBSD c3cb4dcc9c43
Sponsored by:	The FreeBSD Foundation
2023-04-10 19:07:14 -04:00
Ed Maste
1d1ffa2efd makefs: use size_t or ssize_t where appropriate
Obtained from:	NetBSD af7bc97830ac
2023-04-10 18:50:27 -04:00
Ed Maste
c02e6ca7c2 makefs: simplify filename conversion handling
Obtained from:	OpenBSD 4095a2e01d18
Sponsored by:	The FreeBSD Foundation
2023-04-10 12:03:06 -04:00
Ed Maste
d73acb32d3 makefs: remove some unused cd9660 types and defines
Obtained from:	OpenBSD
Sponsored by:	The FreeBSD Foundation
2023-04-10 11:15:34 -04:00
Ed Maste
7bc4ccf3ae makefs: avoid uninitialized memory in root directory date
Move date setting into cd9660_populate_iso_dir_record so there is no
path that leaves it unset.

PR:		203531
Reported by:	Thomas Schmitt <scdbackup@gmx.net>
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39258
2023-04-06 13:47:35 -04:00
Christos Margiolis
f21faa67ab makefs(8): do not print comma after the last super-block
Reviewed by:	markj, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D39430
2023-04-05 18:25:19 -04:00
Ed Maste
2f11df6337 makefs: remove CD9660MAXPATH #define
It was used only in constructing the host path that contains file
content, which is not related to anything CD9660-specific.  PATH_MAX is
the appropriate limit.  See OpenBSD commit 299d8950f319.

Obtained from:	OpenBSD
Sponsored by:	The FreeBSD Foundation
2023-04-05 14:05:49 -04:00
Corvin Köhne
acd0088c44
bhyve: introduce acpi_device_emul struct
It'll be easier to add new properties to the ACPI device emulation if we
have a struct which holds all device specific properties. In some future
commits the acpi_device_emul struct will be expanded to include some
device specific functions to build ACPI tables.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39319
2023-04-05 09:06:41 +02:00
Corvin Köhne
76fa62b523
bhyve: add missing include to qemu_fwcfg.c
Fixes:			e46be58cca ("bhyve: add QEMU_FWCFG_INDEX_NB_CPUS item")
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
2023-04-04 13:28:37 +02:00
Corvin Köhne
e46be58cca
bhyve: add QEMU_FWCFG_INDEX_NB_CPUS item
Requested-by:		OVMF (qemu)
Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39316
2023-04-04 10:26:15 +02:00
Martin Matuska
2a58b312b6 zfs: merge openzfs/zfs@431083f75
Notable upstream pull request merges:
  #12194 Fix short-lived txg caused by autotrim
  #13368 ZFS_IOC_COUNT_FILLED does unnecessary txg_wait_synced()
  #13392 Implementation of block cloning for ZFS
  #13741 SHA2 reworking and API for iterating over multiple implementations
  #14282 Sync thread should avoid holding the spa config write lock
         when possible
  #14283 txg_sync should handle write errors in ZIL
  #14359 More adaptive ARC eviction
  #14469 Fix NULL pointer dereference in zio_ready()
  #14479 zfs redact fails when dnodesize=auto
  #14496 improve error message of zfs redact
  #14500 Skip memory allocation when compressing holes
  #14501 FreeBSD: don't verify recycled vnode for zfs control directory
  #14502 partially revert PR 14304 (eee9362a7)
  #14509 Fix per-jail zfs.mount_snapshot setting
  #14514 Fix data race between zil_commit() and zil_suspend()
  #14516 System-wide speculative prefetch limit
  #14517 Use rw_tryupgrade() in dmu_bonus_hold_by_dnode()
  #14519 Do not hold spa_config in ZIL while blocked on IO
  #14523 Move dmu_buf_rele() after dsl_dataset_sync_done()
  #14524 Ignore too large stack in case of dsl_deadlist_merge
  #14526 Use .section .rodata instead of .rodata on FreeBSD
  #14528 ICP: AES-GCM: Refactor gcm_clear_ctx()
  #14529 ICP: AES-GCM: Unify gcm_init_ctx() and gmac_init_ctx()
  #14532 Handle unexpected errors in zil_lwb_commit() without ASSERT()
  #14544 icp: Prevent compilers from optimizing away memset()
         in gcm_clear_ctx()
  #14546 Revert zfeature_active() to static
  #14556 Remove bad kmem_free() oversight from previous zfsdev_state_list
         patch
  #14563 Optimize the is_l2cacheable functions
  #14565 FreeBSD: zfs_znode_alloc: lock the vnode earlier
  #14566 FreeBSD: fix false assert in cache_vop_rmdir when replaying ZIL
  #14567 spl: Add cmn_err_once() to log a message only on the first call
  #14568 Fix incremental receive silently failing for recursive sends
  #14569 Restore ASMABI and other Unify work
  #14576 Fix detection of IBM Power8 machines (ISA 2.07)
  #14577 Better handling for future crypto parameters
  #14600 zcommon: Refactor FPU state handling in fletcher4
  #14603 Fix prefetching of indirect blocks while destroying
  #14633 Fixes in persistent error log
  #14639 FreeBSD: Remove extra arc_reduce_target_size() call
  #14641 Additional limits on hole reporting
  #14649 Drop lying to the compiler in the fletcher4 code
  #14652 panic loop when removing slog device
  #14653 Update vdev state for spare vdev
  #14655 Fix cloning into already dirty dbufs
  #14678 Revert "Do not hold spa_config in ZIL while blocked on IO"

Obtained from:	OpenZFS
OpenZFS commit:	431083f75b
2023-04-03 16:49:30 +02:00
Navdeep Parhar
4913a24e79 cxgbetool(8): Add support for tracing loopback traffic for a port.
Use lo<n> to tap the loopback for port <n>.

MFC after:	1 week
Sponsored by:	Chelsio Communications
2023-04-01 17:50:57 -07:00
Ed Maste
c6ed8694ac makefs: improve some cd9660 error messages
Obtained from:	OpenBSD
Sponsored by:	The FreeBSD Foundation
2023-03-31 10:03:05 -04:00
Corvin Köhne
d3e03d235e
bhyve: scan PCI device functions to find host LPC
At least on some AMD devices the host LPC bridge could be located as
seperate function of another PCI device.

Fixes:			f4ceaff56d
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39310
2023-03-31 08:00:06 +02:00
Ed Maste
f0bef3d20e makefs: #define Apple Partition bits
NetBSD defines these in sys/bootblock.h, which we don't have.  Add local
defintions in cd9660_eltorito.c (as OpenBSD did) to reduce diffs between
the three makefs implementations.

Obtained from:	OpenBSD
Sponsored by:	The FreeBSD Foundation
2023-03-30 18:27:30 -04:00
Ed Maste
efe6a1574e makefs: correct "filname" typo
Obtained from:	NetBSD cd9660.c r1.58
2023-03-30 12:21:26 -04:00
Corvin Köhne
e37edc91b6
bhyve: return EEXIST when adding a fwcfg item twice
Reviewed by:		rew
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39338
2023-03-30 18:10:31 +02:00
Ed Maste
52c68e1625 makefs: Whitespace cleanup to sync with NetBSD 2023-03-30 11:45:13 -04:00
Ed Maste
45e405603b makefs: do not pass mode to open() call lacking O_CREAT
Obtained from:	OpenBSD ffs.c 1.35
2023-03-30 09:20:00 -04:00
Ed Maste
cc4adc4c4e makefs: remove vestigial '?' cases from top-level getopt(3) loop
getopt(3) returns '?' when it encounters a flag not present in the in
the optstring or if a flag is missing its option argument.  We can
handle this case with the "default" failure case with no loss of
legibility.

Obtained from:	OpenBSD makefs.c 1.22
2023-03-30 09:20:00 -04:00
Corvin Köhne
4046899086
bhyve: remove unnecessary const qualifier in acpi_device.h
Those const qualifier declare that the function doesn't change the
values internally. It makes no sense to add them in the header file.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39318
2023-03-30 13:05:15 +02:00
Ed Maste
1fb7d2cf99 makefs: spelling
Obtained from:	OpenBSD msdosfs_fat.c 1.7
2023-03-29 21:48:14 -04:00
Rick Macklem
a1254dcaa8 nfsd.8: Update for nfsd running in jails
Nfsd can now be run in an appropriately
configured vnet jail.

This man page update adds some information
for this case.

This is a content change.

Reviewed by:	karels, markj
MFC after:	3 months
Differential Revision:	https://reviews.freebsd.org/D39219
2023-03-29 14:58:47 -07:00
Corvin Köhne
c98d13fbf9
bhyve: fix spelling mistake of pcireg option
The option is spelled "pcireg" not "pcir".

MFC after:		1 week
Fixes:			f4ceaff56d
Sponsored by:		Beckhoff Automation GmbH & Co. KG
2023-03-29 11:33:06 +02:00
Alan Somers
57dc6f5e20 sesutil: fix "fault all" with zoned jbods
Some SAS JBODs support zoning.  This feature allows individual SAS
targets to be accessible by only some initiator ports.  One application
would be connecting two servers to the same JBOD, but they wouldn't be
able to see each other's disks.

A zoned JBOD should also prohibit initiators from accessing SES elements
corresponding to inaccessible SAS targets.  It reports that by setting
the element's status code to 0x8 (No Access Allowed).

The bug is that when doing "sesutil (fault|locate) all ...", sesutil
will attempt a ENCIOC_SETELMSTAT ioctl for every single element, even
the inaccessible ones.  The enclosure will reject the command, the
kernel will return EINVAL, and sesutil will exit.

The solution is to check the element's status, and skip trying to set it
if the status is 0x8.  But if the user actually supplied a ses ID, then
assume that he knows what he's doing and try to set it anyway.

PR:		270093
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	mav, trasz
Differential Revision: https://reviews.freebsd.org/D39017
2023-03-27 13:43:35 -06:00
Corvin Köhne
f4ceaff56d
bhyve: add config option to modify LPC IDs
The Intel GOP driver checks the LPC IDs to detect the platform it's
running on. The GOP driver only works on the platforms it's written for.
Maybe other Intel driver have the same behaviour. For that reason, we
should use the LPC IDs of the FreeBSD host for GPU passthrough to work
properly.

We don't know if setting different LPC IDs have any side effect.
Therefore, don't use the host LPC IDs by default on Intel system. Give
the user the opportunity to modify the LPC IDs.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D28280
2023-03-27 10:10:24 +02:00
Corvin Köhne
b72e06b13e
bhyve: make use of helper to read PCI IDs from bhyve config
For compatibilty reasons, the old config values are still supported.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38403
2023-03-27 10:10:24 +02:00
Corvin Köhne
ffaed739a8
bhyve: add helper to read PCI IDs from bhyve config
Changing the PCI IDs is valuable in some situations. The Intel GOP
driver requires that some PCI IDs of the LPC bridge are aligned with the
physical values of the host LPC bridge. Another use case are oracles
virtio driver. They require different subvendor ID than the default one.
For that reason, create a helper which makes it easy to read PCI IDs
from bhyve config. Additionally, this helper ensures that all emulation
devices are using the same config keys.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38402
2023-03-27 10:10:24 +02:00
Gordon Bergling
107597fbd4 rarpd(8): Fix a typo in a source code comment
- s/combinataion/combination/

Obtained from:	NetBSD
MFC after:	3 days
2023-03-27 08:45:30 +02:00
Dag-Erling Smørgrav
508aee9681 pwd_mkdb: Sort options and update usage message.
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D39266
2023-03-25 14:15:40 +00:00
Ed Maste
978013a094 makefs: emit NM records for all directory entries
We previously attempted to emit Rock Ridge NM records only when the name
represented by the Rock Ridge extensions would actually differ. We would
omit the record for an all-upper-case directory name, however Linux (and
perhaps other operating systems) map names with no NM record to
lowercase.

This affected only directories, as file names have an implicit ";1"
version number appended and thus always differ.  To solve, just emit NM
records for all entries other than DOT and DOTDOT .

We could continue to omit the NM record for directories that would avoid
mapping (for example, one named 1234.567) but this does not seem worth
the complexity.

PR:		203531
Reported by:	Thomas Schmitt <scdbackup@gmx.net
Reviewed by:	kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39258
2023-03-25 09:25:18 -04:00
Dag-Erling Smørgrav
9b20ab1e1e local-unbound-setup: Disable the libc subscriber.
This is the correct way to prevent resolvconf from updating resolv.conf.

Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D39262
2023-03-24 21:46:09 +01:00
John Baldwin
0f735657aa bhyve: Remove vmctx member from struct vm_snapshot_meta.
This is a userland-only pointer that isn't relevant to the kernel and
doesn't belong in the ioctl structure shared between userland and the
kernel.  For the kernel, the old structure for the ioctl is still
supported under COMPAT_FREEBSD13.

This changes vm_snapshot_req() in libvmmapi to accept an explicit
vmctx argument.

It also changes vm_snapshot_guest2host_addr to take an explicit vmctx
argument.  As part of this change, move the declaration for this
function and its wrapper macro from vmm_snapshot.h to snapshot.h as it
is a userland-only API.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38125
2023-03-24 11:49:06 -07:00
John Baldwin
7d9ef309bd libvmmapi: Add a struct vcpu and use it in most APIs.
This replaces the 'struct vm, int vcpuid' tuple passed to most API
calls and is similar to the changes recently made in vmm(4) in the
kernel.

struct vcpu is an opaque type managed by libvmmapi.  For now it stores
a pointer to the VM context and an integer id.

As an immediate effect this removes the divergence between the kernel
and userland for the instruction emulation code introduced by the
recent vmm(4) changes.

Since this is a major change to the vmmapi API, bump VMMAPI_VERSION to
0x200 (2.0) and the shared library major version.

While here (and since the major version is bumped), remove unused
vcpu argument from vm_setup_pptdev_msi*().

Add new functions vm_suspend_all_cpus() and vm_resume_all_cpus() for
use by the debug server.  The underyling ioctl (which uses a vcpuid of
-1) remains unchanged, but the userlevel API now uses separate
functions for global CPU suspend/resume.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38124
2023-03-24 11:49:06 -07:00
Joseph Koshy
047ce3db97
pmcstat: Warn about text output format stability.
The formats for pmcstat(8)'s human-readable output are not part of its
user interface definition, and may change in the future.  Highlight
this in its manual page.

Approved by:	gnn (mentor)
Differential Revision: https://reviews.freebsd.org/D39249
2023-03-24 18:46:22 +00:00
Ed Maste
9f2a525360 makefs: correct El Torito bood record
The boot catalog pointer is a DWord, but we previously populated it via
cd9660_bothendian_dword which overwrote four unused bytes following it.
See El Torito 1.0 (1995) Figure 7 for details.

PR:		203531
Reported by:	Coverity Scan
Reported by:	Thomas Schmitt <scdbackup@gmx.net>
Reviewed by:	kevans
CID:		977470
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39231
2023-03-23 17:56:33 -04:00