mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-25 05:03:05 +00:00
crosvm: Add KVM_SIGNAL_MSI ioctl.
This ioctl is necessary for a userspace IOAPIC. TEST=Built BUG=chromium:908689 Change-Id: I52fc96baef2193e4f673bbce17a1b56ded9aa6a6 Reviewed-on: https://chromium-review.googlesource.com/1515992 Commit-Ready: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: Miriam Zimmerman <mutexlox@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
7374f32ba4
commit
49f071ad4f
1 changed files with 14 additions and 0 deletions
|
@ -941,6 +941,20 @@ impl Vm {
|
|||
cap.args[0] = 24;
|
||||
self.kvm_enable_cap(&cap)
|
||||
}
|
||||
|
||||
/// Request that the kernel inject the specified MSI message.
|
||||
/// Returns Ok(true) on delivery, Ok(false) if the guest blocked delivery, or an error.
|
||||
/// See kernel documentation for KVM_SIGNAL_MSI.
|
||||
pub fn signal_msi(&self, msi: &kvm_msi) -> Result<bool> {
|
||||
// safe becuase we allocated the struct and we know the kernel will read
|
||||
// exactly the size of the struct
|
||||
let ret = unsafe { ioctl_with_ref(self, KVM_SIGNAL_MSI(), msi) };
|
||||
if ret < 0 {
|
||||
errno_result()
|
||||
} else {
|
||||
Ok(ret > 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AsRawFd for Vm {
|
||||
|
|
Loading…
Reference in a new issue