mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: ivshmem: handle short BAR0 register reads
BAR0 can technially be read with 1 or 2 byte MMIO. Don't panic in that case. Signed-off-by: Dylan Reid <dgreid@fb.com>
This commit is contained in:
@@ -10,7 +10,6 @@ use std::sync::atomic::{AtomicU32, Ordering};
|
|||||||
use std::sync::{Arc, Barrier, Mutex};
|
use std::sync::{Arc, Barrier, Mutex};
|
||||||
|
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use byteorder::{ByteOrder, LittleEndian};
|
|
||||||
use log::{debug, error, warn};
|
use log::{debug, error, warn};
|
||||||
use pci::{
|
use pci::{
|
||||||
BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable,
|
BarReprogrammingParams, PCI_CONFIGURATION_ID, PciBarConfiguration, PciBarPrefetchable,
|
||||||
@@ -335,8 +334,8 @@ impl PciDevice for IvshmemDevice {
|
|||||||
match bar_idx {
|
match bar_idx {
|
||||||
// bar 0
|
// bar 0
|
||||||
0 => {
|
0 => {
|
||||||
// ivshmem don't use interrupt, we return zero now.
|
// ivshmem doesn't use an interrupt, we return zero now.
|
||||||
LittleEndian::write_u32(data, 0);
|
data.fill(0);
|
||||||
}
|
}
|
||||||
// bar 2
|
// bar 2
|
||||||
1 => warn!("Unexpected read ivshmem memory idx: {offset}"),
|
1 => warn!("Unexpected read ivshmem memory idx: {offset}"),
|
||||||
|
|||||||
Reference in New Issue
Block a user