Commit Graph

20052 Commits

Author SHA1 Message Date
Corvin Köhne
b67f0d360b
bhyve: import OpRegion definitions
Those definitions are required for the GVT-d emulation to parse the
OpRegion.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40037
2023-05-12 09:29:51 +02:00
Corvin Köhne
93cf93179c
bhyve: add helper for passthru specific mmio ranges
Intel GPUs have two special memory regions. They are called Graphics
Stolen Memory and OpRegion. bhyve has to emulate both of them. In order
to keep track of those special regions, add generic mmio ranges to the
passthru emulation.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40036
2023-05-12 09:29:44 +02:00
Corvin Köhne
99aeb28b2f
bhyve: don't panic if e820 finds no available memory
The GVT-d emulation tries to allocate some specific memory. It could
happen that this address doesn't exist. In that case, GVT-d will fall
back to allocate any address. Nevertheless, this only works if the e820
fails with an error instead of exiting on an assertion.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40034
2023-05-12 09:29:39 +02:00
Corvin Köhne
60793cee27
bhyve: make passthru sel public available
The GVT-d emulation requires access to this selector to read from the
device.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40035
2023-05-11 14:30:19 +02:00
Corvin Köhne
ca14781c81
bhyve: add cmdline option for user defined fw_cfg items
Some guest allow to configure themself by fw_cfg. E.g. Fedora CoreOs can
be provisioned by adding a JSON file as fw_cfg item.

Reviewed by:		jhb
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38338
2023-05-11 14:20:32 +02:00
Colin Percival
c55b7e5226 freebsd-update: Fix merging already-updated files
When performing an "upgrade" (moving between FreeBSD releases, as
opposed to "update" which merely applies security/errata updates
to the installed release) FreeBSD Update:

1. Generates a list of "files needing to be merged", namely those
files which don't match the version installed in the "old" release
and have paths matching the MergeChanges configuration directive
(by default, /boot/device.hints and everything under /etc/).

and later on,

2. Compares the currently-installed files to the versions in the
"new" release, removing index entries for files which "don't need
to be updated because they're not changing".

Unfortunately if a file falls into both of these categories -- that
is to say, if a file in /etc/ is the same as the version in the new
release and not the same as the version in the old release -- the
resulting "merge" step saw that the file was no longer listed as
being part of the new release, resulting in the file being deleted.

For the first 18 years of FreeBSD Update's existence, this never
happened, since $FreeBSD$ tags resulted in "new release" files
always being different from any files systems would already have
installed.

This commit fixes this behaviour by only placing a file into the
"files needing to be merged" list if it does not match the version
in the old release *or* the version in the new release.

Reported by:	des
Reviewed by:	delphij (earlier version), des, emaste
MFC after:	7 days
X-EN-Candidate:	yes
Differential Revision:	https://reviews.freebsd.org/D39973
2023-05-09 16:28:09 -07:00
Johannes Totz
de9bed030f efiwake(8): add man page
Reviewed by:	christos, grahamperrin, kib
Differential revision:	https://reviews.freebsd.org/D39961
2023-05-09 17:33:18 +03:00
Emmanuel Vadot
611503c64a fwget: Use BSD-2-Clause instead of BSD-2-Clause-FreeBSD
Reported by:	bz
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-05-09 16:03:39 +02:00
Emmanuel Vadot
d7f39ec19f fwget: Fix a few kmod name
The -kmod part was forgot in a few names for Intel firmware.

Fixes:		d198b8774d ("fwget: Introduce new utility")
Reported by:	bz
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2023-05-09 16:02:03 +02:00
Bojan Novković
fefac54359
bhyve: fix vCPU single-stepping on VMX
This patch fixes virtual machine single stepping on VMX hosts.

Currently, when using bhyve's gdb stub, each attempt at single-stepping
a vCPU lands in a timer interrupt. The current single-stepping mechanism
uses the Monitor Trap Flag feature to cause VMEXIT after a single
instruction is executed. Unfortunately, the SDM states that MTF causes
VMEXITs for the next instruction that gets executed, which is often not
what the person using the debugger expects. [1]

This patch adds a new VM capability that masks interrupts on a vCPU by
blocking interrupt injection and modifies the gdb stub to use the newly
added capability while single-stepping a vCPU.

[1] Intel SDM 26.5.2 Vol. 3C

Reviewed by:		corvink, jbh
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D39949
2023-05-09 10:04:55 +02:00
Ed Maste
9c6f3dfda6 bhyve: specify OpenSSL 1.1 API
OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.  A future
change can then switch bhyve to use OpenSSL 3.0 APIs.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39998
2023-05-08 14:32:27 -04:00
Alexander Motin
572b77f8da mountd: Improve error message for exports lines
Currently mountd print error message "symbolic link in export path or
statfs failed" in case some path component in an exports line fails
validation.  This revision improves the error message by giving more
information about the precise error as well as the path component that
caused the issue.

Submitted by:	Andrew Walker <awalker@ixsystems.com>
Reviewed by:	mav, rmacklem
Differential Revision:	https://reviews.freebsd.org/D39840
2023-05-06 15:02:08 -04:00
Mitchell Horne
bf66159342 pmcstat: augment an error message
It also applies to the -t argument.

Reviewed by:	jkoshy
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D39907
2023-05-06 14:49:19 -03:00
Mitchell Horne
8bd4459560 pmccontrol: drop Pentium 4 special case
This is dead code; we no longer support Pentium hardware in libpmc or
hwpmc.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2023-05-06 14:49:18 -03:00
Doug Ambrisko
7e0f8b79b7 Add mrsasutil(8) as alias to mfiutil(8)
mfiutil(8) in theory can work on devices attached to mrsas(4) but
mrsas(4) is missing the FreeBSD mfi(4) ioctl support.  Once that
support is added to mrsas(4) then mrsasutil(8) can manage mrsas(4)
attached devices.  So this commit depends on that.  When mrsasutil(8)
is run it automatically opens /dev/mrsas0 instead of /dev/mfi0.
Add -D <device> and -t <type> flag to optionally specify mrsas or mfi to
work with the existing -u <unit>.  Device is the device node with or
without /dev/

PR:			https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=265794
Differential Revision:	https://reviews.freebsd.org/D36343
Tested by:		Dan Mahoney <freebsd@gushi.org>
Reviewed by:		jhb
2023-05-05 09:20:48 -07:00
Kyle Evans
494e7dfdbe daemon: EINTR from kevent(2) is not a fatal error
Simply resume waiting for events rather than exiting if we took a signal
here.

This at least fixes running programs under daemon(8) in the face of
suspend/resume, which I suspect hits us with a spurious EINTR rather
than a signal anyways.

Reported and tested by:	manu
Fixes:	8935a39932 ("daemon: use kqueue for all events")
2023-05-05 10:28:40 -05:00
Alexey Marchenko
66659955da bhyve(8): fix typo in examples
PR:		271259
2023-05-05 15:08:51 +02:00
Mina Galic
fff1551c03 ntpd: Support IPv6-only hosts
0.pool.* returns only IPv4 addresses.
2.pool.* returns both, IPv6 and IPv4 addresses.

conservatively extend our IPv4 only pool configuration by adding a
second pool, which also returns IPv6 addresses.

PR:			270536
Reported by:		Lapo Luchini <lapo@lapo.it>
MFC after:		3 days
Pull Request:		https://github.com/freebsd/freebsd-src/pull/731
Differential Revision:	https://reviews.freebsd.org/D39954
2023-05-04 21:37:02 -07:00
Tom Hukins
af32969ddb mpsutil(8): Remove a stray paragraph
Spotted by running `mandoc -Tlint usr.sbin/mpsutil/mpsutil.8`.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/729
2023-05-04 16:06:28 -06:00
Tom Hukins
910733a6f9 mpsutil(8): Improve English usage
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/729
2023-05-04 16:06:28 -06:00
Brian Campbell
9affcf438b bluetooth/hccontrol: Fix unterminated command list
Signed-off-by: Brian Campbell <Brian.Campbell@ed.ac.uk>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/730
2023-05-04 16:01:36 -06:00
Simon J. Gerraty
9f27341c33 local.meta.sys.mk set BOOTSTRAPPING
When building for host on non-FreeBSD
some makefiles want to see BOOTSTRAPPING defined.

With this libmd and hence nmtree build ok
2023-05-03 12:20:02 -07:00
Kristof Provost
476babaea7 rtsol: introduce an 'always' script
In addition to the 'M' and 'O' scripts (for when 'Managed' and 'Other'
flags are set) also introduce an 'always' script that is called for any
router advertisement (so even if M and O are not set).

This is primarly useful for systems like pfSense that wish to be
informed of routers for further system configuration.

See also https://redmine.pfsense.org/issues/14072

Reviewed by:	melifaro
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D39931
2023-05-02 18:07:36 +02:00
Emmanuel Vadot
d198b8774d fwget: Introduce new utility
This script's goal is to check the system for peripherals that needs
firmware and install the needed packages for them.
For now it only support pci subsystem and only video classes for AMD
and Intel GPUs.

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39825
2023-05-01 08:32:59 +02:00
Poul-Henning Kamp
e0e5bf4d62 freebsd-update: Mention 13.2-RELEASE in usage. 2023-04-30 05:06:56 +00:00
Vitaliy Gusev
8371bbdadb
bhyve: enable capsicum for snapshot code
Reviewed by:		corvink
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38860
2023-04-28 09:02:51 +02:00
Vitaliy Gusev
18126b647a
bhyve: use directory file descriptor for checkpoint
This is required to enable capsicum for the snapshot code.

Reviewed by:		corvink
Sponsored by:		vStack
Differential Revision:	https://reviews.freebsd.org/D38858
2023-04-28 09:00:48 +02:00
Konstantin Belousov
cae85a647a efiwake(8): style
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-04-28 06:08:09 +03:00
Johannes Totz
1808b5577d Add efiwake tool
Reviewed by:	kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36714
2023-04-28 04:28:51 +03:00
Yuri Pankov
08ed87514f tzsetup: appease checkstyle9 2023-04-27 20:29:55 +02:00
Yuri Pankov
cfd0217aa9 tzsetup: adopt zone1970.tab changes
- assumption that single-zone countries do not have description
  is no longer correct; do not try to optimize this case as it's
  only going to make the code more confusing and we now have menus
  with a single zone selection because of this
- remove the single-country continent short cut, it also only serves
  to confuse users as we now have such a continent
- instead add a single-zone contry short cut (see above), now all
  single-zone countries fall here
- use the #@ continent overrides that zone1970.tab introduces (this is
  visible at least fixing Iceland being currently listed under Africa)
- add Arctic Ocean "continent" coming only from the overrides at the
  moment
- update baseline with the changes

Reviewed by:	bapt, philip
Differential Revision:	https://reviews.freebsd.org/D39606
2023-04-27 19:31:48 +02:00
Guido Falsi
014e03411f bhyve: Add DEBUG_HDA_FILE define to specify location of debug output
Reviewed by:		corvink
Approved by:		corvink
Differential Revision:	https://reviews.freebsd.org/D39826
2023-04-27 15:12:55 +02:00
Guido Falsi
03d3124629 bhyve: Disable bhyve HDA debug by default.
Adapt hda_print_cmd_ctl_data() to not generate compiler warnings
when DEBUG_HDA is off.

Reviewed by:		corvink
Approved by:		corvink
Differential Revision:	https://reviews.freebsd.org/D39826
2023-04-27 15:12:45 +02:00
John Baldwin
2d7842d0bf arp/ndp: Use valid prototypes for function declarations with no arguments. 2023-04-26 13:18:53 -07:00
Alexander V. Chernikov
52199877a6 arp: report successful deletion via netlink to mimic rtsock. 2023-04-26 13:26:37 +00:00
Yuri Pankov
989a0e1d81 tzsetup: fix bootstrapping for github CI jobs
Move dump_zonetab() under HAVE_BSDDIALOG as the parsing code
it relies on already is.
2023-04-26 14:29:08 +02:00
Peter Jeremy
b9600db494
prometheus_sysctl_exporter: Replace magic numbers with identifiers.
Identifiers make it clearer what is going on and makes it easier to
find consumers of sysctl functionality.

No functional change.

MFC after:	3 days
Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D39797
2023-04-26 18:29:33 +10:00
Corvin Köhne
16f23f7543
bhyve: pass E820 table to guest
E820 table will be used to report valid RAM ranges and reserve special
memory areas like graphics memory for GPU passthrough.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39550
2023-04-26 09:58:37 +02:00
Corvin Köhne
a8a8e9af57
bhyve: add E820 dump function
For debugging purposes it is helpful to dump the E820 table.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39549
2023-04-26 09:58:35 +02:00
Corvin Köhne
5597f56487
bhyve: add allocation function to E820
This function makes it easy to allocate new E820 entries. It will be
used to allocate graphics memory for Intel integrated graphic devices.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39547
2023-04-26 09:58:34 +02:00
Corvin Köhne
059af92a30
bhyve: add common memory holes to E820 table
The VGA and the ROM memory ranges can't be used as system memory. For
that reason, remove them from the E820 table.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39546
2023-04-26 09:58:31 +02:00
Corvin Köhne
9180daa1e3
bhyve: add basic E820 implementation
There are some use cases where bhyve has to prepare some special memory
regions. E.g. GPU passthrough for Intel integrated graphic devices needs
to reserve some memory for the graphic device. So, bhyve has to inform
the guest about those memory regions. This information can be passed by
the qemu fwcfg interface. As qemu creates an E820 table, we can reuse
the existing fwcfg item "etc/e820".

This commit is the first one of a series. It only adds a basic
implementation for the creation of the E820 table. Some subsequent
commits will add more items to the E820 table and register it as fwcfg
item.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D39545
2023-04-26 09:58:27 +02:00
Alexander V. Chernikov
7825619a9e ndp: fix signed/unsigned compariosn in the netlink code. 2023-04-25 14:55:56 +00:00
Alexander V. Chernikov
91fbe0819b ndp: convert ndp(8) to netlink.
The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), ndp can be build without
  netlink by defining WITHOUT_NETLINK in make.conf.

 Differential Revision:  https://reviews.freebsd.org/D39720
2023-04-25 12:30:39 +00:00
Alexander V. Chernikov
35e7180a32 arp: remove forgotten debug message. 2023-04-25 12:29:34 +00:00
Alexander V. Chernikov
6ad73dbf65 arp: convert arp(8) to netlink.
The change is intended to be fully transparent to the users.
Similarly to route(8) and netstat(8), arp can be build without
 netlink by defining WITHOUT_NETLINK in make.conf.

Differential Revision:	https://reviews.freebsd.org/D39720
2023-04-25 11:26:22 +00:00
Corvin Köhne
7959d80d99
bhyve: make use of qemus acpi table loader
Add all acpi tables to qemus acpi table loader. This passes the acpi
tables by fwcfg to the guest.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38439
2023-04-25 08:29:29 +02:00
Corvin Köhne
f565b4d630
bhyve: add helper struct for qemus acpi table loader
The hypervisor is aware of all system properties. For the guest bios
it's hard and complex to detect all system properties. For that reason,
it would be better if the hypervisor creates acpi tables instead of the
guest. Therefore, the hypervisor has to send the acpi tables to the
guest. At the moment, bhyve just copies the acpi tables into the guest
memory. This approach has some restrictions. You have to keep sure that
the guest doesn't overwrite them accidentally. Additionally, the size of
acpi tables is limited.

Providing a plain copy of all acpi tables by fwcfg isn't possible. Acpi
tables have to point to each other. So, if the guest copies the acpi
tables into memory by it's own, it has to patch the tables. Due to
different layouts for different acpi tables, there's no generic way to
do that.  For that reason, qemu created a table loader interface. It
contains commands for the guest for loading specific blobs into guest
memory and patching those blobs.

This commit adds a qemu_loader class which handles the creation of qemu
loader commands. At the moment, the WRITE_POINTER command isn't
implement. It won't be required by bhyve's acpi table generation yet.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38438
2023-04-25 08:29:25 +02:00
John Baldwin
672eba2435 ppp: Use valid prototypes for function declarations with no arguments.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39730
2023-04-24 08:53:49 -07:00
John Baldwin
4b75b42ddb ndp: Use valid prototypes for function declarations with no arguments.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D39729
2023-04-24 08:53:49 -07:00