Lines Matching refs:pv
7 assert(pfn <= ctx->x86.pv.max_pfn); in pfn_to_mfn()
9 return xc_pfn_to_mfn(pfn, ctx->x86.pv.p2m, ctx->x86.pv.width); in pfn_to_mfn()
21 unsigned long old_max = ctx->x86.pv.max_pfn, i; in expand_p2m()
22 unsigned int fpp = PAGE_SIZE / ctx->x86.pv.width; in expand_p2m()
31 p2msz = (max_pfn + 1) * ctx->x86.pv.width; in expand_p2m()
32 p2m = realloc(ctx->x86.pv.p2m, p2msz); in expand_p2m()
38 ctx->x86.pv.p2m = p2m; in expand_p2m()
41 pfn_types = realloc(ctx->x86.pv.restore.pfn_types, pfn_typesz); in expand_p2m()
47 ctx->x86.pv.restore.pfn_types = pfn_types; in expand_p2m()
50 p2m_pfns = realloc(ctx->x86.pv.p2m_pfns, p2m_pfnsz); in expand_p2m()
56 ctx->x86.pv.p2m_frames = end_frame; in expand_p2m()
57 ctx->x86.pv.p2m_pfns = p2m_pfns; in expand_p2m()
59 ctx->x86.pv.max_pfn = max_pfn; in expand_p2m()
67 ctx->x86.pv.p2m_pfns[i] = INVALID_MFN; in expand_p2m()
82 for ( i = nr_pins = 0; i <= ctx->x86.pv.max_pfn; ++i ) in pin_pagetables()
84 if ( (ctx->x86.pv.restore.pfn_types[i] & in pin_pagetables()
88 switch ( (ctx->x86.pv.restore.pfn_types[i] & in pin_pagetables()
141 pfn = GET_FIELD(vcpu, user_regs.edx, ctx->x86.pv.width); in process_start_info()
143 if ( pfn > ctx->x86.pv.max_pfn ) in process_start_info()
149 if ( ctx->x86.pv.restore.pfn_types[pfn] != XEN_DOMCTL_PFINFO_NOTAB ) in process_start_info()
152 (ctx->x86.pv.restore.pfn_types[pfn] >> in process_start_info()
165 SET_FIELD(vcpu, user_regs.edx, mfn, ctx->x86.pv.width); in process_start_info()
175 pfn = GET_FIELD(guest_start_info, store_mfn, ctx->x86.pv.width); in process_start_info()
176 if ( pfn > ctx->x86.pv.max_pfn ) in process_start_info()
191 SET_FIELD(guest_start_info, store_mfn, mfn, ctx->x86.pv.width); in process_start_info()
193 ctx->restore.xenstore_evtchn, ctx->x86.pv.width); in process_start_info()
196 pfn = GET_FIELD(guest_start_info, console.domU.mfn, ctx->x86.pv.width); in process_start_info()
197 if ( pfn > ctx->x86.pv.max_pfn ) in process_start_info()
212 SET_FIELD(guest_start_info, console.domU.mfn, mfn, ctx->x86.pv.width); in process_start_info()
214 ctx->restore.console_evtchn, ctx->x86.pv.width); in process_start_info()
218 ctx->x86.pv.max_pfn + 1, ctx->x86.pv.width); in process_start_info()
220 ctx->dominfo.shared_info_frame << PAGE_SHIFT, ctx->x86.pv.width); in process_start_info()
221 SET_FIELD(guest_start_info, flags, 0, ctx->x86.pv.width); in process_start_info()
239 vcpu_guest_context_any_t *vcpu = ctx->x86.pv.restore.vcpus[vcpuid].basic.ptr; in process_vcpu_basic()
254 GET_FIELD(vcpu, flags, ctx->x86.pv.width) | VGCF_online, in process_vcpu_basic()
255 ctx->x86.pv.width); in process_vcpu_basic()
257 gdt_count = GET_FIELD(vcpu, gdt_ents, ctx->x86.pv.width); in process_vcpu_basic()
270 pfn = GET_FIELD(vcpu, gdt_frames[i], ctx->x86.pv.width); in process_vcpu_basic()
271 if ( pfn > ctx->x86.pv.max_pfn ) in process_vcpu_basic()
277 if ( (ctx->x86.pv.restore.pfn_types[pfn] != XEN_DOMCTL_PFINFO_NOTAB) ) in process_vcpu_basic()
280 (ctx->x86.pv.restore.pfn_types[pfn] >> in process_vcpu_basic()
293 SET_FIELD(vcpu, gdt_frames[i], mfn, ctx->x86.pv.width); in process_vcpu_basic()
297 pfn = cr3_to_mfn(ctx, GET_FIELD(vcpu, ctrlreg[3], ctx->x86.pv.width)); in process_vcpu_basic()
298 if ( pfn > ctx->x86.pv.max_pfn ) in process_vcpu_basic()
304 if ( (ctx->x86.pv.restore.pfn_types[pfn] & in process_vcpu_basic()
306 (((xen_pfn_t)ctx->x86.pv.levels) << XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) in process_vcpu_basic()
309 (ctx->x86.pv.restore.pfn_types[pfn] >> in process_vcpu_basic()
311 ctx->x86.pv.levels); in process_vcpu_basic()
323 SET_FIELD(vcpu, ctrlreg[3], mfn_to_cr3(ctx, mfn), ctx->x86.pv.width); in process_vcpu_basic()
326 if ( ctx->x86.pv.levels == 4 && (vcpu->x64.ctrlreg[1] & 1) ) in process_vcpu_basic()
330 if ( pfn > ctx->x86.pv.max_pfn ) in process_vcpu_basic()
336 if ( (ctx->x86.pv.restore.pfn_types[pfn] & in process_vcpu_basic()
338 (((xen_pfn_t)ctx->x86.pv.levels) << XEN_DOMCTL_PFINFO_LTAB_SHIFT) ) in process_vcpu_basic()
341 (ctx->x86.pv.restore.pfn_types[pfn] >> in process_vcpu_basic()
343 ctx->x86.pv.levels); in process_vcpu_basic()
378 &ctx->x86.pv.restore.vcpus[vcpuid]; in process_vcpu_extended()
402 &ctx->x86.pv.restore.vcpus[vcpuid]; in process_vcpu_xsave()
440 &ctx->x86.pv.restore.vcpus[vcpuid]; in process_vcpu_msrs()
480 for ( i = 0; i < ctx->x86.pv.restore.nr_vcpus; ++i ) in update_vcpu_context()
482 vcpu = &ctx->x86.pv.restore.vcpus[i]; in update_vcpu_context()
533 for ( i = 0; i < ctx->x86.pv.p2m_frames; ++i ) in update_guest_p2m()
535 pfn = ctx->x86.pv.p2m_pfns[i]; in update_guest_p2m()
537 if ( pfn > ctx->x86.pv.max_pfn ) in update_guest_p2m()
544 if ( (ctx->x86.pv.restore.pfn_types[pfn] != XEN_DOMCTL_PFINFO_NOTAB) ) in update_guest_p2m()
547 (ctx->x86.pv.restore.pfn_types[pfn] >> in update_guest_p2m()
560 ctx->x86.pv.p2m_pfns[i] = mfn; in update_guest_p2m()
564 ctx->x86.pv.p2m_pfns, in update_guest_p2m()
565 ctx->x86.pv.p2m_frames); in update_guest_p2m()
572 memcpy(guest_p2m, ctx->x86.pv.p2m, in update_guest_p2m()
573 (ctx->x86.pv.max_pfn + 1) * ctx->x86.pv.width); in update_guest_p2m()
578 munmap(guest_p2m, ctx->x86.pv.p2m_frames * PAGE_SIZE); in update_guest_p2m()
607 if ( ctx->x86.pv.restore.seen_pv_info ) in handle_x86_pv_info()
631 if ( info->guest_width != ctx->x86.pv.width ) in handle_x86_pv_info()
657 if ( (info->guest_width != ctx->x86.pv.width) || in handle_x86_pv_info()
658 (info->pt_levels != ctx->x86.pv.levels) ) in handle_x86_pv_info()
662 ctx->x86.pv.width, ctx->x86.pv.levels); in handle_x86_pv_info()
666 ctx->x86.pv.restore.seen_pv_info = true; in handle_x86_pv_info()
679 unsigned int start, end, x, fpp = PAGE_SIZE / ctx->x86.pv.width; in handle_x86_pv_p2m_frames()
699 if ( !ctx->x86.pv.restore.seen_pv_info ) in handle_x86_pv_p2m_frames()
731 if ( data->end_pfn > ctx->x86.pv.max_pfn ) in handle_x86_pv_p2m_frames()
739 ctx->x86.pv.p2m_pfns[start + x] = data->p2m_pfns[x]; in handle_x86_pv_p2m_frames()
808 if ( vhdr->vcpu_id >= ctx->x86.pv.restore.nr_vcpus ) in handle_x86_pv_vcpu_blob()
811 rec_name, vhdr->vcpu_id, ctx->x86.pv.restore.nr_vcpus - 1); in handle_x86_pv_vcpu_blob()
815 vcpu = &ctx->x86.pv.restore.vcpus[vhdr->vcpu_id]; in handle_x86_pv_vcpu_blob()
822 size_t vcpusz = ctx->x86.pv.width == 8 ? in handle_x86_pv_vcpu_blob()
888 if ( !ctx->x86.pv.restore.seen_pv_info ) in handle_shared_info()
911 MEMCPY_FIELD(guest_shinfo, old_shinfo, vcpu_info, ctx->x86.pv.width); in handle_shared_info()
912 MEMCPY_FIELD(guest_shinfo, old_shinfo, arch, ctx->x86.pv.width); in handle_shared_info()
915 0, ctx->x86.pv.width); in handle_shared_info()
917 MEMSET_ARRAY_FIELD(guest_shinfo, evtchn_pending, 0, ctx->x86.pv.width); in handle_shared_info()
920 0, ctx->x86.pv.width); in handle_shared_info()
922 MEMSET_ARRAY_FIELD(guest_shinfo, evtchn_mask, 0xff, ctx->x86.pv.width); in handle_shared_info()
936 return pfn <= ctx->x86.pv.max_pfn; in x86_pv_pfn_is_valid()
943 assert(pfn <= ctx->x86.pv.max_pfn); in x86_pv_set_page_type()
945 ctx->x86.pv.restore.pfn_types[pfn] = type; in x86_pv_set_page_type()
952 assert(pfn <= ctx->x86.pv.max_pfn); in x86_pv_set_gfn()
954 if ( ctx->x86.pv.width == sizeof(uint64_t) ) in x86_pv_set_gfn()
956 ((uint64_t *)ctx->x86.pv.p2m)[pfn] = mfn == INVALID_MFN ? ~0ULL : mfn; in x86_pv_set_gfn()
959 ((uint32_t *)ctx->x86.pv.p2m)[pfn] = mfn; in x86_pv_set_gfn()
1063 ctx->x86.pv.restore.nr_vcpus = ctx->dominfo.max_vcpu_id + 1; in x86_pv_setup()
1064 ctx->x86.pv.restore.vcpus = calloc(sizeof(struct xc_sr_x86_pv_restore_vcpu), in x86_pv_setup()
1065 ctx->x86.pv.restore.nr_vcpus); in x86_pv_setup()
1066 if ( !ctx->x86.pv.restore.vcpus ) in x86_pv_setup()
1156 free(ctx->x86.pv.p2m); in x86_pv_cleanup()
1157 free(ctx->x86.pv.p2m_pfns); in x86_pv_cleanup()
1159 if ( ctx->x86.pv.restore.vcpus ) in x86_pv_cleanup()
1163 for ( i = 0; i < ctx->x86.pv.restore.nr_vcpus; ++i ) in x86_pv_cleanup()
1166 &ctx->x86.pv.restore.vcpus[i]; in x86_pv_cleanup()
1174 free(ctx->x86.pv.restore.vcpus); in x86_pv_cleanup()
1177 free(ctx->x86.pv.restore.pfn_types); in x86_pv_cleanup()
1179 if ( ctx->x86.pv.m2p ) in x86_pv_cleanup()
1180 munmap(ctx->x86.pv.m2p, ctx->x86.pv.nr_m2p_frames * PAGE_SIZE); in x86_pv_cleanup()