Lines Matching +full:add +full:- +full:user +full:- +full:device

3 // SPDX-License-Identifier: Apache-2.0
66 const SNAPSHOT_FILENAME: &str = "memory-ranges";
104 pub fn region(&self) -> &Arc<GuestRegionMmap> { in region()
110 pub fn hotplugged_size(&self) -> u64 { in hotplugged_size()
113 pub fn hugepages(&self) -> bool { in hugepages()
116 pub fn blocks_state(&self) -> &Arc<Mutex<BlocksState>> { in blocks_state()
119 pub fn plugged_ranges(&self) -> MemoryRangeTable { in plugged_ranges()
134 pub fn regions(&self) -> &Vec<Arc<GuestRegionMmap>> { in regions()
137 pub fn virtio_mem_zone(&self) -> &Option<VirtioMemZone> { in virtio_mem_zone()
140 pub fn virtio_mem_zone_mut(&mut self) -> Option<&mut VirtioMemZone> { in virtio_mem_zone_mut()
240 /// Failed to create the user memory region.
241 #[error("Failed to create the user memory region")]
244 /// Failed to remove the user memory region.
245 #[error("Failed to remove the user memory region")]
256 /// Failed to virtio-mem resize
257 #[error("Failed to virtio-mem resize")]
282 /// Failed opening SGX virtual EPC device
284 #[error("Failed opening SGX virtual EPC device")]
292 /// Failed opening SGX provisioning device
294 #[error("Failed opening SGX provisioning device")]
316 /// backed by user defined memory regions.
317 #[error("Impossible to resize guest memory if it is backed by user defined memory regions")]
333 /// No virtio-mem resizing handler found.
334 #[error("No virtio-mem resizing handler found")]
405 // - Reduce the addressable space size by at least 4k to workaround a Linux
407 // - Windows requires the addressable space size to be 64k aligned
408 fn mmio_address_space_size(phys_bits: u8) -> u64 { in mmio_address_space_size()
409 (1 << phys_bits) - (1 << 16) in mmio_address_space_size()
416 fn statfs_get_bsize(path: &str) -> Result<u64, Error> { in statfs_get_bsize()
437 fn memory_zone_get_align_size(zone: &MemoryZoneConfig) -> Result<u64, Error> { in memory_zone_get_align_size()
452 // - `hugepages` is enabled but `hugepage_size` is not specified: in memory_zone_get_align_size()
454 // - The backing file is specified: in memory_zone_get_align_size()
468 fn align_down<T>(val: T, align: T) -> T in align_down()
472 val & !(align - 1u8.into()) in align_down()
476 fn is_aligned<T>(val: T, align: T) -> bool in is_aligned()
480 (val & (align - 1u8.into())) == 0u8.into() in is_aligned()
515 "Unexpected offset for accessing memory manager device: {:#}", in read()
525 fn write(&mut self, _base: u64, offset: u64, data: &[u8]) -> Option<Arc<Barrier>> { in write()
551 "Unexpected offset for accessing memory manager device: {:#}", in write()
567 /// One example might be ram_regions containing 2 regions (0-3G and 4G-6G)
571 /// - First one mapping entirely the first memory zone on 0-1G range
572 /// - Second one mapping partially the second memory zone on 1G-3G range
573 /// - Third one mapping partially the second memory zone on 4G-6G range
575 /// Also, all memory regions are page-size aligned (e.g. their sizes must
576 /// be multiple of page-size), which may leave an additional hole in the
583 ) -> Result<(Vec<Arc<GuestRegionMmap>>, MemoryZones), Error> { in create_memory_regions_from_zones()
595 // Add zone id to the list of memory zones. in create_memory_regions_from_zones()
607 align_down(ram_region.1 as u64 - ram_region_offset, zone_align_size); in create_memory_regions_from_zones()
611 let zone_sub_size = zone.size - zone_offset; in create_memory_regions_from_zones()
654 // Add region to the list of regions associated with the in create_memory_regions_from_zones()
677 // an error as we need unique identifiers. Otherwise, add in create_memory_regions_from_zones()
710 ) -> Result<(Vec<Arc<GuestRegionMmap>>, MemoryZones), Error> { in restore_memory_regions_and_zones()
767 ) -> Result<(), Error> { in fill_saved_regions()
783 // from vm-memory::GuestMemory of read_exact_from() as it is not in fill_saved_regions()
785 // see: https://github.com/rust-vmm/vm-memory/issues/174 in fill_saved_regions()
791 (range.length - offset) as usize, in fill_saved_regions()
808 ) -> Result<(u64, Vec<MemoryZoneConfig>, bool), Error> { in validate_memory_config()
814 "User defined memory regions can't be provided if the \ in validate_memory_config()
851 // us reuse the codepath for user defined memory zones. in validate_memory_config()
869 "User defined memory regions must be provided if the \ in validate_memory_config()
930 pub fn allocate_address_space(&mut self) -> Result<(), Error> { in allocate_address_space()
999 pub fn add_uefi_flash(&mut self) -> Result<(), Error> { in add_uefi_flash()
1000 // On AArch64, the UEFI binary requires a flash device at address 0. in add_uefi_flash()
1038 ) -> Result<Arc<Mutex<MemoryManager>>, Error> { in new()
1049 GuestAddress(mmio_address_space_size - PLATFORM_DEVICE_AREA_SIZE); in new()
1213 ioapic::NUM_IOAPIC_PINS as u32 - X86_64_IRQ_BASE, in new()
1239 // If running on SGX the start of device area and RAM area may diverge but in new()
1297 ) -> Result<Arc<Mutex<MemoryManager>>, Error> { in new_from_snapshot()
1328 fn memfd_create(name: &ffi::CStr, flags: u32) -> Result<RawFd, io::Error> { in memfd_create()
1346 ) -> Result<(), io::Error> { in mbind()
1371 ) -> Result<FileOffset, Error> { in create_anonymous_file()
1406 fn open_backing_file(backing_file: &PathBuf, file_offset: u64) -> Result<FileOffset, Error> { in open_backing_file()
1433 ) -> Result<Arc<GuestRegionMmap>, Error> { in create_ram_region()
1476 // will cut off the last node. That's why we have to add 1 to what in create_ram_region()
1532 let addr = r.as_ptr().add(offset); in create_ram_region()
1566 ) -> Result<u64, Error> { in get_prefault_align_size()
1574 // - `hugepages` is enabled but `hugepage_size` is not specified: in get_prefault_align_size()
1576 // - The backing file is specified: in get_prefault_align_size()
1591 fn get_prefault_num_threads(page_size: usize, num_pages: usize) -> usize { in get_prefault_num_threads()
1614 fn add_region(&mut self, region: Arc<GuestRegionMmap>) -> Result<(), Error> { in add_region()
1629 // (rounded-up) to 128MiB boundary.
1632 fn start_addr(mem_end: GuestAddress, allow_mem_hotplug: bool) -> Result<GuestAddress, Error> { in start_addr()
1634 GuestAddress(mem_end.0 | ((128 << 20) - 1)) in start_addr()
1655 ) -> Result<Arc<GuestRegionMmap>, Error> { in add_ram_region()
1694 fn hotplug_ram_region(&mut self, size: usize) -> Result<Arc<GuestRegionMmap>, Error> { in hotplug_ram_region()
1710 .checked_add((size - 1).try_into().unwrap()) in hotplug_ram_region()
1719 // Add region to the list of regions associated with the default in hotplug_ram_region()
1742 pub fn guest_memory(&self) -> GuestMemoryAtomic<GuestMemoryMmap> { in guest_memory()
1746 pub fn boot_guest_memory(&self) -> GuestMemoryMmap { in boot_guest_memory()
1750 pub fn allocator(&self) -> Arc<Mutex<SystemAllocator>> { in allocator()
1754 pub fn start_of_device_area(&self) -> GuestAddress { in start_of_device_area()
1758 pub fn end_of_device_area(&self) -> GuestAddress { in end_of_device_area()
1762 pub fn memory_slot_allocator(&mut self) -> MemorySlotAllocator { in memory_slot_allocator()
1768 pub fn allocate_memory_slot(&mut self) -> u32 { in allocate_memory_slot()
1780 ) -> Result<u32, Error> { in create_userspace_mapping()
1792 "Creating userspace mapping: {:x} -> {:x} {:x}, slot {}", in create_userspace_mapping()
1840 "Created userspace mapping: {:x} -> {:x} {:x}", in create_userspace_mapping()
1854 ) -> Result<(), Error> { in remove_userspace_mapping()
1860 false, /* readonly -- don't care */ in remove_userspace_mapping()
1895 "Removed userspace mapping: {:x} -> {:x} {:x}", in remove_userspace_mapping()
1902 pub fn virtio_mem_resize(&mut self, id: &str, size: u64) -> Result<(), Error> { in virtio_mem_resize()
1916 error!("Failed resizing virtio-mem region: No virtio-mem handler"); in virtio_mem_resize()
1923 error!("Failed resizing virtio-mem region: Unknown memory zone"); in virtio_mem_resize()
1928 /// guest memory, the new region is returned to the caller. The virtio-mem
1931 pub fn resize(&mut self, desired_ram: u64) -> Result<Option<Arc<GuestRegionMmap>>, Error> { in resize()
1934 "Not allowed to resize guest memory when backed with user \ in resize()
1948 self.virtio_mem_resize(DEFAULT_MEMORY_ZONE, desired_ram - self.boot_ram)?; in resize()
1959 Some(self.hotplug_ram_region((desired_ram - self.current_ram) as usize)?); in resize()
1967 pub fn resize_zone(&mut self, id: &str, virtio_mem_size: u64) -> Result<(), Error> { in resize_zone()
1980 pub fn setup_sgx(&mut self, sgx_epc_config: Vec<SgxEpcConfig>) -> Result<(), Error> { in setup_sgx()
1997 if epc_section.size & (SGX_PAGE_SIZE - 1) != 0 { in setup_sgx()
2004 // Place the SGX EPC region on a 4k boundary between the RAM and the device area in setup_sgx()
2033 // We can't use the vm-memory crate to perform the memory mapping in setup_sgx()
2036 // device does not work that way, it provides a file descriptor in setup_sgx()
2053 "Could not add SGX EPC section (size 0x{:x})", in setup_sgx()
2090 pub fn sgx_epc_region(&self) -> &Option<SgxEpcRegion> { in sgx_epc_region()
2094 pub fn is_hardlink(f: &File) -> bool { in is_hardlink()
2107 pub fn memory_zones(&self) -> &MemoryZones { in memory_zones()
2111 pub fn memory_zones_mut(&mut self) -> &mut MemoryZones { in memory_zones_mut()
2118 ) -> std::result::Result<MemoryRangeTable, MigratableError> { in memory_range_table()
2134 // that can be accessed by the user, and additionally in memory_range_table()
2139 // as we can assume the user will have it saved through in memory_range_table()
2156 pub fn snapshot_data(&self) -> MemoryManagerSnapshotData { in snapshot_data()
2171 pub fn memory_slot_fds(&self) -> HashMap<u32, RawFd> { in memory_slot_fds()
2187 pub fn acpi_address(&self) -> Option<GuestAddress> { in acpi_address()
2191 pub fn num_guest_ram_mappings(&self) -> u32 { in num_guest_ram_mappings()
2196 pub fn uefi_flash(&self) -> GuestMemoryAtomic<GuestMemoryMmap> { in uefi_flash()
2201 pub fn coredump_memory_regions(&self, mem_offset: u64) -> CoredumpMemoryRegions { in coredump_memory_regions()
2225 ) -> std::result::Result<(), GuestDebuggableError> { in coredump_iterate_save_mem()
2246 (range.length - offset) as usize, in coredump_iterate_save_mem()
2266 ) -> std::result::Result<(), MigratableError> in receive_memory_regions()
2277 // from vm-memory::GuestMemory of read_exact_from() as it is not in receive_memory_regions()
2279 // see: https://github.com/rust-vmm/vm-memory/issues/174 in receive_memory_regions()
2285 (range.length - offset) as usize, in receive_memory_regions()
2326 aml::Device::new( in to_aml_bytes()
2333 Bit [0] – Set if the device is present. in to_aml_bytes()
2334 Bit [1] – Set if the device is enabled and decoding its resources. in to_aml_bytes()
2335 Bit [2] – Set if the device should be shown in the UI. in to_aml_bytes()
2336 … Bit [3] – Set if the device is functioning properly (cleared if device failed its diagnostics). in to_aml_bytes()
2344 // Call into MSTA method which will interrogate device in to_aml_bytes()
2385 // Add "MTFY" notification method in to_aml_bytes()
2415 // Notify device if it is in to_aml_bytes()
2428 // Notify device if it is (with the eject constant 0x3) in to_aml_bytes()
2435 &aml::Add::new(&aml::Local(0), &aml::Local(0), &aml::ONE), in to_aml_bytes()
2522 &aml::Add::new( in to_aml_bytes()
2527 &aml::Add::new( in to_aml_bytes()
2534 vec![&aml::Add::new( in to_aml_bytes()
2554 aml::Device::new( in to_aml_bytes()
2567 acpi_address.0 + MEMORY_MANAGER_ACPI_SIZE as u64 - 1, in to_aml_bytes()
2634 aml::Device::new( in to_aml_bytes()
2650 let max = min + sgx_epc_region.size() - 1; in to_aml_bytes()
2652 aml::Device::new( in to_aml_bytes()
2693 fn id(&self) -> String { in id()
2697 fn snapshot(&mut self) -> result::Result<Snapshot, MigratableError> { in snapshot()
2721 ) -> result::Result<(), MigratableError> { in send()
2743 // from vm-memory::GuestMemory of write_all_to() as it is not in send()
2745 // see: https://github.com/rust-vmm/vm-memory/issues/174 in send()
2751 (range.length - offset) as usize, in send()
2770 fn start_dirty_log(&mut self) -> std::result::Result<(), MigratableError> { in start_dirty_log()
2782 fn stop_dirty_log(&mut self) -> std::result::Result<(), MigratableError> { in stop_dirty_log()
2792 fn dirty_log(&mut self) -> std::result::Result<MemoryRangeTable, MigratableError> { in dirty_log()