conf: Mark vchiq as depending on fdt
Fix an ACPI only kernel by only building the vchiq files when FDT is
enabled.
Fixes: 745c4aa5e8f0 ("Make BRCM2837 port conform FreeBSD/ARM64 guidelines")
Sponsored by: Arm Ltd
arm64: Remove gicv3_get_support_lpis
It's no longer used after moving to gic_get_support_lpis.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53665
arm64: Switch to gic_get_support_lpis in gicv3_its
The old gicv3_get_support_lpis will be removed.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53664
arm64: Move intr_pic_init_secondary earlier
This may have been called after intr_irq_shuffle. For most interrupt
controllers this appears to be safe, however for the GICv5 we need to
read a per-CPU ID register before we can assign interrupts to a given
CPU.
Fix the race by moving intr_pic_init_secondary earlier in the boot,
after devices have been enumerated and before the interrupts are moved
to their assigned CPUs.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53685
arm/gic: Make GICV3_IVAR_SUPPORT_LPIS generic
GICv5 will need this too, so move to the GIC_IVAR namespace.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53663
arm: Handle GIC_IVAR_VGIC in the gic driver
We don't have a GICv2 vgic so can just return 0.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53662
arm64: Add non-PCI MSI support
Add the arm64 parts to support for non-PCI MSI and MSI-X interrupts.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53331
dev/fdt: Add support for non-PCI MSI interrupts
Some non-PCI devices can send interrupts, e.g. the Arm SMMU or GICv5
Interrupt Wire Bridge. Add support for these by implementing pci_get_id
and pci_alloc_msi and the MSI/MSI-X parts of the PCIB interface.
Only the MSI parts of the PCI interface are added as that is all I am
able to test.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53330
dev/ofw: Teach ofw_cpu to find the pcpu on arm64
Use the midr value to ensure we find the correct PCPU pointer on arm64.
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D53327
rc.subr: Support setting the audit user when starting services
When an unprivileged user restarts a service using, e.g., sudo, the
service runs with the audit user ID set to that of the unprivileged
user. This can have surprising effects: for instance, a user that
restarts a jail that is running sshd will end up with their UID attached
to all audit logs associated with users who log in via that sshd
instance. (sshd will set the audit user, but this is disallowed in
jails by default.)
Add support for rc.conf directives which cause rc to override the audit
user. Specifically, make <name>_audit_user=foo cause the audit user to
be set to "foo" for service <name>. A plain audit_user=foo directive
causes all services to be started as foo.
Note, like other similar rc features, this feature is limited to rc
services which are run by executing a command. Shell functions can't be
wrapped this way.
[5 lines not shown]
rc.subr: Remove misguided cpuset usage
When running an rc command, if the target rc script defines
<command>_cmd, e.g., start_cmd=..., then the run_rc_command() executes
that instead of $command. In general it's a shell function, and
"cpuset -l <n> <shell function>" doesn't work.
Moreover, it doesn't really make sense to run cpuset for anything other
than start_cmd.
Other optional isolation mechanisms (e.g., <name>_fib,
<name>_chroot) are only used when invoking $command directly as part of
the "start" command. Make <name>_cpuset consistent with everything else
by removing these extraneous cpuset invocations.
Reviewed by: 0mp
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53746
kevent: Hold the knlist mutex when invoking f_event(NOTE_FORK)
In general f_event is supposed to be called with the knlist mutex held,
so lock it earlier to follow this protocol. Also make sure that the
update to kn_fflags is synchronized.
Lock the kqueue itself earlier in the case where the knote is activated,
to avoid locking and unlocking the kqueue twice.
PR: 291005
Reported by: Qiu-ji Chen <chenqiuji666 at gmail.com>
Reviewed by: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D53762
rc.subr: Try to make svjc option handling a bit easier to read
Specifically, make this code fit in fewer columns:
- deindent cases to conform to the usual style,
- use a local variable to minimize duplication in each case.
No functional change intended.
Reviewed by: 0mp, netchild
MFC after: 2 weeks
Sponsored by: Klara, Inc.
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D53754
setaudit: Add an update mode
By default, setaudit(8) overwrites the whole audit session state. For
the purpose of overwriting only a single field, e.g., the audit user,
this is inconvenient. Add -U to accomodate this case: when specified,
setaudit(8) will first fetch the current session state block and then
will only overwrite those fields specified on the command line.
Reviewed by: csjp
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53672
TCP Pacing system (HPTS) is missing an API
Recent changes to HPTS have broken an API that was somehow removed (used by user space programs for
time calculations). This commit will add back the inline function that was removed.
Differential Revision:<https://reviews.freebsd.org/D53225>
vmm: Move vm_maxcpu handling into MI code
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
(cherry picked from commit c46e5dc65ba5c9666bb4452878e332dc49730843)
arm64/vmm: Move the vgic_max_cpu_count() check
vm_alloc_vcpu() is called quite frequently, and we don't need to apply
the vgic limit unless we're actually allocating a vcpu structure for the
first time.
No functional change intended.
Reviewed by: andrew
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53580
(cherry picked from commit f3a7ed2047dffaebbfbb3920e993e9df424be728)
vmm: Consolidate VM name length checking
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
(cherry picked from commit 7377c87e467343e71b3e803708b98e04ea8e84bd)
vmm: Move the module load handler to vmm_dev.c
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
(cherry picked from commit e758074458df3b61773b7678ff47c4a835365d21)
amd64/vmm: Factor vcpu_notify_event() into two functions
vcpu_notify_event() previously took a boolean parameter which determines
whether the implementation should try to use a posted interrupt. On
arm64 and riscv, the implementation of vcpu_notify_event() is otherwise
identical to that of amd64.
With the aim of deduplicating vcpu state management code, introduce a
separate amd64-only function which tries to use posted interrupts. This
requires some duplication with vcpu_notify_event_locked(), but only a
little bit.
Then, fix up callers. No functional change intended.
Reviewed by: corvink, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53419
[2 lines not shown]
vmm: Simplify the VM_ALLOC_MEMSEG ioctl a bit
We can free the mask earlier, simplifying some error paths. No
functional change intended.
Reviewed by: corvink, jhb, emaste
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D53418
(cherry picked from commit c3f41c02c9a5bf45504af59c351f0ae336719753)
multicast tests: Run in VNET jails
The tests themselves create identically named jails, resulting in
spurious failures when the tests are run in parallel.
MFC after: 1 week
(cherry picked from commit b3b279b801d571919c8bbd5de4325d8819ffd59a)
diff3: Remove bespoke getopt.h
diff3's getopt.h included a function declaration without a prototype,
which produces a compiler warning. Just remove the bespoke getopt.h
and use the system header.
Reported by: Mark Millard
Reviewed by: fuz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53802
geom_zero.4: Document
PR: 250593
Reviewed by: bcr, ziaee
Thanks to: imp, markj
MFC after: 1 week
Fixes: 3843eba85d98 Add unmapped BIO support to GEOM ZERO
Fixes: 24e1fdcd1a69 Allow to specify the byte which will be used for filling read buffer
Fixes: 565bc101112c Add a very simple and small GEOM class - ZERO
(cherry picked from commit 39acb7fd86eda721df402c2f1368b78cede161c3)