3838#include <sel4vm/guest_irq_controller.h>
3939
4040#include <sel4vmmplatsupport/drivers/virtio_con.h>
41-
42- #include <sel4vmmplatsupport/arch/vusb.h>
43- #include <sel4vmmplatsupport/arch/vpci.h>
4441#include <sel4vmmplatsupport/guest_image.h>
45- #include <sel4vmmplatsupport/drivers/pci_helper.h>
46- #include <sel4vmmplatsupport/drivers/cross_vm_connection.h>
42+ #include <sel4vmmplatsupport/arch/vusb.h>
4743#include <sel4vmmplatsupport/arch/guest_boot_init.h>
4844#include <sel4vmmplatsupport/arch/guest_reboot.h>
4945#include <sel4vmmplatsupport/arch/guest_vcpu_fault.h>
@@ -97,7 +93,6 @@ allocman_t *allocman;
9793seL4_CPtr _fault_endpoint ;
9894irq_server_t * _irq_server ;
9995
100- vmm_pci_space_t * pci ;
10196vmm_io_port_list_t * io_ports ;
10297reboot_hooks_list_t reboot_hooks_list ;
10398
@@ -687,17 +682,6 @@ extern vmm_module_t __stop__vmm_module[];
687682
688683static int install_vm_devices (vm_t * vm , const vm_config_t * vm_config )
689684{
690- int err ;
691-
692- /* Install virtual devices */
693- if (config_set (CONFIG_VM_PCI_SUPPORT )) {
694- err = vm_install_vpci (vm , io_ports , pci );
695- if (err ) {
696- ZF_LOGE ("Failed to install VPCI device" );
697- return -1 ;
698- }
699- }
700-
701685 int max_vmm_modules = (int )(__stop__vmm_module - __start__vmm_module );
702686 int num_vmm_modules = 0 ;
703687 for (vmm_module_t * i = __start__vmm_module ; i < __stop__vmm_module ; i ++ ) {
@@ -707,7 +691,6 @@ static int install_vm_devices(vm_t *vm, const vm_config_t *vm_config)
707691 }
708692
709693 return 0 ;
710-
711694}
712695
713696static int route_irq (int irq_num , vm_vcpu_t * vcpu , irq_server_t * irq_server )
@@ -875,22 +858,11 @@ static int vm_dtb_finalize(vm_t *vm, const vm_config_t *vm_config)
875858 assert (vm_config -> generate_dtb );
876859
877860 if (config_set (CONFIG_VM_PCI_SUPPORT )) {
878- /* Modules can add PCI devices, so the PCI device tree node can be
879- * created only after all modules have been set up.
880- */
881- int gic_offset = fdt_path_offset (fdt_ori , GIC_NODE_PATH );
882- if (gic_offset < 0 ) {
883- ZF_LOGE ("Failed to find gic node from path: %s" , GIC_NODE_PATH );
884- return -1 ;
885- }
886- int gic_phandle = fdt_get_phandle (fdt_ori , gic_offset );
887- if (0 == gic_phandle ) {
888- ZF_LOGE ("Failed to find phandle in gic node" );
889- return -1 ;
890- }
891- int err = fdt_generate_vpci_node (vm , pci , gen_dtb_buf , gic_phandle );
861+ extern int vpci_update_dtb (vm_t * vm , const vm_config_t * vm_config , void * dtb ,
862+ void * fdt , char const * gic_node );
863+ int err = vpci_update_dtb (vm , vm_config , gen_dtb_buf , fdt_ori , GIC_NODE_PATH );
892864 if (err ) {
893- ZF_LOGE ("Couldn't generate vpci_node (%d)" , err );
865+ ZF_LOGE ("Couldn't generate VPCI device tree node (%d)\n " , err );
894866 return -1 ;
895867 }
896868 }
@@ -1191,12 +1163,6 @@ static int main_continued(void)
11911163 return -1 ;
11921164 }
11931165
1194- err = vmm_pci_init (& pci );
1195- if (err ) {
1196- ZF_LOGE ("Failed to initialise vmm pci" );
1197- return err ;
1198- }
1199-
12001166 err = vmm_io_port_init (& io_ports , FREE_IOPORT_START );
12011167 if (err ) {
12021168 ZF_LOGE ("Failed to initialise VM ioports" );
0 commit comments