1 2 #ifndef __XEN_DOMAIN_H__ 3 #define __XEN_DOMAIN_H__ 4 5 #include <xen/types.h> 6 7 #include <public/xen.h> 8 #include <asm/domain.h> 9 #include <asm/numa.h> 10 11 typedef union { 12 struct vcpu_guest_context *nat; 13 struct compat_vcpu_guest_context *cmp; 14 } vcpu_guest_context_u __attribute__((__transparent_union__)); 15 16 struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id); 17 18 unsigned int dom0_max_vcpus(void); 19 struct vcpu *alloc_dom0_vcpu0(struct domain *dom0); 20 21 int vcpu_reset(struct vcpu *); 22 int vcpu_up(struct vcpu *v); 23 24 void setup_system_domains(void); 25 26 struct xen_domctl_getdomaininfo; 27 void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info); 28 void arch_get_domain_info(const struct domain *d, 29 struct xen_domctl_getdomaininfo *info); 30 int xenctl_bitmap_to_bitmap(unsigned long *bitmap, 31 const struct xenctl_bitmap *xenctl_bitmap, 32 unsigned int nbits); 33 34 /* 35 * Arch-specifics. 36 */ 37 38 /* Allocate/free a domain structure. */ 39 struct domain *alloc_domain_struct(void); 40 void free_domain_struct(struct domain *d); 41 42 /* Allocate/free a VCPU structure. */ 43 struct vcpu *alloc_vcpu_struct(const struct domain *d); 44 void free_vcpu_struct(struct vcpu *v); 45 46 /* Allocate/free a PIRQ structure. */ 47 #ifndef alloc_pirq_struct 48 struct pirq *alloc_pirq_struct(struct domain *); 49 #endif 50 void free_pirq_struct(void *); 51 52 /* 53 * Initialise/destroy arch-specific details of a VCPU. 54 * - arch_vcpu_create() is called after the basic generic fields of the 55 * VCPU structure are initialised. Many operations can be applied to the 56 * VCPU at this point (e.g., vcpu_pause()). 57 * - arch_vcpu_destroy() is called only if arch_vcpu_create() previously 58 * succeeded. 59 */ 60 int arch_vcpu_create(struct vcpu *v); 61 void arch_vcpu_destroy(struct vcpu *v); 62 63 int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset); 64 void unmap_vcpu_info(struct vcpu *v); 65 66 int arch_domain_create(struct domain *d, 67 struct xen_domctl_createdomain *config); 68 69 void arch_domain_destroy(struct domain *d); 70 71 void arch_domain_shutdown(struct domain *d); 72 void arch_domain_pause(struct domain *d); 73 void arch_domain_unpause(struct domain *d); 74 75 int arch_domain_soft_reset(struct domain *d); 76 77 void arch_domain_creation_finished(struct domain *d); 78 79 void arch_p2m_set_access_required(struct domain *d, bool access_required); 80 81 int arch_set_info_guest(struct vcpu *, vcpu_guest_context_u); 82 void arch_get_info_guest(struct vcpu *, vcpu_guest_context_u); 83 84 int arch_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); 85 int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg); 86 87 int domain_relinquish_resources(struct domain *d); 88 89 void dump_pageframe_info(struct domain *d); 90 91 void arch_dump_vcpu_info(struct vcpu *v); 92 93 void arch_dump_domain_info(struct domain *d); 94 95 int arch_vcpu_reset(struct vcpu *); 96 97 bool_t domctl_lock_acquire(void); 98 void domctl_lock_release(void); 99 100 /* 101 * Continue the current hypercall via func(data) on specified cpu. 102 * If this function returns 0 then the function is guaranteed to run at some 103 * point in the future. If this function returns an error code then the 104 * function has not been and will not be executed. 105 */ 106 int continue_hypercall_on_cpu( 107 unsigned int cpu, long (*func)(void *data), void *data); 108 109 /* 110 * Companion to continue_hypercall_on_cpu(), to feed func()'s result back into 111 * vcpu regsiter state. 112 */ 113 void arch_hypercall_tasklet_result(struct vcpu *v, long res); 114 115 extern unsigned int xen_processor_pmbits; 116 117 extern bool_t opt_dom0_vcpus_pin; 118 extern cpumask_t dom0_cpus; 119 extern bool dom0_affinity_relaxed; 120 121 /* vnuma topology per domain. */ 122 struct vnuma_info { 123 unsigned int nr_vnodes; 124 unsigned int nr_vmemranges; 125 unsigned int *vdistance; 126 unsigned int *vcpu_to_vnode; 127 nodeid_t *vnode_to_pnode; 128 struct xen_vmemrange *vmemrange; 129 }; 130 131 void vnuma_destroy(struct vnuma_info *vnuma); 132 133 #endif /* __XEN_DOMAIN_H__ */ 134