mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 06:51:15 +00:00
vmm: interrupts: clearly separate MsiInterruptGroup and InterruptRoute
MsiInterruptGroup doesn't need to know the internal field names of InterruptRoute. Introduce two helper functions to eliminate references to irq_fd. This is done similarly to the enable and disable helper functions. Also drop the pub keyword from InterruptRoute fields. It is not needed anymore. No functional change. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
db5d42ad41
commit
4ef97d8ddb
@ -19,8 +19,8 @@ use vmm_sys_util::eventfd::EventFd;
|
|||||||
pub type Result<T> = std::io::Result<T>;
|
pub type Result<T> = std::io::Result<T>;
|
||||||
|
|
||||||
struct InterruptRoute {
|
struct InterruptRoute {
|
||||||
pub gsi: u32,
|
gsi: u32,
|
||||||
pub irq_fd: EventFd,
|
irq_fd: EventFd,
|
||||||
registered: AtomicBool,
|
registered: AtomicBool,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,6 +69,14 @@ impl InterruptRoute {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn trigger(&self) -> Result<()> {
|
||||||
|
self.irq_fd.write(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn notifier(&self) -> Option<&EventFd> {
|
||||||
|
Some(&self.irq_fd)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct RoutingEntry<E> {
|
pub struct RoutingEntry<E> {
|
||||||
@ -132,7 +140,7 @@ where
|
|||||||
|
|
||||||
fn trigger(&self, index: InterruptIndex) -> Result<()> {
|
fn trigger(&self, index: InterruptIndex) -> Result<()> {
|
||||||
if let Some(route) = self.irq_routes.get(&index) {
|
if let Some(route) = self.irq_routes.get(&index) {
|
||||||
return route.irq_fd.write(1);
|
return route.trigger();
|
||||||
}
|
}
|
||||||
|
|
||||||
Err(io::Error::new(
|
Err(io::Error::new(
|
||||||
@ -143,7 +151,7 @@ where
|
|||||||
|
|
||||||
fn notifier(&self, index: InterruptIndex) -> Option<&EventFd> {
|
fn notifier(&self, index: InterruptIndex) -> Option<&EventFd> {
|
||||||
if let Some(route) = self.irq_routes.get(&index) {
|
if let Some(route) = self.irq_routes.get(&index) {
|
||||||
return Some(&route.irq_fd);
|
return route.notifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
None
|
None
|
||||||
|
Loading…
Reference in New Issue
Block a user