virtio-devices: handle IO event for SevSnp properly

For SevSnp guest IO events are handled by GHCB protocol.
While we get the notification we have to notify via eventfd.

Signed-off-by: Muminul Islam <muislam@microsoft.com>
This commit is contained in:
Muminul Islam 2024-02-13 10:42:23 -08:00 committed by Bo Chen
parent ef4fbf086f
commit 3d5718bd87

View File

@ -1179,7 +1179,14 @@ impl PciDevice for VirtioPciDevice {
o if (NOTIFICATION_BAR_OFFSET..NOTIFICATION_BAR_OFFSET + NOTIFICATION_SIZE) o if (NOTIFICATION_BAR_OFFSET..NOTIFICATION_BAR_OFFSET + NOTIFICATION_SIZE)
.contains(&o) => .contains(&o) =>
{ {
#[cfg(feature = "sev_snp")]
for (_event, _addr) in self.ioeventfds(_base) {
if _addr == _base + offset {
_event.write(1).unwrap();
}
}
// Handled with ioeventfds. // Handled with ioeventfds.
#[cfg(not(feature = "sev_snp"))]
error!("Unexpected write to notification BAR: offset = 0x{:x}", o); error!("Unexpected write to notification BAR: offset = 0x{:x}", o);
} }
o if (MSIX_TABLE_BAR_OFFSET..MSIX_TABLE_BAR_OFFSET + MSIX_TABLE_SIZE).contains(&o) => { o if (MSIX_TABLE_BAR_OFFSET..MSIX_TABLE_BAR_OFFSET + MSIX_TABLE_SIZE).contains(&o) => {