MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / read_bar

Method read_bar

pci/src/vfio.rs:1225–1245  ·  view source on GitHub ↗
(&mut self, base: u64, offset: u64, data: &mut [u8])

Source from the content-addressed store, hash-verified

1223 }
1224
1225 pub(crate) fn read_bar(&mut self, base: u64, offset: u64, data: &mut [u8]) {
1226 let addr = base + offset;
1227 if let Some(region) = self.find_region(addr) {
1228 let offset = addr - region.start.raw_value();
1229
1230 if self.interrupt.msix_table_accessed(region.index, offset) {
1231 self.interrupt.msix_read_table(offset, data);
1232 } else {
1233 self.vfio_wrapper.region_read(region.index, offset, data);
1234 }
1235 }
1236
1237 // INTx EOI
1238 // The guest reading from the BAR potentially means the interrupt has
1239 // been received and can be acknowledged.
1240 if self.interrupt.intx_in_use()
1241 && let Err(e) = self.vfio_wrapper.unmask_irq(VFIO_PCI_INTX_IRQ_INDEX)
1242 {
1243 error!("Failed unmasking INTx IRQ: {e}");
1244 }
1245 }
1246
1247 pub(crate) fn write_bar(
1248 &mut self,

Callers 1

readMethod · 0.45

Calls 6

find_regionMethod · 0.80
msix_table_accessedMethod · 0.80
msix_read_tableMethod · 0.80
intx_in_useMethod · 0.80
region_readMethod · 0.45
unmask_irqMethod · 0.45

Tested by

no test coverage detected