mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2024-11-24 20:48:55 +00:00
devices: interrupt: add simple resample
Instead of coupling the reading of the event fd and the resampling of the interrupt, add a separate member to just do the resample. This will be used by async code that waits for and reads the event fd in one step. Change-Id: Ic5b1fd9adf8e32a572f31dc1c0c5ab32e94f4981 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2268978 Commit-Queue: Dylan Reid <dgreid@chromium.org> Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
parent
5b09409f59
commit
95f1bca33a
1 changed files with 7 additions and 1 deletions
|
@ -72,9 +72,15 @@ impl Interrupt {
|
|||
self.signal(self.config_msix_vector, INTERRUPT_STATUS_CONFIG_CHANGED)
|
||||
}
|
||||
|
||||
/// Handle interrupt resampling event
|
||||
/// Handle interrupt resampling event, reading the value from the event and doing the resample.
|
||||
pub fn interrupt_resample(&self) {
|
||||
let _ = self.interrupt_resample_evt.read();
|
||||
self.do_interrupt_resample();
|
||||
}
|
||||
|
||||
/// Read the status and write to the interrupt event. Don't read the resample event, assume the
|
||||
/// resample has been requested.
|
||||
pub fn do_interrupt_resample(&self) {
|
||||
if self.interrupt_status.load(Ordering::SeqCst) != 0 {
|
||||
self.interrupt_evt.write(1).unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue