bhyvectl: support querying VM pid
Extend bhyvectl(8) to support querying VM pid using the
`--get-vm-pid` flag.
This is useful in monitor mode when the VM pid differs
from the main bhyve(8) process run by the user. Knowing the VM pid
is necessary, for example, to query process resource usage or
trigger ACPI shutdown with SIGTERM.
Of course, it could be obtained by matching the monitor process
children by the process title, but it's a little more complex
and fragile than it could be.
Implement that by adding the "get_vm_pid" IPC command,
and using it to implement `bhyvectl --get-vm-pid`, which
prints the VM PID.
When the VM PID is not known, ESRCH is returned.
[4 lines not shown]
UPDATING: bump __FreeBSD_version to 1501503 for LinuxKPI changes
The size of multiple embedded structs have changed and may lead to
problems (pci_error_handlers in pci_driver, dev_pm_info in struct device).
Allow these changes to be detected by bumping __FreeBSD_version.
(cherry picked from commit e1ad124136deb4f270d4cef759bf9e9debdb17d3)
LinuxKPI: 802.11: Always lock around lkpi_80211_mo_{remove_interface,stop}()
Add the missing locking to another two MO driver downcalls, as drivers
always expect it (e.g. rtw89 by assertion).
Add the lock and might_sleep assertions to the respective lkpi_80211_mo_*
downcalls.
PR: 298417
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D59608
(cherry picked from commit 73166d21bd831db264509cbdce1ab3b63ab5b189)
LinuxKPI: add can_wakeup option and accessor functions
We can implement device_set_wakeup_capable() in the !CONFIG_PM_SLEEP
case; we do not have the infrastructure in place for the CONFIG_PM_SLEEP
case so leave a pr_debug TODO.
Needed by an upcoming wireless driver.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58883
(cherry picked from commit a424fb3519ebf8fb972e7ba45ba19df322992b00)
LinuxKPI: add PCI_IRQ_AFFINITY #define
Add the #define for PCI_IRQ_AFFINITY and leave a pr_debug note in
pci_alloc_irq_vectors() that it is unimplemented.
The flag is needed by an upcoming WiFi driver.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58881
(cherry picked from commit b589e403a2c3bd2a94fb2ab88cd23255c68a9f05)
LinuxKPI: implement dma_{alloc,free}_{noncoherent,attrs}
We use one to implement the other given direction stays unused.
This is needed by an upcoming wifi driver.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58880
(cherry picked from commit c3fa17a6a331db8aad03e9cb89ba97e1811ab381)
LinuxKPI: fix argument type to lkpi_pci_msi_desc_alloc()
lkpi_pci_msi_desc_alloc() takes an unsigned int, not an int.
While here make sure the prototype is visibile in interrupt.h as
well before use to avoid -Wimplicit-function-declaration errors.
Discovered while working on a wireless driver.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58879
(cherry picked from commit cfb23b01e269e8a0a84066637b82b746f01b46b4)
LinuxKPI: pci: add pci_select_bars() and pci_msix_vec_count()
For pci_select_bars() we use the LinuxKPI internal information, while
for pci_select_bars() we fall back to the native PCI stack.
Needed by a wifi driver.
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D58878
(cherry picked from commit 55c07af60172b211116be47010fc0831aafc99e8)
LinuxKPI: add #include of rculist.h to ethtool.h for Linux conformance
Add #include rculist.h to ethtool.h to fullfill expectations of
Linux drivers without having to modify them.
Reviewed by: dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D58874
(cherry picked from commit 4570a1bf760a3cd63eb7dd9e3ebbc3cf103bda4d)
mlx5: remove init_timer()
The init_timer() was there from day one in (dc7e38ac4da50). It was
never needed as the setup_timer() below already did more than just
that part of the job.
This is part of trying to clear up the Linux pre-4.15 timer KPI
from LinuxKPI.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D59681
(cherry picked from commit 3769ee9bc4167d4f508ba4f14cf544dedf7c520e)
LinuxKPI: rcu: add optional condition to list_for_each_entry_rcu()
list_for_each_entry_rcu() can take an optional condition. Add the
macro argument so code remains compiling but do not do anything with
it just yet.
Leave comments as list_for_each_entry_rcu() likely should have a
different implementation.
Sponsored by: The FreeBSD Foundation
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D59292
(cherry picked from commit e975ce86ff11a330128f5b21c7cd11c28d3aff87)
mlx4: convert to timer_setup() Linux KPI
The Linux driver switched away from using this timer in e22979d96a55d.
Locally adjust the code to use timer_setup/from_timer in order to get
us out of Linux version 4.15 (and earlier) KPIs.
Also, right away, apply 41cb08555c416 from_timer -> timer_container_of.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D59680
(cherry picked from commit 871c09c9b47eb0ef0f17a5a1fc2299dba7693516)