4 #include <palacios/vmm_types.h>
5 #include <palacios/vmm_device_types.h>
12 struct guest_info *vm;
13 struct vm_device *dev_list;
18 enum access_control {DEVICE_EMULATED, DEVICE_PASSTHROUGH} ;
19 enum access_type {DEVICE_READ, DEVICE_WRITE, DEVICE_READWRITE} ;
21 struct vm_device_io_hook {
22 enum access_control control;
23 enum access_type atype;
27 // Do not touch anything below this
29 struct vm_device_io_hook *next, *prev;
32 struct vm_device_mem_hook {
33 enum access_control control;
34 enum access_type atype;
36 void *guest_physical_start;
37 void *guest_physical_end;
39 // Do not touch anything below this
41 struct vm_device_mem_hook *next, *prev;
47 // Registration of devices
50 // The following device manager functions should only be called
51 // when the guest is stopped
54 int dev_mgr_init(struct vmm_dev_mgr *mgr, struct guest_info *vm);
55 int dev_mgr_deinit(struct vmm_dev_mgr *mgr);
57 int dev_mgr_attach_device(struct guest_info *vm,
58 struct vm_device *device);
59 int dev_mgr_detach_device(struct guest_info *vm,
60 struct vm_device *device);
63 int dev_mgr_hook_io(struct guest_info *vm,
64 struct vm_device *device,
66 enum access_control control,
67 enum access_type atype);
69 int dev_mgr_unhook_io(struct guest_info *vm,
70 struct vm_device *device,
73 int dev_mgr_hook_mem(struct guest_info *vm,
74 struct vm_device *device,
75 void *guest_physical_address_start,
76 void *guest_physical_address_end,
77 enum access_control control,
78 enum access_type atype);
80 int dev_mgr_unhook_mem(struct guest_info *vm,
81 struct vm_device *device,
82 void *guest_physical_address_start,
83 void *guest_physical_address_end);
86 // Strictly a helper - the device is resposible for unhooking on disconnect
89 int dev_mgr_unhook_device(struct guest_info *vm,
90 struct vm_device *device);