Commit Graph

279677 Commits

Author SHA1 Message Date
Ed Maste
20a66ab4bf Retire CLANG_IS_CC option
A small reduction in build infrastructure complexity; when we had both
Clang and GCC in the tree it was useful to have both built, and choose
one or the other to install as /usr/bin/cc.  Now only Clang is in the
tree, and there is no point in building and installing base Clang but
not providing it as cc (and c++, cpp).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37075
2022-11-21 14:56:13 -05:00
Corvin Köhne
67654ffd44
bhyve: use dynamic ACPI table offsets
Now that all ACPI tables are build by basl, basl can dynamically
calculate the offset for each table.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37002
2022-11-21 09:28:01 +01:00
Corvin Köhne
03e7111fa6
bhyve: build RSDP table by basl
Building the RSDP table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37001
2022-11-21 09:28:00 +01:00
Corvin Köhne
f3dcdf8be4
bhyve: build RSDT table by basl
Building the RSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37000
2022-11-21 09:27:59 +01:00
Corvin Köhne
4a60470f05
bhyve: build XSDT table by basl
Building the XSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36999
2022-11-21 09:27:58 +01:00
Corvin Köhne
6a75de903b
bhyve: build FADT table by basl
Building the FADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36998
2022-11-21 09:27:57 +01:00
Corvin Köhne
897fe59adf
bhyve: build MADT table by basl
Building the MADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36997
2022-11-21 09:27:56 +01:00
Corvin Köhne
d61d712299
bhyve: build HPET table by basl
Building the HPET table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36996
2022-11-21 09:27:55 +01:00
Corvin Köhne
60277ad75e
bhyve: add helper to fill a ACPI_GENERIC_ADDRESS
Reviewed by:		jhb
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37407
2022-11-21 09:27:54 +01:00
Corvin Köhne
2c2bd15532
bhyve: build MCFG table by basl
Building the MCFG table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36995
2022-11-21 09:27:53 +01:00
Corvin Köhne
8897b562ab
bhyve: add helper to append a basl table without a header
The common style for build an ACPI table will be:

1. basl_table_create
2. basl_table_append_header
3. setup an ACPI_TABLE_* struct
4. basl_table_append_bytes (without header)

Add a helper for the last step.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37406
2022-11-21 09:27:51 +01:00
Corvin Köhne
7263419f38
bhyve: make basl_table_add_* functions public
The code will be more readable if we use struct definitions from ACPI-CA
to build ACPI tables. We can fill out the struct and append it to the
basl_table by using basl_table_append_bytes. After that, we have to
declare which checksums, length and pointers should be patched by basl.
That's done by the add_* functions.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37405
2022-11-21 09:27:50 +01:00
Corvin Köhne
bdbb1da75a
bhyve: build FACS table by basl
Building the FACS table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

Reviewed by:		jhb, markj (older version)
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36994
2022-11-21 09:27:48 +01:00
Corvin Köhne
fde8ce8892
vmm: remove unneccessary rendezvous assertion
When a vcpu sees that a rendezvous is in progress, it exits and tries to
handle the rendezvous. The vcpu doesn't check if it's part of the
rendezvous or not. If the vcpu isn't part of the rendezvous, the
rendezvous could be done before it reaches the assertion. This will
cause a panic.

The assertion isn't needed at all because vm_handle_rendezvous properly
handles a spurious rendezvous. So, we can just remove it.

PR:			267779
Reviewed by:		jhb, markj
Tested by:		bz
Approved by:		manu (mentor)
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37417
2022-11-21 08:19:36 +01:00
Justin Hibbits
088cf0c5db powerpc/dtrace: Guard fuword64 usage for powerpc64 only
32-bit powerpc doesn't have a fuword64, so only use it on powerpc64.
This could also be done elsewhere that splits 32-bit and 64-bit
accesses, but adding ifdefs everywhere would just clutter up the source
for little benefit.  This is the only usage of fuword64 directly; other
archs have a dtrace_fuword64_nocheck(), but powerpc does not, and I
don't see a need to add it currently.

MFC after:	1 week
2022-11-20 19:50:45 -05:00
Gordon Bergling
e0b7defdee orders.7: Sync with NetBSD after CGPM
Extend orders(7) with prefixes from Resolution 3 of
the 27th meeting of CGPM.

Obtained from:	NetBSD
MFC ater:	1 week
2022-11-20 19:24:57 +01:00
Ed Maste
8214b9d65a Make devd shared now that libc++ is in /lib
Commit 5e6a2d6eb2 moved libc++ from /usr/lib to /lib, so we no longer
have an interval during boot when it is not available (before /usr is
mounted).  We no longer need to force devd to be statically linked.

Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37409
2022-11-20 11:49:09 -05:00
Dmitry Chagin
2ee1a18d51 vmm: Fix build w/o KDTRACE_HOOKS.
Reviewed by:		imp
Differential revision:	https://reviews.freebsd.org/D37446
2022-11-20 18:00:55 +03:00
Xin LI
d0f168e680 Document that cmake files were omitted in previous import. 2022-11-19 20:17:59 -08:00
Wanpeng Qian
41be508d31 nvmecontrol: Fix IEEE OUI Identifier output
Current sequence of IEEE OUI Identifier output is wrong.

For Intel, current output is e4 d2 5c, specification is 5CD2E4h
For Samsung, current output is 38 25 00, specification is 002538h
also check with Linux nvme-cli.

Reviewed by:	imp, chuck
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33856
2022-11-19 19:14:00 -08:00
Mateusz Guzik
424bf1d5ca man9: remove vm_map_unwire from ObsoleteFiles.inc
Fixes:	b812132455 ("man9: add vm_map_unwire link")
Reported by:	yuri
2022-11-19 14:00:58 +00:00
John Baldwin
adc3c128c6 src.opts.mk: Require C++20 for C++ support.
libc++ requires C++20, so mark C++ (MK_CXX) as broken if the compiler
does not support C++20.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D36893
2022-11-18 20:12:28 -08:00
John Baldwin
063b380f54 bsd.compiler.mk: Add a c++20 compiler feature.
This is enabled for clang versions 10+ and GCC versions 10+.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D36892
2022-11-18 20:11:59 -08:00
John Baldwin
b9cb80883b Don't omit bsd.compiler.mk for the nested delete-old in buildworld.
src.opts.mk will need bsd.compiler.mk to determine if CXX is
supported.  Without this, src.opts.mk always marks CXX as broken and
attempts to delete all dependencies of MK_CXX from WORLDTMP.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D36890
2022-11-18 20:11:07 -08:00
Vladimir Kondratyev
183088934a evdev: Extend EVIOCGRAB ioctl scope to cover kbd interface
of various keyboard drivers.
EVIOCGRAB ioctl execution on /dev/input/event# device node gains
exclusive access to this device to caller. It is used mostly for
development purposes and remote control software. See e.g.
https://reviews.freebsd.org/D30020 which is the reason of creation
of this change.
Keyboard grabbing is disabled in KDB and during panics.

MFC with:	4a0db5e292
Tested by:	corvink
Differential revision:	https://reviews.freebsd.org/D30542
2022-11-19 02:54:46 +03:00
Cy Schubert
d487cba33d vmm: Fix non-INVARIANTS build
Reported by:	O. Hartmann <freebsd@walstatt-de.de>
Reviewed by:	jhb
Fixes:		58eefc67a1
Differential Revision:	https://reviews.freebsd.org/D37444
2022-11-18 13:20:13 -08:00
John Baldwin
74ad8d607d csu: Add missing GNU-stack annotations to note object files.
ld.bfd marks the stack as executable for the crt objects due to the
missing annotations which raises a fatal warning starting with version
2.39.
2022-11-18 12:22:23 -08:00
Ed Maste
1f3b4f38a6 Update pkgbase metalog tool README to match installed filename
The pkgbase metalog tool is named metalog_reader.lua.  (One may argue
that a better name could be chosen, but the README should match in any
case.)

Sponsored by:	The FreeBSD Foundation
2022-11-18 15:11:52 -05:00
Mark Johnston
71ebd11738 bhyve: Enable the default compiler warnings
Disable -Wcast-align for now since we have many instances of that
warning (I fixed some but not most of them) and platforms on which bhyve
runs don't particularly care about unaligned accesses.

Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37296
2022-11-18 14:12:51 -05:00
Mark Johnston
0705b7f4e6 bhyve: Avoid using a packed struct for xhci port registers
I believe the __packed annotation is there only because
pci_xhci_portregs_read() is treating the register set as an array of
uint32_t.  clang warns about taking the address of portregs->portsc
because it is a packed member and thus might not have expected
alignment.

Fix the problem by simply selecting the field to read with a switch
statement.  This mimics pci_xhci_portregs_write().  While here, switch
to using some symbolic constants.

There is a small semantic change here in that pci_xhci_portregs_read()
would silently truncate unaligned offsets.  For consistency with
pci_xhci_portregs_write(), which does not do that, return all ones for
unaligned reads instead.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37408
2022-11-18 14:11:48 -05:00
Mark Johnston
c127c61efa bhyve: Let BASL compile with raised warnings
- Make basl_dump() as unused.
- Avoid arithmetic on a void pointer.
- Avoid a signed/unsigned comparison with
  BASL_TABLE_CHECKSUM_LEN_FULL_TABLE.
- Ignore warnings about unused parameters from stuff pulled in by
  acpi.h.  In particular, any prototype wrapped by
  ACPI_DBG_DEPENDENT_RETURN_VOID() will raise such parameters unless
  ACPI_DEBUG_OUTPUT is defined.

Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37397
2022-11-18 14:11:48 -05:00
Mark Johnston
bd634fc733 bhyve: Address an unused parameter warning in the smbios code
The compiler was warning that the "size" parameter to
smbios_generic_initializer() was unused.  This parameter is apparently
used to populate the "maximum structure size" field in the SMBIOS entry
point, but we were always setting it to zero.

Implement it instead in the main loop of the smbios table builder.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37294
2022-11-18 14:11:48 -05:00
Mark Johnston
1a8e52391b bhyve: Disable thread safety analysis
The warnings that arise are bogus and have to be muted with
__no_lock_analysis in most cases.  As a step towards enabling the
default warning level for bhyve, just disable them.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D37295
2022-11-18 14:11:48 -05:00
Mark Johnston
ca6b48f080 vmm: Restore the correct vm_inject_*() prototypes
Fixes:	80cb5d845b ("vmm: Pass vcpu instead of vm and vcpuid...")
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D37443
2022-11-18 14:11:48 -05:00
John Baldwin
49fd5115a9 vmm: Trim some pointless #ifdef KTR.
Reported by:	markj
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37272
2022-11-18 10:25:39 -08:00
John Baldwin
ee98f99d7a vmm: Convert VM_MAXCPU into a loader tunable hw.vmm.maxcpu.
The default is now the number of physical CPUs in the system rather
than 16.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37175
2022-11-18 10:25:39 -08:00
John Baldwin
98568a005a vmm: Allocate vCPUs on first use of a vCPU.
Convert the vcpu[] array in struct vm to an array of pointers and
allocate vCPUs on first use.  This avoids always allocating VM_MAXCPU
vCPUs for each VM, but instead only allocates the vCPUs in use.  A new
per-VM sx lock is added to serialize attempts to allocate vCPUs on
first use.  However, a given vCPU is never freed while the VM is
active, so the pointer is read via an unlocked read first to avoid the
need for the lock in the common case once the vCPU has been created.

Some ioctls need to lock all vCPUs.  To prevent races with ioctls that
want to allocate a new vCPU, these ioctls also lock the sx lock that
protects vCPU creation.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37174
2022-11-18 10:25:38 -08:00
John Baldwin
c0f35dbf19 vmm: Use a cpuset_t for vCPUs waiting for STARTUP IPIs.
Retire the boot_state member of struct vlapic and instead use a cpuset
in the VM to track vCPUs waiting for STARTUP IPIs.  INIT IPIs add
vCPUs to this set, and STARTUP IPIs remove vCPUs from the set.
STARTUP IPIs are only reported to userland for vCPUs that were removed
from the set.

In particular, this permits a subsequent change to allocate vCPUs on
demand when the vCPU may not be allocated until after a STARTUP IPI is
reported to userland.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37173
2022-11-18 10:25:38 -08:00
John Baldwin
223de44c93 vmm devmem_mmap_single: Bump object reference under memsegs lock.
Reported by:	markj
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37273
2022-11-18 10:25:38 -08:00
John Baldwin
67b69e76e8 vmm: Use an sx lock to protect the memory map.
Previously bhyve obtained a "read lock" on the memory map for ioctls
needing to read the map by locking the last vCPU.  This is now
replaced by a new per-VM sx lock.  Modifying the map requires
exclusively locking the sx lock as well as locking all existing vCPUs.
Reading the map requires either locking one vCPU or the sx lock.

This permits safely modifying or querying the memory map while some
vCPUs do not exist which will be true in a future commit.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37172
2022-11-18 10:25:38 -08:00
John Baldwin
08ebb36076 vmm: Destroy mutexes.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37171
2022-11-18 10:25:38 -08:00
John Baldwin
d5118d0fc4 vmm stat: Add a special nelems constant for arrays sized by vCPU count.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37170
2022-11-18 10:25:38 -08:00
John Baldwin
58eefc67a1 vmm vmx: Allocate vpids on demand as each vCPU is initialized.
Compared to the previous version this does mean that if the system as
a whole runs out of dedicated vPIDs you might end up with some vCPUs
within a single VM using dedicated vPIDs and others using shared
vPIDs, but this should not break anything.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37169
2022-11-18 10:25:38 -08:00
John Baldwin
3f0f4b1598 vmm: Lookup vcpu pointers in vmmdev_ioctl.
Centralize mapping vCPU IDs to struct vcpu objects in vmmdev_ioctl and
pass vcpu pointers to the routines in vmm.c.  For operations that want
to perform an action on all vCPUs or on a single vCPU, pass pointers
to both the VM and the vCPU using a NULL vCPU pointer to request
global actions.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37168
2022-11-18 10:25:38 -08:00
John Baldwin
0cbc39d53d vmm ppt: Remove unused vcpu arg from MSI setup handlers.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37167
2022-11-18 10:25:37 -08:00
John Baldwin
e42c24d56b vmm: Remove unused vcpuid argument from vioapic_process_eoi.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37166
2022-11-18 10:25:37 -08:00
John Baldwin
d8be3d523d vmm: Use struct vcpu in the rendezvous code.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37165
2022-11-18 10:25:37 -08:00
John Baldwin
949f0f47a4 vmm: Remove support for vm_rendezvous with a cpuid of -1.
This is not currently used.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37164
2022-11-18 10:25:37 -08:00
John Baldwin
9388bc1e3a vmm: Remove vcpuid from I/O port handlers.
No I/O ports are vCPU-specific (unlike memory which does have
vCPU-specific ranges such as the local APIC).

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37163
2022-11-18 10:25:37 -08:00
John Baldwin
80cb5d845b vmm: Pass vcpu instead of vm and vcpuid to APIs used from CPU backends.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37162
2022-11-18 10:25:37 -08:00