| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
Reviewed by: jmg
Sponsored by: Juniper Networks
Differential Revision: https://reviews.freebsd.org/D53390
|
| |
|
|
|
|
|
|
|
|
|
| |
* Enable RANDOM_ENABLE_TPM by default
* The commit of TPM_HARVEST failed to add it to NOTES
so that the LINT kernel would build the code.
Fixes: 4ee7d3b0118c82e651712bb65da53d08e78cd7b1
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D53460
|
| |
|
|
|
|
|
|
|
|
| |
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53477
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vm_create() is only called from one place. Rather than having similar
checks everywhere, move them to vmmdev_create().
We can safely assume that the name is nul-terminated, the vmmctl ioctl
handler and the legacy sysctl handler ensure this. So, don't bother
with strnlen().
Finally, make sure that the name buffers are the same size on all
platforms. VM_MAX_NAMELEN is supposed to be the maximum, not including
the nul terminator.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53422
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the vmm_initialized check out of vm_create() and into the legacy
sysctl handler. If vmm_initialized is false, /dev/vmmctl will not be
available and so cannot be used to create VMs.
Introduce new MD vmm_modinit() and vmm_modcleanup() routines which
handle MD (de)initialization.
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53421
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
aplic_max_cpu_count() just returns the VM's max vCPU count, and
vm_alloc_vcpu() already checks that. Just remove this check so that
it's easier to merge vm_alloc_vcpu() into MI code.
If the APLIC really does require us to lower the limit, we should
instead adjust vm->maxcpu in vm_create().
No functional change intended.
Reviewed by: br
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53496
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The contents of the memory is an output, but the pointer to that memory
is an input. This was correct in the original version of D45697, but
when adding appropriate clobbers, the pointer operand was incorrectly
switched to an output rather than left an input for fpe_store.
Reviewed by: jrtc27
Obtained from: CheriBSD
Fixes: 44d4ee7f3dad ("riscv: add FPE code.")
MFC after: 1 day
Sponsored by: AFRL, DARPA
Differential Revision: https://reviews.freebsd.org/D53441
|
| |
|
|
|
|
|
|
| |
kexec hasn't been ported to these architectures, yet, so appease the
build with dummy headers.
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D51625
|
| |
|
|
|
|
|
|
|
|
|
| |
Make the ioctl handlers easy to read by moving local variables into
per-ioctl blocks. No functional change intended.
Reviewed by: corvink, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53145
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On non-amd64 platforms, check for negative register indices. This isn't
required today since we match against individual register indices, but
we might as well check it. On amd64, add a comment explaining why we
permit negative register indices.
Use mallocarray() for allocating register arrays in the ioctl layer.
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53143
|
| |
|
|
|
|
|
|
|
|
| |
These are known to work if loaded manually by loader(8) (for the Nezha
board at least). If nothing else, it is useful to provide a DTB closely
tied to the kernel version.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53118
|
| |
|
|
|
|
|
|
|
|
| |
These are known to work if loaded manually by loader(8) (for VF2 at
least). If nothing else, it is useful to provide a DTB closely tied to
the kernel version.
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53117
|
| |
|
|
|
|
|
|
|
| |
No functional change intended.
Reviewed by: kib
MFC after: 10 days
MFC with: 80336636b6b9f7a3bdad007c400e85eae017d2a2
Differential Revision: https://reviews.freebsd.org/D53173
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
vm_smp_rendezvous() invokes a callback on all vCPUs, blocking the
initiator until all vCPUs have responded. vcpu_lock_all() blocks each
vCPU by waiting for it to go idle and setting the vCPU state to frozen.
These two operations can deadlock on each other, particularly when
booting a Windows guest, when vcpu_lock_all() blocks waiting for a
rendezvous initiator, and the initiator is blocked waiting for the vCPU
thread which called vcpu_lock_all() to invoke the rendezvous callback.
Implement vcpu_lock_all() in a way that avoids deadlocks with
vm_smp_rendezvous(). In particular, when traversing vCPUs, invoke the
rendezvous callback on the vCPU's behalf to help the initiator finish.
We can only safely do so when the vCPU is IDLE or we have already locked
it, otherwise we may be racing with the target vCPU thread. Thus:
- Use an exclusive lock to serialize vcpu_lock_all() callers, which lets
us lock vCPUs out of order without fear of deadlock with parallel
vcpu_lock_all() callers.
- If a rendezvous is pending, lock all idle vCPUs and invoke the
callback on their behalf. If the vcpu_lock_all() caller is itself a
vCPU thread, this will handle that thread.
- Block waiting for all non-idle vCPUs to idle, or until one of them
initiates a rendezvous, in which case we go back and invoke callbacks
on behalf of already-locked vCPUs.
Note that on !amd64 no changes are needed since there is no rendezvous
mechanism, so there is a separate vcpu_set_state_all() for them based on
the previous vcpu_lock_all(). These will be merged together once vcpu
state handling is consolidated into sys/dev/vmm.
Reviewed by: corvink (previous version)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D52968
|
| |
|
|
|
|
|
|
|
|
| |
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53013
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This further consolidates handling of guest memory into MI code in
sys/dev/vmm.
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53012
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- On amd64, make vmmops_* functions globally visible, as some will be
called from machine-independent code in the future.
- On arm64 and riscv, move declarations to vmm.h, since they're supposed
to be generic across different VMM backends (only amd64 has more than
one backend).
- Make the declaration macros consistent with each other.
- On amd64, make the function typedef names consistent with the
corresponding ifunc names.
No functional change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53011
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Different vmm implementations were freeing the per-vCPU structure in
different places. Make the implementations consistent. No functional
change intended.
Reviewed by: corvink
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53010
|
| |
|
|
|
|
|
| |
This makes non-GENERIC kernel configs easier to maintain.
Requested by: glebius
MFC after: 2 days
|
| |
|
|
|
|
|
| |
Reviewed by: jrtc27, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D52626
|
| |
|
|
|
|
|
|
|
|
| |
These functions are stubs that do nothing but are called by some software
and not providing them results in implicit function declaration errors.
This was missed in D25740.
Reviewed by: #riscv, mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D52035
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Otherwise we don't do anything to kick vcpu threads out of a sleep
state when destroying a VM. For instance, suppose a guest executes hlt
on amd64 or wfi on arm64 with interrupts disabled. Then,
bhyvectl --destroy will hang until the vcpu thread somehow comes out of
vm_handle_hlt()/vm_handle_wfi() since destroy_dev() is waiting for vCPU
threads to drain.
Note that on amd64, if hw.vmm.halt_detection is set to 1 (the default),
the guest will automatically exit in this case since it's treated as a
shutdown. But, the above should not hang if halt_detection is set to 0.
Here, vm_suspend() wakes up vcpu threads, and a subsequent attempt to
run the vCPU will result in an error which gets propagated to userspace,
allowing destroy_dev() to proceed.
Add a new suspend code for this purpose. Modify bhyve to exit with
status 4 ("exited due to an error") when it's received, since that's
what'll happen generally when the VM is destroyed asynchronously.
Reported by: def
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D51761
|
| |
|
|
|
|
|
|
|
|
|
| |
This commit updates the driver code to conform with an undocumented
convention which says that certain functions need always be implemented
together regardless of their content (or lack of). It's been said that
unimplemented KOBJ methods become stubs which return ENXIO so this
commit does not imply a functional change.
Reviewed by: mhorne
Differential Revision: https://reviews.freebsd.org/D52042
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While FIDO/U2F keys were already supported by the generic uhid(4) and
hidraw(4) drivers, this driver adds some additional features an does
steps to tighten the security of FIDO/U2F access.
- It automatically loads through devd.
- Automatically enables HQ_NO_READAHEAD for FIDO/U2F devices.
- Implements only miminum set of features.
- Do not requires external devfs configuration to set character device
permissions.
- Names character device as u2f/# to make possible capsicum or any
other pledge()-style sandboxing.
PR: 265528
Differential Revision: https://reviews.freebsd.org/D51612
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Since gpiobus_attach_bus can attach the gpiobus child along with its
children in the same bus pass, the parent controller's reference to
gpiobus might not be set by the time the children need it. Instead,
drivers should use gpiobus_add_bus and explicitly call
bus_attach_children.
Reviewed by: mmel, imp (older version)
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D51578
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
More fallout from a77e1f0f81df.
When the tag has an alignment requirement but a small (remaining)
transfer size, the transfer will be rounded up to exceed its bounds,
resulting in memory corruption.
The issue is observed on powerpc as noted in the pull request:
https://github.com/freebsd/freebsd-src/pull/1415
I also observe the issue locally on riscv hardware, with an 8-byte
transfer having 64-byte alignment.
There is some uncertainty about the purpose/need for the alignment
roundup; both its original intention and present effect. Notably, it is
no longer present at all in arm/arm64 implementations. Possibly, this
roundup can be removed altogether, but this requires more careful
analysis of the edge-cases and history of the property.
For now, simply clamp sgsize to be no larger than the remaining buflen,
as this is certain to be correct within the current scheme and fixes
the affected transfers.
Discussed with: jhb, markj
MFC after: 3 weeks
Fixes: a77e1f0f81df ("busdma: better handling of small segment bouncing")
Sponsored by: The FreeBSD Foundation
Pull Request: https://github.com/freebsd/freebsd-src/pull/1415
Signed-off-by: Chattrapat Sangmanee <aomsin27@hotmail.co.th>
Co-authored-by: Chattrapat Sangmanee <aomsin27@hotmail.co.th>
Differential Revision: https://reviews.freebsd.org/D47807
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
JH7110 has two PCIE controller devices. First one is used by board's
integrated USB which has no driver. Switching PHY to USB mode is not
currently implemented. This functionality could be added in a form of a
separate PCIE PHY driver if needed. PHY is on by default and there's no
need to switch it on.
Pre/post_ithread and post_filter methods are not used for interrupt
masking since they are meant for level-triggered interrupts whereas
JH7110's MSI interrupts are edge triggered (and INTx interrupts do not
use this irqsrc scheme at all). Pre_ithread method is nevertheless used
for MSI bottom acking.
The driver has been tested with Kingston SNV2S NVME SSD The
functionality of INTx and MSI interrupts (as opposed to default MSIx)
has been tested by forcing NVME to use them.
Reviewed by: mhorne
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D47919
|
| |
|
|
|
|
|
|
|
| |
Basic functionality implemented; fdt_pinctrl interface to be added in
the future.
Reviewed by: mhorne
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D43034
|
| |
|
|
|
| |
Reviewed by: br, jrtc27
Differential Revision: https://reviews.freebsd.org/D48533
|
| |
|
|
|
|
|
|
| |
This patch adds support for the cvitek reboot controller.
This controller is present on the Milk-V riscv SoCs.
Reviewed by: br, mhorne, jrtc27
Differential review: https://reviews.freebsd.org/D48532
|
| |
|
|
|
|
|
|
|
| |
This patch adds support for the cvitek reset controller.
This controller is present on the Milk-V riscv SoCs. The controller is
currently only used by the if_dwc driver.
Differential Revision: https://reviews.freebsd.org/D48531
Reviewed by: jrtc27, br
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This change adds the necessary kernelspace bits required for
supporting NUMA domains in bhyve VMs.
The layout of system memory segments and how they're created has
been reworked. Each guest NUMA domain will now have its own memory
segment. Furthermore, this change allows users to tweak the domain's
backing vm_object domainset(9) policy.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D44565
|
| |
|
|
|
|
|
| |
For the Allwinner D1.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D51198
|
| |
|
|
|
|
|
|
|
|
|
|
| |
For 32-bit arm, move the no-op test that was already in place at start
of the function so that it stays first even if the '#if 0' block around
the call to sf_buf_invalidate_cache() is uncommented at some point (if
ever).
Reviewed by: jeffpc_josefsipek.net, kib
MFC after: 10 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51253
|
| |
|
|
|
|
|
| |
Somehow dropped during a rebase. This actually enables the driver.
Fixes: d88bc5f943a9 ("riscv: enable allwinner RTC")
Sponsored by: The FreeBSD Foundation
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
At shutdown devices may need to do extra work to clean up state, etc.
This is done in a device_shutdown kobj method on a driver, with the
default being a `do nothing` method. Only x86's nexus driver includes
the device_shutdown method to propagate down to its children, so on
other architectures the device_shutdown stops at the root, and thus
device_shutdown is never called for any real devices. Add this missing
method to the nexus drivers of the other architectures so devices have a
chance to properly shutdown.
Sponsored by: Juniper Networks, Inc.
|
| |
|
|
|
|
| |
Reviewed by: imp, jhb
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D50913
|
| |
|
|
|
|
|
| |
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D47935
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The 'runq' machinery now depends on only two settable parameters,
RQ_MAX_PRIO, the maximum priority number that can be accepted, the
minimum being 0, and RQ_PPQ, the number of priorities per queue (to
reduce the number of queues).
All other parameters are deduced from these ones. Also, all
architectures automatically get a runq word that is their natural word.
RQB_FFS() always was 'ffsl() - 1' except for amd64 where it was
'bsfq()'. Now that all these finally call compiler builtins, the
resulting assembly code is the same, so there is no cost to removing
this special case.
After all these changes, <machine/runq.h> headers have no more purpose,
so remove them.
While here, fix potentially confusing parameter name for RQB_WORD() and
RQB_BIT().
While here, include all necessary headers so that <sys/runq.h> can be
included standalone.
No functional change (intended).
Reviewed by: kib
MFC after: 1 month
Event: Kitchener-Waterloo Hackathon 202506
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45387
|
| |
|
|
|
|
|
|
|
|
|
| |
After the demise of vm_page_lock(), the only remaining uses of
pa_index() are in various pmap implementations. In many cases, e.g.,
amd64, the pmap implementations already provided their own definitions,
often identical to the machine-independent one. For those that didn't
provide one, this change adds it.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D50823
|
| |
|
|
|
| |
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
|
| |
|
|
|
|
|
|
|
| |
We only create the static devmap on arm. Stop building this code on
other architectures.
Reviewed by: mhorne, imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50016
|
| |
|
|
|
| |
Reviewed-by: Warner Losh <imp@FreeBSD.org>
Pull-Request: https://github.com/freebsd/freebsd-src/pull/1674
|
| |
|
|
|
|
|
|
|
|
|
|
| |
CBO represents a subset of Cache-Management Operations (CMO) spec.
While the CMO spec encompasses all operations on caches, the CBO subset
operates on cache blocks only.
Detect Zicbom, Zicboz and Zicbop extensions and provide cache invalidation
handlers based on Zicbom instructions.
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D49852
|
| |
|
|
|
|
|
|
| |
Change architecture-specific code to use iterators rather than tailq
pointers.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D49928
|
| |
|
|
|
|
|
|
|
|
| |
We were checking the wrong status bit when deciding whether to enable
interrupts.
Reviewed by: jrtc27
Fixes: c226f193515c ("riscv: Permit spurious faults in kernel mode")
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D49897
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
OpenSBI uses the first PMP entry to prevent buggy supervisor
software from overwriting the firmware [1]. However, this
region may not be properly marked as reserved in the EFI map, leading
to an access violation exception whenever the kernel
attempts to write to a page from that region.
Fix this by preemptively excluding first EFI memory map entry
if it is marked as "BootServicesData".
[1] https://github.com/riscv-non-isa/riscv-sbi-doc/pull/37
Reported by: tuexen
Tested by: tuexen
Fixes: a2e2178402af
Reviewed by: imp, jrtc27
Differential Revision: https://reviews.freebsd.org/D49839
|
| |
|
|
|
|
|
|
|
|
| |
efi_map_header is similar to, but not at all the same as the UEFI
EFI_MEMORY_ATTRIBUTES_TABLE (we could easily have used the latter
though, with one fewer non-standard types, but we can't change
it easily now due to the last 10 years of boot loaders passing
this in).
Sponsored by: Netflix
|
| |
|
|
|
|
|
|
| |
This means we can remove the fixed mem_regions array.
Reviewed by: imp
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D49700
|
| |
|
|
|
|
|
|
|
| |
Found on the VisionFive v2 SBC, and similar.
Reviewed by: mhorne
Tested by: mhorne
Discussed with: sos
Differential Revision: https://reviews.freebsd.org/D45600
|