devices: virtio: pci: reset ISR status on read

The virtio PCI spec (4.1.4.5.1 Device Requirements: ISR status
capability) says:

  "The device MUST reset ISR status to 0 on driver read."

BUG=chromium:854766
TEST=None

Change-Id: I92a1ddccfc8e44bed7f4a16e3cfd11b946629e22
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1260252
Reviewed-by: Dylan Reid <dgreid@chromium.org>
This commit is contained in:
Daniel Verkamp 2018-10-03 16:50:28 -07:00 committed by chrome-bot
parent cf2e00e982
commit 1232debf1d

View file

@ -349,7 +349,8 @@ impl PciDevice for VirtioPciDevice {
}
o if ISR_CONFIG_BAR_OFFSET <= o && o < ISR_CONFIG_BAR_OFFSET + ISR_CONFIG_SIZE => {
if let Some(v) = data.get_mut(0) {
*v = self.interrupt_status.load(Ordering::SeqCst) as u8;
// Reading this register resets it to 0.
*v = self.interrupt_status.swap(0, Ordering::SeqCst) as u8;
}
}
o if DEVICE_CONFIG_BAR_OFFSET <= o