void vtd_cell_exit(struct cell *cell) { const struct jailhouse_pci_device *dev = jailhouse_cell_pci_devices(cell->config); unsigned int n; for (n = 0; n < cell->config->num_pci_devices; n++) { vtd_remove_device_from_cell(cell, &dev[n]); if (!vtd_return_device_to_root_cell(&dev[n])) printk("WARNING: Failed to re-assign PCI device to " "root cell\n"); } vtd_flush_domain_caches(cell->id); vtd_flush_domain_caches(root_cell.id); page_free(&mem_pool, cell->vtd.pg_structs.root_table, 1); }
void vtd_root_cell_shrink(struct jailhouse_cell_desc *config) { const struct jailhouse_pci_device *dev = jailhouse_cell_pci_devices(config); unsigned int n; vtd_init_fault_nmi(); for (n = 0; n < config->num_pci_devices; n++) vtd_remove_device_from_cell(&root_cell, &dev[n]); vtd_flush_domain_caches(root_cell.id); }
void vtd_linux_cell_shrink(struct jailhouse_cell_desc *config) { const struct jailhouse_memory *mem = jailhouse_cell_mem_regions(config); const struct jailhouse_pci_device *dev = jailhouse_cell_pci_devices(config); unsigned int n; for (n = 0; n < config->num_memory_regions; n++, mem++) if (mem->access_flags & JAILHOUSE_MEM_DMA) page_map_destroy(linux_cell.vtd.page_table, mem->phys_start, mem->size, dmar_pt_levels, PAGE_MAP_COHERENT); for (n = 0; n < config->num_pci_devices; n++) vtd_remove_device_from_cell(&linux_cell, &dev[n]); vtd_flush_domain_caches(linux_cell.id); }