x86: remove PVHv1
cover x86: remove PVHv1
Hello,
This patch series removes the PVHv1 code, both from the hypervisor and the tools, and also gets rid of the has_hvm_container_{domain/vcpu} macro, since from Xen's point of view there are only two types of guests: PV or HVM.
Last patch is a minor code movement to have all the domain build PVH related functions together.
Thanks, Roger.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 1/3 x86: remove PVHv1 code
This removal applies to both the hypervisor and the toolstack side of PVHv1.
Note that on the toolstack side there's one hiccup: on xl the "pvh" configuration option is translated to builder="hvm", device_model_version="none". This is done because otherwise xl would start parsing PV like options, and filling the PV struct at libxl_domain_build_info (which in turn pollutes the HVM one because it's a union).
---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>
Cc: Elena Ufimtseva <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Paul Durrant <[email protected]>
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Razvan Cojocaru <[email protected]>
Cc: Tamas K Lengyel <[email protected]>
--- docs/man/xl.cfg.pod.5.in | 10 +- docs/misc/pvh-readme.txt | 63 --------- tools/debugger/gdbsx/xg/xg_main.c | 4 +- tools/libxc/include/xc_dom.h | 1 - tools/libxc/include/xenctrl.h | 2 +- tools/libxc/xc_cpuid_x86.c | 13 +- tools/libxc/xc_dom_core.c | 9 -- tools/libxc/xc_dom_x86.c | 49 +++---- tools/libxc/xc_domain.c | 1 - tools/libxl/libxl_create.c | 31 ++-- tools/libxl/libxl_dom.c | 1 - tools/libxl/libxl_internal.h | 1 - tools/libxl/libxl_x86.c | 7 +- tools/xl/xl_cmdimpl.c | 10 +- xen/arch/x86/cpu/vpmu.c | 3 +- xen/arch/x86/cpuid.c | 211 ++++++++++++++-------------- xen/arch/x86/domain.c | 42 +----- xen/arch/x86/domain_build.c | 287 +------------------------------------- xen/arch/x86/domctl.c | 7 +- xen/arch/x86/hvm/hvm.c | 81 +---------- xen/arch/x86/hvm/hypercall.c | 4 +- xen/arch/x86/hvm/io.c | 2 - xen/arch/x86/hvm/ioreq.c | 3 +- xen/arch/x86/hvm/irq.c | 3 - xen/arch/x86/hvm/vmx/vmcs.c | 35 +---- xen/arch/x86/hvm/vmx/vmx.c | 12 +- xen/arch/x86/mm.c | 2 +- xen/arch/x86/mm/p2m-pt.c | 2 +- xen/arch/x86/mm/p2m.c | 6 +- xen/arch/x86/physdev.c | 8 -- xen/arch/x86/setup.c | 7 - xen/arch/x86/time.c | 27 ---- xen/common/domain.c | 2 - xen/common/domctl.c | 10 -- xen/common/kernel.c | 5 - xen/common/vm_event.c | 8 +- xen/include/asm-x86/domain.h | 1 - xen/include/asm-x86/hvm/hvm.h | 3 - xen/include/public/domctl.h | 12 +- xen/include/xen/sched.h | 9 +- 40 files changed, 196 insertions(+), 798 deletions(-) delete mode 100644 docs/misc/pvh-readme.txt
docs/man/xl.cfg.pod.5.in +6 -4
@@ -1064,6 +1064,12 @@ FIFO-based event channel ABI support up to 131,071 event channels. Other guests are limited to 4095 (64-bit x86 and ARM) or 1023 (32-bit x86). +=item B<pvh=BOOLEAN> + +Selects whether to run this PV guest in an HVM container. Default is 0. +Note that this option is equivalent to setting builder="hvm" and +device_model_version="none" + =back =head2 Paravirtualised (PV) Guest Specific Options
@@ -1108,10 +1114,6 @@ if your particular guest kernel does not require this behaviour then it is safe to allow this to be enabled but you may wish to disable it anyway. -=item B<pvh=BOOLEAN> - -Selects whether to run this PV guest in an HVM container. Default is 0. - =back =head2 Fully-virtualised (HVM) Guest Specific Options
docs/misc/pvh-readme.txt deleted +0 -63
63 lines not on this page · raw message
tools/debugger/gdbsx/xg/xg_main.c +1 -3
@@ -79,7 +79,6 @@ int xgtrc_on = 0;struct xen_domctl domctl;/* just use a global domctl */ static int _hvm_guest;/* hvm guest? 32bit HVMs have 64bit context */ -static int _pvh_guest;/* PV guest in HVM container */ static domid_t _dom_id;/* guest domid */ static int _max_vcpu_id;/* thus max_vcpu_id+1 VCPUs */ static int _dom0_fd;/* fd of /dev/privcmd */
@@ -308,7 +307,6 @@ xg_attach(int domid, int guest_bitness) _max_vcpu_id = domctl.u.getdomaininfo.max_vcpu_id; _hvm_guest = (domctl.u.getdomaininfo.flags & XEN_DOMINF_hvm_guest); - _pvh_guest = (domctl.u.getdomaininfo.flags & XEN_DOMINF_pvh_guest);return _max_vcpu_id; }
@@ -369,7 +367,7 @@ _change_TF(vcpuid_t which_vcpu, int guest_bitness, int setit)int sz =sizeof (anyc);/* first try the MTF for hvm guest. otherwise do manually */ -if (_hvm_guest || _pvh_guest) { +if (_hvm_guest) { domctl.u.debug_op.vcpu = which_vcpu; domctl.u.debug_op.op = setit ?XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_ON :XEN_DOMCTL_DEBUG_OP_SINGLE_STEP_OFF ;
tools/libxc/include/xc_dom.h +0 -1
@@ -164,7 +164,6 @@ struct xc_dom_image {domid_t console_domid;domid_t xenstore_domid;xen_pfn_t shared_info_mfn; -int pvh_enabled;xc_interface *xch;domid_t guest_domid;
tools/libxc/include/xenctrl.h +1 -1
@@ -443,7 +443,7 @@ typedef struct xc_dominfo {uint32_t ssidref; unsigned int dying:1, crashed:1, shutdown:1, paused:1, blocked:1, running:1, - hvm:1, debugged:1, pvh:1, xenstore:1, hap:1; + hvm:1, debugged:1, xenstore:1, hap:1;unsigned int shutdown_reason;/* only meaningful if shutdown==1 */ unsigned long nr_pages;/* current number, not maximum */ unsigned long nr_outstanding_pages;
tools/libxc/xc_cpuid_x86.c +4 -9
@@ -167,7 +167,6 @@ struct cpuid_domain_info } vendor;bool hvm; -bool pvh;uint64_t xfeature_mask;uint32_t *featureset;
@@ -231,7 +230,6 @@ static int get_cpuid_domain_info(xc_interface *xch, domid_t domid,return -ESRCH ; info->hvm = di.hvm; - info->pvh = di.pvh; info->featureset =calloc (host_nr_features,sizeof (*info->featureset));if ( !info->featureset )
@@ -682,13 +680,10 @@ static void sanitise_featureset(struct cpuid_domain_info *info)clear_bit (X86_FEATURE_SYSCALL , info->featureset); } -if ( !info->pvh ) - { -clear_bit (X86_FEATURE_PSE , info->featureset); -clear_bit (X86_FEATURE_PSE36 , info->featureset); -clear_bit (X86_FEATURE_PGE , info->featureset); -clear_bit (X86_FEATURE_PAGE1GB , info->featureset); - } +clear_bit (X86_FEATURE_PSE , info->featureset); +clear_bit (X86_FEATURE_PSE36 , info->featureset); +clear_bit (X86_FEATURE_PGE , info->featureset); +clear_bit (X86_FEATURE_PAGE1GB , info->featureset); }if ( info->xfeature_mask ==0 )
tools/libxc/xc_dom_core.c +0 -9
@@ -896,15 +896,6 @@ int xc_dom_parse_image(struct xc_dom_image *dom) goto err; } -if ( dom->pvh_enabled ) - { -const char *pvh_features ="writable_descriptor_tables|" -"auto_translated_physmap|" -"supervisor_mode_kernel|" -"hvm_callback_vector" ; -elf_xen_parse_features (pvh_features, dom->f_requested,NULL ); - } -/* check features */ for ( i =0 ; i <XENFEAT_NR_SUBMAPS ; i++ ) {
tools/libxc/xc_dom_x86.c +20 -29
79 lines not on this page · raw message
tools/libxc/xc_domain.c +0 -1
@@ -370,7 +370,6 @@ int xc_domain_getinfo(xc_interface *xch, info->running = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_running); info->hvm = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hvm_guest); info->debugged = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_debugged); - info->pvh = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_pvh_guest); info->xenstore = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_xs_domain); info->hap = !!(domctl.u.getdomaininfo.flags&XEN_DOMINF_hap);
tools/libxl/libxl_create.c +18 -13
@@ -38,9 +38,6 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,if (c_info->type ==LIBXL_DOMAIN_TYPE_HVM ) {libxl_defbool_setdefault (&c_info->hap, true);libxl_defbool_setdefault (&c_info->oos, true); - }else { -libxl_defbool_setdefault (&c_info->pvh, false); -libxl_defbool_setdefault (&c_info->hap,libxl_defbool_val (c_info->pvh)); }libxl_defbool_setdefault (&c_info->run_hotplug_scripts, true);
@@ -475,8 +472,6 @@ int libxl__domain_build(libxl__gc *gc,break ;case LIBXL_DOMAIN_TYPE_PV : - state->pvh_enabled =libxl_defbool_val (d_config->c_info.pvh); - ret =libxl__build_pv (gc, domid, info, state);if (ret) goto out;
@@ -536,14 +531,6 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_config *d_config, flags |= XEN_DOMCTL_CDF_hvm_guest; flags |=libxl_defbool_val (info->hap) ? XEN_DOMCTL_CDF_hap :0 ; flags |=libxl_defbool_val (info->oos) ?0 : XEN_DOMCTL_CDF_oos_off; - }else if (libxl_defbool_val (info->pvh)) { - flags |= XEN_DOMCTL_CDF_pvh_guest; -if (!libxl_defbool_val (info->hap)) { -LOGD (ERROR , *domid,"HAP must be on for PVH" ); - rc =ERROR_INVAL ; - goto out; - } - flags |= XEN_DOMCTL_CDF_hap; }/* Ultimately, handle is an array of 16 uint8_t, same as uuid */
@@ -859,6 +846,24 @@ static void initiate_domain_create(libxl__egc *egc, goto error_out; } +libxl_defbool_setdefault (&d_config->c_info.pvh, false); +if (libxl_defbool_val (d_config->c_info.pvh)) { +if (d_config->c_info.type !=LIBXL_DOMAIN_TYPE_HVM ) { +LOGD (ERROR , domid,"Invalid domain type for PVH: %s" , +libxl_domain_type_to_string (d_config->c_info.type)); + ret =ERROR_INVAL ; + goto error_out; + } +if (d_config->b_info.device_model_version != +LIBXL_DEVICE_MODEL_VERSION_NONE ) { +LOGD (ERROR , domid,"Invalid device model version for PVH: %s" , +libxl_device_model_version_to_string ( + d_config->b_info.device_model_version)); + ret =ERROR_INVAL ; + goto error_out; + } + } +/* If target_memkb is smaller than max_memkb, the subsequent call * to libxc when building HVM domain will enable PoD mode. */
tools/libxl/libxl_dom.c +0 -1
@@ -690,7 +690,6 @@ int libxl__build_pv(libxl__gc *gc, uint32_t domid,return ERROR_FAIL ; } - dom->pvh_enabled = state->pvh_enabled; dom->container_type =XC_DOM_PV_CONTAINER ;LOG (DEBUG ,"pv kernel mapped %d path %s" , state->pv_kernel.mapped, state->pv_kernel.path);
tools/libxl/libxl_internal.h +0 -1
@@ -1129,7 +1129,6 @@ typedef struct {libxl__file_reference pv_kernel;libxl__file_reference pv_ramdisk;const char * pv_cmdline; -bool pvh_enabled;xen_vmemrange_t *vmemranges;uint32_t num_vmemranges;
tools/libxl/libxl_x86.c +2 -5
@@ -338,11 +338,8 @@ int libxl__arch_domain_create(libxl__gc *gc, libxl_domain_config *d_config,if (rtc_timeoffset)xc_domain_set_time_offset (ctx->xch, domid, rtc_timeoffset); -if (d_config->b_info.type ==LIBXL_DOMAIN_TYPE_HVM || -libxl_defbool_val (d_config->c_info.pvh)) { - -unsigned long shadow; - shadow = (d_config->b_info.shadow_memkb +1023 ) /1024 ; +if (d_config->b_info.type ==LIBXL_DOMAIN_TYPE_HVM ) { +unsigned long shadow = (d_config->b_info.shadow_memkb +1023 ) /1024 ;xc_shadow_control (ctx->xch, domid,XEN_DOMCTL_SHADOW_OP_SET_ALLOCATION ,NULL ,0 , &shadow,0 ,NULL ); }
tools/xl/xl_cmdimpl.c +9 -1
@@ -1374,7 +1374,15 @@ static void parse_config_data(const char *config_source, !strncmp(buf, "hvm", strlen(buf))) c_info->type =LIBXL_DOMAIN_TYPE_HVM ; -xlu_cfg_get_defbool (config,"pvh" , &c_info->pvh,0 ); +if (!xlu_cfg_get_defbool (config,"pvh" , &c_info->pvh,0 )) { +/* NB: we need to set the type here, or else we will fall into +* the PV path, and the set of options will be completely wrong +* (even more because the PV and HVM options are inside an union). +*/ + c_info->type =LIBXL_DOMAIN_TYPE_HVM ; + b_info->device_model_version =LIBXL_DEVICE_MODEL_VERSION_NONE ; + } +xlu_cfg_get_defbool (config,"hap" , &c_info->hap,0 );if (xlu_cfg_replace_string (config,"name" , &c_info->name,0 )) {
xen/arch/x86/cpu/vpmu.c +1 -2
@@ -225,8 +225,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs)if ( !vpmu->xenpmu_data )return ; -if (is_pvh_vcpu (sampling) && - !(vpmu_mode &XENPMU_MODE_ALL ) && +if ( !(vpmu_mode &XENPMU_MODE_ALL ) && !vpmu->arch_vpmu_ops->do_interrupt (regs) )return ;
xen/arch/x86/cpuid.c +101 -110
237 lines not on this page · raw message
xen/arch/x86/domain.c +5 -37
84 lines not on this page · raw message
xen/arch/x86/domain_build.c +2 -285
353 lines not on this page · raw message
xen/arch/x86/domctl.c +3 -4
@@ -618,9 +618,8 @@ long arch_do_domctl(break ;case XEN_DOMCTL_get_address_size: - domctl->u.address_size.size = - (is_pv_32bit_domain (d) ||is_pvh_32bit_domain (d)) ? -32 :BITS_PER_LONG ; + domctl->u.address_size.size =is_pv_32bit_domain (d) ?32 : +BITS_PER_LONG ; copyback =1 ;break ;
@@ -1491,7 +1490,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c) {unsigned int i;const struct domain *d = v->domain; -bool_t compat =is_pv_32bit_domain (d) ||is_pvh_32bit_domain (d); +bool_t compat =is_pv_32bit_domain (d);#define c (fld) (!compat ? (c.nat->fld) : (c.cmp->fld))if ( !is_pv_domain (d) )
xen/arch/x86/hvm/hvm.c +3 -78
165 lines not on this page · raw message
xen/arch/x86/hvm/hypercall.c +2 -2
@@ -78,7 +78,7 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)switch ( cmd ) {default : -if ( !is_pvh_vcpu (curr) || !is_hardware_domain (curr->domain) ) +if ( !is_hardware_domain (curr->domain) )return -ENOSYS ;/* fall through */ case PHYSDEVOP_map_pirq:
@@ -86,7 +86,7 @@ static long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)case PHYSDEVOP_eoi:case PHYSDEVOP_irq_status_query:case PHYSDEVOP_get_free_pirq: -if ( !has_pirq (curr->domain) && !is_pvh_vcpu (curr) ) +if ( !has_pirq (curr->domain) )return -ENOSYS ;break ; }
xen/arch/x86/hvm/io.c +0 -2
@@ -84,8 +84,6 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate)struct hvm_vcpu_io *vio = &curr->arch.hvm_vcpu.hvm_io;int rc; -ASSERT (!is_pvh_vcpu (curr)); -hvm_emulate_init_once (&ctxt, validate,guest_cpu_user_regs ()); rc =hvm_emulate_one (&ctxt);
xen/arch/x86/hvm/ioreq.c +1 -2
@@ -1387,8 +1387,7 @@ void hvm_ioreq_init(struct domain *d)spin_lock_init (&d->arch.hvm_domain.ioreq_server.lock);INIT_LIST_HEAD (&d->arch.hvm_domain.ioreq_server.list); -if ( !is_pvh_domain (d) ) -register_portio_handler (d,0xcf8 ,4 , hvm_access_cf8); +register_portio_handler (d,0xcf8 ,4 , hvm_access_cf8); }/*
xen/arch/x86/hvm/irq.c +0 -3
@@ -423,9 +423,6 @@ struct hvm_intack hvm_vcpu_has_pending_irq(struct vcpu *v) && vcpu_info(v, evtchn_upcall_pending) )return hvm_intack_vector (plat->irq.callback_via.vector); -if (is_pvh_vcpu (v) ) -return hvm_intack_none; -if (vlapic_accept_pic_intr (v) && plat->vpic[0 ].int_output )return hvm_intack_pic (0 );
xen/arch/x86/hvm/vmx/vmcs.c +2 -33
@@ -1068,20 +1068,6 @@ static int construct_vmcs(struct vcpu *v) vmx_pin_based_exec_control & ~PIN_BASED_POSTED_INTERRUPT); } -if (is_pvh_domain (d) ) - { -/* Unrestricted guest (real mode for EPT) */ - v->arch.hvm_vmx.secondary_exec_control &= - ~SECONDARY_EXEC_UNRESTRICTED_GUEST ; - -/* Start in 64-bit mode. PVH 32bitfixme. */ - vmentry_ctl |=VM_ENTRY_IA32E_MODE ;/* GUEST_EFER.LME/LMA ignored */ - -ASSERT (v->arch.hvm_vmx.exec_control &CPU_BASED_ACTIVATE_SECONDARY_CONTROLS ); -ASSERT (v->arch.hvm_vmx.exec_control &CPU_BASED_ACTIVATE_MSR_BITMAP ); -ASSERT (!(v->arch.hvm_vmx.exec_control &CPU_BASED_RDTSC_EXITING )); - } -vmx_update_cpu_exec_control (v);__vmwrite (VM_EXIT_CONTROLS , vmexit_ctl);
@@ -1217,11 +1203,7 @@ static int construct_vmcs(struct vcpu *v)__vmwrite (GUEST_DS_AR_BYTES ,0xc093 );__vmwrite (GUEST_FS_AR_BYTES ,0xc093 );__vmwrite (GUEST_GS_AR_BYTES ,0xc093 ); -if (is_pvh_domain (d) ) -/* CS.L == 1, exec, read/write, accessed. */ -__vmwrite (GUEST_CS_AR_BYTES ,0xa09b ); -else -__vmwrite (GUEST_CS_AR_BYTES ,0xc09b );/* exec/read, accessed */ +__vmwrite (GUEST_CS_AR_BYTES ,0xc09b );/* exec/read, accessed */ /* Guest IDT. */ __vmwrite (GUEST_IDTR_BASE ,0 );
@@ -1251,23 +1233,10 @@ static int construct_vmcs(struct vcpu *v) | (1U << TRAP_no_device);vmx_update_exception_bitmap (v); -/* -* In HVM domains, this happens on the realmode->paging -* transition. Since PVH never goes through this transition, we -* need to do it at start-of-day. -*/ -if (is_pvh_domain (d) ) -vmx_update_debug_state (v); - v->arch.hvm_vcpu.guest_cr[0 ] =X86_CR0_PE |X86_CR0_ET ; - -/* PVH domains always start in paging mode */ -if (is_pvh_domain (d) ) - v->arch.hvm_vcpu.guest_cr[0 ] |=X86_CR0_PG ; -hvm_update_guest_cr (v,0 ); - v->arch.hvm_vcpu.guest_cr[4 ] =is_pvh_domain (d) ?X86_CR4_PAE :0 ; + v->arch.hvm_vcpu.guest_cr[4 ] =0 ;hvm_update_guest_cr (v,4 );if ( cpu_has_vmx_tpr_shadow )
xen/arch/x86/hvm/vmx/vmx.c +1 -11
@@ -2063,9 +2063,6 @@ static int vmx_set_mode(struct vcpu *v, int mode) {unsigned long attr; -if ( !is_pvh_vcpu (v) ) -return 0 ; -ASSERT ((mode ==4 ) || (mode ==8 )); attr = (mode ==4 ) ?0xc09b :0xa09b ;
@@ -2298,12 +2295,6 @@ const struct hvm_function_table * __init start_vmx(void) vmx_function_table.sync_pir_to_irr =NULL ; } -if ( cpu_has_vmx_ept - && cpu_has_vmx_pat - && cpu_has_vmx_msr_bitmap - && cpu_has_vmx_secondary_exec_control ) - vmx_function_table.pvh_supported =1 ; -if ( cpu_has_vmx_tsc_scaling ) vmx_function_table.tsc_scaling.ratio_frac_bits =48 ;
@@ -3734,8 +3725,7 @@ void vmx_vmexit_handler(struct cpu_user_regs *regs)if ( exit_qualification &0x10 ) {/* INS, OUTS */ -if (unlikely (is_pvh_vcpu (v))/* PVH fixme */ || - !hvm_emulate_one_insn (x86_insn_is_portio) ) +if ( !hvm_emulate_one_insn (x86_insn_is_portio) )hvm_inject_hw_exception (TRAP_gp_fault,0 ); }else
xen/arch/x86/mm.c +1 -1
@@ -3041,7 +3041,7 @@ static struct domain *get_pg_owner(domid_t domid) goto out; } -if ( !is_pvh_domain (curr) &&unlikely (paging_mode_translate (curr)) ) +if (unlikely (paging_mode_translate (curr)) ) {MEM_LOG ("Cannot mix foreign mappings with translated domains" ); goto out;
xen/arch/x86/mm/p2m-pt.c +1 -1
@@ -532,7 +532,7 @@ p2m_pt_set_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn,if (unlikely (p2m_is_foreign (p2mt)) ) { -/* pvh fixme: foreign types are only supported on ept at present */ +/* hvm fixme: foreign types are only supported on ept at present */ gdprintk (XENLOG_WARNING ,"Unimplemented foreign p2m type.\n" );return -EINVAL ; }
xen/arch/x86/mm/p2m.c +3 -3
@@ -589,7 +589,7 @@ int p2m_alloc_table(struct p2m_domain *p2m) }/* -* pvh fixme: when adding support for pvh non-hardware domains, this path must +* hvm fixme: when adding support for pvh non-hardware domains, this path must * cleanup any foreign p2m types (release refcnts on them). */ void p2m_teardown (struct p2m_domain *p2m)
@@ -2411,10 +2411,10 @@ int p2m_add_foreign(struct domain *tdom, unsigned long fgfn,struct domain *fdom;ASSERT (tdom); -if ( foreigndom ==DOMID_SELF || !is_pvh_domain (tdom) ) +if ( foreigndom ==DOMID_SELF )return -EINVAL ;/* -* pvh fixme: until support is added to p2m teardown code to cleanup any +* hvm fixme: until support is added to p2m teardown code to cleanup any * foreign entries, limit this to hardware domain only. */ if ( !is_hardware_domain (tdom) )
xen/arch/x86/physdev.c +0 -8
@@ -517,10 +517,6 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)struct vcpu *curr = current;struct physdev_set_iopl set_iopl; - ret = -ENOSYS ; -if (is_pvh_vcpu (curr) ) -break ; - ret = -EFAULT ;if (copy_from_guest (&set_iopl, arg,1 ) !=0 )break ;
@@ -536,10 +532,6 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)struct vcpu *curr = current;struct physdev_set_iobitmap set_iobitmap; - ret = -ENOSYS ; -if (is_pvh_vcpu (curr) ) -break ; - ret = -EFAULT ;if (copy_from_guest (&set_iobitmap, arg,1 ) !=0 )break ;
xen/arch/x86/setup.c +0 -7
@@ -62,10 +62,6 @@ integer_param("maxcpus", max_cpus);unsigned long __read_mostly cr4_pv32_mask; -/* Boot dom0 in pvh mode */ -static bool_t __initdata opt_dom0pvh; -boolean_param ("dom0pvh" , opt_dom0pvh); -/* **** Linux config option: propagated to domain0. */ /* "acpi=off": Sisables both ACPI table parsing and interpreter. */ /* "acpi=force": Override the disable blacklist. */
@@ -1545,9 +1541,6 @@ void __init noreturn __start_xen(unsigned long mbi_p)init_guest_cpuid (); -if ( opt_dom0pvh ) - domcr_flags |= DOMCRF_pvh | DOMCRF_hap; -if ( dom0_pvh ) { domcr_flags |= DOMCRF_hvm |
xen/arch/x86/time.c +0 -27
@@ -2013,33 +2013,6 @@ void tsc_set_info(struct domain *d, d->arch.vtsc =0 ;return ; } -if (is_pvh_domain (d) ) - { -/* -* PVH fixme: support more tsc modes. -* -* NB: The reason this is disabled here appears to be with -* additional support required to do the PV RDTSC emulation. -* Since we're no longer taking the PV emulation path for -* anything, we may be able to remove this restriction. -* -* pvhfixme: Experiments show that "default" works for PVH, -* but "always_emulate" does not for some reason. Figure out -* why. -*/ -switch ( tsc_mode ) - { -case TSC_MODE_NEVER_EMULATE : -break ; -default : -printk (XENLOG_WARNING -"PVH currently does not support tsc emulation. Setting timer_mode = never_emulate\n" ); -/* FALLTHRU */ -case TSC_MODE_DEFAULT : - tsc_mode =TSC_MODE_NEVER_EMULATE ; -break ; - } - }switch ( d->arch.tsc_mode = tsc_mode ) {
xen/common/domain.c +0 -2
@@ -304,8 +304,6 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,if ( domcr_flags & DOMCRF_hvm ) d->guest_type = guest_type_hvm; -else if ( domcr_flags & DOMCRF_pvh ) - d->guest_type = guest_type_pvh;else d->guest_type = guest_type_pv;
xen/common/domctl.c +0 -10
@@ -194,9 +194,6 @@ void getdomaininfo(struct domain *d, struct xen_domctl_getdomaininfo *info)case guest_type_hvm: info->flags |= XEN_DOMINF_hvm_guest;break ; -case guest_type_pvh: - info->flags |= XEN_DOMINF_pvh_guest; -break ;default :break ; }
@@ -501,7 +498,6 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) ret = -EINVAL ; if ( (op->u.createdomain.flags & ~(XEN_DOMCTL_CDF_hvm_guest - | XEN_DOMCTL_CDF_pvh_guest | XEN_DOMCTL_CDF_hap | XEN_DOMCTL_CDF_s3_integrity | XEN_DOMCTL_CDF_oos_off
@@ -532,15 +528,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl) rover = dom; } -if ( (op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest) - && (op->u.createdomain.flags & XEN_DOMCTL_CDF_pvh_guest) ) -return -EINVAL ; - domcr_flags =0 ;if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hvm_guest ) domcr_flags |= DOMCRF_hvm; -if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_pvh_guest ) - domcr_flags |= DOMCRF_pvh;if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_hap ) domcr_flags |= DOMCRF_hap;if ( op->u.createdomain.flags & XEN_DOMCTL_CDF_s3_integrity )
xen/common/kernel.c +0 -5
@@ -324,11 +324,6 @@ DO(xen_version)(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg) (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits);break ; -case guest_type_pvh: - fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | - (1U << XENFEAT_supervisor_mode_kernel) | - (1U << XENFEAT_hvm_callback_vector); -break ;case guest_type_hvm: fi.submap |= (1U << XENFEAT_hvm_safe_pvclock) | (1U << XENFEAT_hvm_callback_vector) |
xen/common/vm_event.c +4 -4
@@ -606,8 +606,8 @@ int vm_event_domctl(struct domain *d, xen_domctl_vm_event_op_t *vec,struct p2m_domain *p2m =p2m_get_hostp2m (d); rc = -EOPNOTSUPP ; -/* pvh fixme: p2m_is_foreign types need addressing */ -if (is_pvh_vcpu (current) ||is_pvh_domain (hardware_domain) ) +/* hvm fixme: p2m_is_foreign types need addressing */ +if (is_hvm_domain (hardware_domain) )break ; rc = -ENODEV ;
@@ -707,8 +707,8 @@ int vm_event_domctl(struct domain *d, xen_domctl_vm_event_op_t *vec, {case XEN_VM_EVENT_ENABLE : rc = -EOPNOTSUPP ; -/* pvh fixme: p2m_is_foreign types need addressing */ -if (is_pvh_vcpu (current) ||is_pvh_domain (hardware_domain) ) +/* hvm fixme: p2m_is_foreign types need addressing */ +if (is_hvm_domain (hardware_domain) )break ; rc = -ENODEV ;
xen/include/asm-x86/domain.h +0 -1
@@ -15,7 +15,6 @@#define has_32bit_shinfo (d) ((d)->arch.has_32bit_shinfo)#define is_pv_32bit_domain (d) ((d)->arch.is_32bit_pv)#define is_pv_32bit_vcpu (v) (is_pv_32bit_domain((v)->domain)) -#define is_pvh_32bit_domain (d) (is_pvh_domain(d) && has_32bit_shinfo(d))#define is_hvm_pv_evtchn_domain (d) (has_hvm_container_domain(d) && \ d->arch.hvm_domain.irq.callback_via_type == HVMIRQ_callback_vector)
xen/include/asm-x86/hvm/hvm.h +0 -3
@@ -91,9 +91,6 @@ struct hvm_function_table {/* Support Hardware-Assisted Paging? */ bool_t hap_supported; -/* Necessary hardware support for PVH mode? */ -bool_t pvh_supported; -/* Necessary hardware support for alternate p2m's? */ bool altp2m_supported;
xen/include/public/domctl.h +3 -9
@@ -60,11 +60,8 @@ struct xen_domctl_createdomain {/* Disable out-of-sync shadow page tables? */ #define _XEN_DOMCTL_CDF_oos_off 3#define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off) -/* Is this a PVH guest (as opposed to an HVM or PV guest)? */ -#define _XEN_DOMCTL_CDF_pvh_guest 4 -#define XEN_DOMCTL_CDF_pvh_guest (1U<<_XEN_DOMCTL_CDF_pvh_guest)/* Is this a xenstore domain? */ -#define _XEN_DOMCTL_CDF_xs_domain 5 +#define _XEN_DOMCTL_CDF_xs_domain 4#define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain)uint32_t flags;struct xen_arch_domainconfig config;
@@ -97,14 +94,11 @@ struct xen_domctl_getdomaininfo {/* Being debugged. */ #define _XEN_DOMINF_debugged 6#define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) -/* domain is PVH */ -#define _XEN_DOMINF_pvh_guest 7 -#define XEN_DOMINF_pvh_guest (1U<<_XEN_DOMINF_pvh_guest)/* domain is a xenstore domain */ -#define _XEN_DOMINF_xs_domain 8 +#define _XEN_DOMINF_xs_domain 7#define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain)/* domain has hardware assisted paging */ -#define _XEN_DOMINF_hap 9 +#define _XEN_DOMINF_hap 8#define XEN_DOMINF_hap (1U<<_XEN_DOMINF_hap)/* XEN_DOMINF_shutdown guest-supplied code. */ #define XEN_DOMINF_shutdownmask 255
xen/include/xen/sched.h +2 -7
@@ -312,7 +312,7 @@ struct evtchn_port_ops;* will be false, but has_hvm_container_* checks will be true. */ enum guest_type { - guest_type_pv, guest_type_pvh, guest_type_hvm + guest_type_pv, guest_type_hvm };struct domain
@@ -555,11 +555,8 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags,/* DOMCRF_oos_off: dont use out-of-sync optimization for shadow page tables */ #define _DOMCRF_oos_off 4#define DOMCRF_oos_off (1U<<_DOMCRF_oos_off) -/* DOMCRF_pvh: Create PV domain in HVM container. */ -#define _DOMCRF_pvh 5 -#define DOMCRF_pvh (1U<<_DOMCRF_pvh)/* DOMCRF_xs_domain: xenstore domain */ -#define _DOMCRF_xs_domain 6 +#define _DOMCRF_xs_domain 5#define DOMCRF_xs_domain (1U<<_DOMCRF_xs_domain)/*
@@ -875,8 +872,6 @@ void watchdog_domain_destroy(struct domain *d);#define is_pv_domain (d) ((d)->guest_type == guest_type_pv)#define is_pv_vcpu (v) (is_pv_domain((v)->domain)) -#define is_pvh_domain (d) ((d)->guest_type == guest_type_pvh) -#define is_pvh_vcpu (v) (is_pvh_domain((v)->domain))#define is_hvm_domain (d) ((d)->guest_type == guest_type_hvm)#define is_hvm_vcpu (v) (is_hvm_domain(v->domain))#define has_hvm_container_domain (d) ((d)->guest_type != guest_type_pv)
Signature · 7 lines
2.10.1 (Apple Git-78) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 1/3] x86: remove PVHv1 code
Quoted 25 lines · Roger Pau Monne
xen/include/public/domctl.h +1
-7@@ -60,11 +60,8 @@ struct xen_domctl_createdomain {/* Disable out-of-sync shadow page tables? */ #define _XEN_DOMCTL_CDF_oos_off 3#define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off) -/* Is this a PVH guest (as opposed to an HVM or PV guest)? */ -#define _XEN_DOMCTL_CDF_pvh_guest 4 -#define XEN_DOMCTL_CDF_pvh_guest (1U<<_XEN_DOMCTL_CDF_pvh_guest)/* Is this a xenstore domain? */ -#define _XEN_DOMCTL_CDF_xs_domain 5 +#define _XEN_DOMCTL_CDF_xs_domain 4#define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain)uint32_t flags;struct xen_arch_domainconfig config;@@ -97,14 +94,11 @@ struct xen_domctl_getdomaininfo {/* Being debugged. */ #define _XEN_DOMINF_debugged 6#define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) -/* domain is PVH */ -#define _XEN_DOMINF_pvh_guest 7 -#define XEN_DOMINF_pvh_guest (1U<<_XEN_DOMINF_pvh_guest)
xen/include/public/domctl.h struct xen_domctl_getdomaininfo { · line 104
Quoted 10 lines
xen/include/public/domctl.h +2
-2/* domain is a xenstore domain */ -#define _XEN_DOMINF_xs_domain 8 +#define _XEN_DOMINF_xs_domain 7#define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain)/* domain has hardware assisted paging */ -#define _XEN_DOMINF_hap 9 +#define _XEN_DOMINF_hap 8#define XEN_DOMINF_hap (1U<<_XEN_DOMINF_hap)/* XEN_DOMINF_shutdown guest-supplied code. */ #define XEN_DOMINF_shutdownmask 255
It would probably be better to leave holes in the bitfield space here, given that it is in the public interface.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 1/3] x86: remove PVHv1 code
Quoted 32 lines
Quoted 1 line
Quoted 1 line · On 24.02.17 at 16:32, <[email protected]> wrote:
Quoted 30 lines · Roger Pau Monne
xen/include/public/domctl.h +2
-9@@ -60,11 +60,8 @@ struct xen_domctl_createdomain {/* Disable out-of-sync shadow page tables? */ #define _XEN_DOMCTL_CDF_oos_off 3#define XEN_DOMCTL_CDF_oos_off (1U<<_XEN_DOMCTL_CDF_oos_off) -/* Is this a PVH guest (as opposed to an HVM or PV guest)? */ -#define _XEN_DOMCTL_CDF_pvh_guest 4 -#define XEN_DOMCTL_CDF_pvh_guest (1U<<_XEN_DOMCTL_CDF_pvh_guest)/* Is this a xenstore domain? */ -#define _XEN_DOMCTL_CDF_xs_domain 5 +#define _XEN_DOMCTL_CDF_xs_domain 4#define XEN_DOMCTL_CDF_xs_domain (1U<<_XEN_DOMCTL_CDF_xs_domain)uint32_t flags;struct xen_arch_domainconfig config;@@ -97,14 +94,11 @@ struct xen_domctl_getdomaininfo {/* Being debugged. */ #define _XEN_DOMINF_debugged 6#define XEN_DOMINF_debugged (1U<<_XEN_DOMINF_debugged) -/* domain is PVH */ -#define _XEN_DOMINF_pvh_guest 7 -#define XEN_DOMINF_pvh_guest (1U<<_XEN_DOMINF_pvh_guest)/* domain is a xenstore domain */ -#define _XEN_DOMINF_xs_domain 8 +#define _XEN_DOMINF_xs_domain 7#define XEN_DOMINF_xs_domain (1U<<_XEN_DOMINF_xs_domain)/* domain has hardware assisted paging */ -#define _XEN_DOMINF_hap 9
Quoted 8 lines
xen/include/public/domctl.h struct xen_domctl_getdomaininfo { · line 104
Quoted 5 lines
xen/include/public/domctl.h +1
-0+#define _XEN_DOMINF_hap 8#define XEN_DOMINF_hap (1U<<_XEN_DOMINF_hap)/* XEN_DOMINF_shutdown guest-supplied code. */ #define XEN_DOMINF_shutdownmask 255It would probably be better to leave holes in the bitfield space here, given that it is in the public interface.
Or else the domctl interface version would need to be bumped. Or perhaps it needs to be in any case with such a removal.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 1/3] x86: remove PVHv1 code
In reply to Roger Pau Monnexen/arch/x86/setup.c integer_param("maxcpus", max_cpus); · line 68
Quoted 12 lines · Roger Pau Monne
xen/arch/x86/setup.c +0
-4@@ -62,10 +62,6 @@ integer_param("maxcpus", max_cpus);unsigned long __read_mostly cr4_pv32_mask; -/* Boot dom0 in pvh mode */ -static bool_t __initdata opt_dom0pvh; -boolean_param ("dom0pvh" , opt_dom0pvh); -
Please edit docs/misc/xen-command-line.markdown as well.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 2/3 x86: remove has_hvm_container_{domain/vcpu}
In reply to Roger Pau MonneIt is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's point of view.
---
Cc: Christoph Egger <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: Suravee Suthikulpanit <[email protected]>
Cc: Jun Nakajima <[email protected]>
Cc: Kevin Tian <[email protected]>
Cc: Elena Ufimtseva <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
--- xen/arch/x86/cpu/mcheck/vmce.c | 6 +++--- xen/arch/x86/cpu/vpmu.c | 4 ++-- xen/arch/x86/cpu/vpmu_amd.c | 12 ++++++------ xen/arch/x86/cpu/vpmu_intel.c | 31 +++++++++++++++---------------- xen/arch/x86/cpuid.c | 2 +- xen/arch/x86/debug.c | 2 +- xen/arch/x86/domain.c | 28 ++++++++++++++-------------- xen/arch/x86/domain_build.c | 5 ++--- xen/arch/x86/domctl.c | 2 +- xen/arch/x86/hvm/dm.c | 2 +- xen/arch/x86/hvm/hvm.c | 6 +++--- xen/arch/x86/hvm/irq.c | 2 +- xen/arch/x86/hvm/mtrr.c | 2 +- xen/arch/x86/hvm/vmsi.c | 3 +-- xen/arch/x86/hvm/vmx/vmcs.c | 4 ++-- xen/arch/x86/hvm/vmx/vmx.c | 4 ++-- xen/arch/x86/mm.c | 4 ++-- xen/arch/x86/mm/paging.c | 2 +- xen/arch/x86/mm/shadow/common.c | 9 ++++----- xen/arch/x86/setup.c | 2 +- xen/arch/x86/time.c | 11 +++++------ xen/arch/x86/traps.c | 4 ++-- xen/arch/x86/x86_64/traps.c | 4 ++-- xen/drivers/passthrough/x86/iommu.c | 2 +- xen/include/asm-x86/domain.h | 2 +- xen/include/asm-x86/event.h | 2 +- xen/include/asm-x86/guest_access.h | 12 ++++++------ xen/include/asm-x86/hvm/hvm.h | 2 +- xen/include/xen/sched.h | 2 -- xen/include/xen/tmem_xen.h | 5 ++--- 30 files changed, 85 insertions(+), 93 deletions(-)
xen/arch/x86/cpu/mcheck/vmce.c +3 -3
@@ -82,7 +82,7 @@ int vmce_restore_vcpu(struct vcpu *v, const struct hvm_vmce_vcpu *ctxt) {dprintk (XENLOG_G_ERR ,"%s restore: unsupported MCA capabilities" " %#" PRIx64" for %pv (supported: %#Lx)\n" , -has_hvm_container_vcpu (v) ?"HVM" :"PV" , ctxt->caps, +is_hvm_vcpu (v) ?"HVM" :"PV" , ctxt->caps, v, guest_mcg_cap & ~MCG_CAP_COUNT );return -EPERM ; }
@@ -364,7 +364,7 @@ int inject_vmce(struct domain *d, int vcpu)if ( !v->is_initialised )continue ; -if ( (has_hvm_container_domain (d) || +if ( (is_hvm_domain (d) ||guest_has_trap_callback (d, v->vcpu_id, TRAP_machine_check)) && !test_and_set_bool (v->mce_pending) ) {
@@ -444,7 +444,7 @@ int unmmap_broken_page(struct domain *d, mfn_t mfn, unsigned long gfn)if ( !mfn_valid (mfn) )return -EINVAL ; -if ( !has_hvm_container_domain (d) || !paging_mode_hap (d) ) +if ( !is_hvm_domain (d) || !paging_mode_hap (d) )return -EOPNOTSUPP ; rc =-1 ;
xen/arch/x86/cpu/vpmu.c +2 -2
@@ -237,7 +237,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) vpmu->arch_vpmu_ops->arch_vpmu_save (sampling,1 );vpmu_reset (vpmu,VPMU_CONTEXT_SAVE |VPMU_CONTEXT_LOADED ); -if (has_hvm_container_vcpu (sampled) ) +if (is_hvm_vcpu (sampled) ) *flags =0 ;else *flags =PMU_SAMPLE_PV ;
@@ -288,7 +288,7 @@ void vpmu_do_interrupt(struct cpu_user_regs *regs) r->sp = cur_regs->rsp; r->flags = cur_regs->rflags; -if ( !has_hvm_container_vcpu (sampled) ) +if ( !is_hvm_vcpu (sampled) ) { r->ss = cur_regs->ss; r->cs = cur_regs->cs;
xen/arch/x86/cpu/vpmu_amd.c +6 -6
@@ -305,8 +305,8 @@ static int amd_vpmu_save(struct vcpu *v, bool_t to_guest)context_save (v); -if ( !vpmu_is_set (vpmu,VPMU_RUNNING ) && -has_hvm_container_vcpu (v) &&is_msr_bitmap_on (vpmu) ) +if ( !vpmu_is_set (vpmu,VPMU_RUNNING ) &&is_hvm_vcpu (v) && +is_msr_bitmap_on (vpmu) )amd_vpmu_unset_msr_bitmap (v);if ( to_guest )
@@ -367,7 +367,7 @@ static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,return -EINVAL ;/* For all counters, enable guest only mode for HVM guest */ -if (has_hvm_container_vcpu (v) && (type ==MSR_TYPE_CTRL ) && +if (is_hvm_vcpu (v) && (type ==MSR_TYPE_CTRL ) && !is_guest_mode (msr_content) ) {set_guest_mode (msr_content);
@@ -381,7 +381,7 @@ static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,return 0 ;vpmu_set (vpmu,VPMU_RUNNING ); -if (has_hvm_container_vcpu (v) &&is_msr_bitmap_on (vpmu) ) +if (is_hvm_vcpu (v) &&is_msr_bitmap_on (vpmu) )amd_vpmu_set_msr_bitmap (v); }
@@ -390,7 +390,7 @@ static int amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content, (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) ) {vpmu_reset (vpmu,VPMU_RUNNING ); -if (has_hvm_container_vcpu (v) &&is_msr_bitmap_on (vpmu) ) +if (is_hvm_vcpu (v) &&is_msr_bitmap_on (vpmu) )amd_vpmu_unset_msr_bitmap (v);release_pmu_ownership (PMU_OWNER_HVM ); }
@@ -433,7 +433,7 @@ static void amd_vpmu_destroy(struct vcpu *v) {struct vpmu_struct *vpmu =vcpu_vpmu (v); -if (has_hvm_container_vcpu (v) &&is_msr_bitmap_on (vpmu) ) +if (is_hvm_vcpu (v) &&is_msr_bitmap_on (vpmu) )amd_vpmu_unset_msr_bitmap (v);xfree (vpmu->context);
xen/arch/x86/cpu/vpmu_intel.c +15 -16
@@ -306,7 +306,7 @@ static inline void __core2_vpmu_save(struct vcpu *v)for ( i =0 ; i < arch_pmc_cnt; i++ )rdmsrl (MSR_IA32_PERFCTR0 + i, xen_pmu_cntr_pair[i].counter); -if ( !has_hvm_container_vcpu (v) ) +if ( !is_hvm_vcpu (v) )rdmsrl (MSR_CORE_PERF_GLOBAL_STATUS , core2_vpmu_cxt->global_status); }
@@ -314,7 +314,7 @@ static int core2_vpmu_save(struct vcpu *v, bool_t to_guest) {struct vpmu_struct *vpmu =vcpu_vpmu (v); -if ( !has_hvm_container_vcpu (v) ) +if ( !is_hvm_vcpu (v) )wrmsrl (MSR_CORE_PERF_GLOBAL_CTRL ,0 );if ( !vpmu_are_all_set (vpmu,VPMU_CONTEXT_SAVE |VPMU_CONTEXT_LOADED ) )
@@ -323,8 +323,8 @@ static int core2_vpmu_save(struct vcpu *v, bool_t to_guest)__core2_vpmu_save (v);/* Unset PMU MSR bitmap to trap lazy load. */ -if ( !vpmu_is_set (vpmu,VPMU_RUNNING ) && -has_hvm_container_vcpu (v) && cpu_has_vmx_msr_bitmap ) +if ( !vpmu_is_set (vpmu,VPMU_RUNNING ) &&is_hvm_vcpu (v) && + cpu_has_vmx_msr_bitmap )core2_vpmu_unset_msr_bitmap (v->arch.hvm_vmx.msr_bitmap);if ( to_guest )
@@ -362,7 +362,7 @@ static inline void __core2_vpmu_load(struct vcpu *v)if (vpmu_is_set (vcpu_vpmu (v),VPMU_CPU_HAS_DS ) )wrmsrl (MSR_IA32_DS_AREA , core2_vpmu_cxt->ds_area); -if ( !has_hvm_container_vcpu (v) ) +if ( !is_hvm_vcpu (v) ) {wrmsrl (MSR_CORE_PERF_GLOBAL_OVF_CTRL , core2_vpmu_cxt->global_ovf_ctrl); core2_vpmu_cxt->global_ovf_ctrl =0 ;
@@ -413,7 +413,7 @@ static int core2_vpmu_verify(struct vcpu *v) }if (vpmu_is_set (vpmu,VPMU_CPU_HAS_DS ) && - !(has_hvm_container_vcpu (v) + !(is_hvm_vcpu (v) ?is_canonical_address (core2_vpmu_cxt->ds_area) :__addr_ok (core2_vpmu_cxt->ds_area)) )return -EINVAL ;
@@ -474,7 +474,7 @@ static int core2_vpmu_alloc_resource(struct vcpu *v)if ( !acquire_pmu_ownership (PMU_OWNER_HVM ) )return 0 ; -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) ) {wrmsrl (MSR_CORE_PERF_GLOBAL_CTRL ,0 );if (vmx_add_host_load_msr (MSR_CORE_PERF_GLOBAL_CTRL ) )
@@ -539,7 +539,7 @@ static int core2_vpmu_msr_common_check(u32 msr_index, int *type, int *index) {__core2_vpmu_load (current);vpmu_set (vpmu,VPMU_CONTEXT_LOADED ); -if (has_hvm_container_vcpu (current) && +if (is_hvm_vcpu (current) && cpu_has_vmx_msr_bitmap )core2_vpmu_set_msr_bitmap (current->arch.hvm_vmx.msr_bitmap); }
@@ -612,9 +612,8 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,return -EINVAL ;if (vpmu_is_set (vpmu,VPMU_CPU_HAS_DS ) ) { -if ( !(has_hvm_container_vcpu (v) - ?is_canonical_address (msr_content) - :__addr_ok (msr_content)) ) +if ( !(is_hvm_vcpu (v) ?is_canonical_address (msr_content) + :__addr_ok (msr_content)) ) { gdprintk(XENLOG_WARNING, "Illegal address for IA32_DS_AREA: %#" PRIx64 "x\n",
@@ -635,7 +634,7 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,if ( msr_content & fixed_ctrl_mask )return -EINVAL ; -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )vmx_read_guest_msr (MSR_CORE_PERF_GLOBAL_CTRL , &core2_vpmu_cxt->global_ctrl);else
@@ -704,7 +703,7 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,if ( blocked )return -EINVAL ; -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )vmx_read_guest_msr (MSR_CORE_PERF_GLOBAL_CTRL , &core2_vpmu_cxt->global_ctrl);else
@@ -723,7 +722,7 @@ static int core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content,wrmsrl (msr, msr_content); else { -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )vmx_write_guest_msr (MSR_CORE_PERF_GLOBAL_CTRL , msr_content);else wrmsrl (MSR_CORE_PERF_GLOBAL_CTRL , msr_content);
@@ -757,7 +756,7 @@ static int core2_vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content) *msr_content = core2_vpmu_cxt->global_status;break ;case MSR_CORE_PERF_GLOBAL_CTRL : -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )vmx_read_guest_msr (MSR_CORE_PERF_GLOBAL_CTRL , msr_content);else rdmsrl (MSR_CORE_PERF_GLOBAL_CTRL , *msr_content);
@@ -858,7 +857,7 @@ static void core2_vpmu_destroy(struct vcpu *v) vpmu->context =NULL ;xfree (vpmu->priv_context); vpmu->priv_context =NULL ; -if (has_hvm_container_vcpu (v) && cpu_has_vmx_msr_bitmap ) +if (is_hvm_vcpu (v) && cpu_has_vmx_msr_bitmap )core2_vpmu_unset_msr_bitmap (v->arch.hvm_vmx.msr_bitmap);release_pmu_ownership (PMU_OWNER_HVM );vpmu_clear (vpmu);
xen/arch/x86/cpuid.c +1 -1
@@ -959,7 +959,7 @@ void guest_cpuid(const struct vcpu *v, uint32_t leaf,break ;case 0x80000001 : -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {/* Fast-forward MSR_APIC_BASE.EN. */ if (vlapic_hw_disabled (vcpu_vlapic (v)) )
xen/arch/x86/debug.c +1 -1
@@ -168,7 +168,7 @@ unsigned int dbg_rw_guest_mem(struct domain *dp, void * __user gaddr, pagecnt =min_t (long,PAGE_SIZE - (addr & ~PAGE_MASK ), len); - mfn = (has_hvm_container_domain (dp) + mfn = (is_hvm_domain (dp) ?dbg_hvm_va2mfn (addr, dp, toaddr, &gfn) :dbg_pv_va2mfn (addr, dp, pgd3));if (mfn_eq (mfn,INVALID_MFN ) )
xen/arch/x86/domain.c +14 -14
@@ -187,7 +187,7 @@ void dump_pageframe_info(struct domain *d)spin_unlock (&d->page_alloc_lock); } -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) )p2m_pod_dump_data (d);spin_lock (&d->page_alloc_lock);
@@ -390,7 +390,7 @@ int vcpu_initialise(struct vcpu *v)spin_lock_init (&v->arch.vpmu.vpmu_lock); -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) { rc =hvm_vcpu_initialise (v); goto done;
@@ -461,7 +461,7 @@ void vcpu_destroy(struct vcpu *v)vcpu_destroy_fpu (v); -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )hvm_vcpu_destroy (v);else xfree (v->arch.pv_vcpu.trap_ctxt);
@@ -548,7 +548,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, d->arch.emulation_flags = emflags; } -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) { d->arch.hvm_domain.hap_enabled = hvm_funcs.hap_supported && (domcr_flags & DOMCRF_hap);
@@ -622,7 +622,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,if ( (rc =psr_domain_init (d)) !=0 ) goto fail; -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {if ( (rc =hvm_domain_initialise (d)) !=0 ) goto fail;
@@ -681,7 +681,7 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags,void arch_domain_destroy (struct domain *d) { -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) )hvm_domain_destroy (d);xfree (d->arch.e820);
@@ -733,8 +733,8 @@ int arch_domain_soft_reset(struct domain *d)p2m_type_t p2mt;unsigned int i; -/* Soft reset is supported for HVM/PVH domains only. */ -if ( !has_hvm_container_domain (d) ) +/* Soft reset is supported for HVM domains only. */ +if ( !is_hvm_domain (d) )return -EINVAL ;hvm_domain_soft_reset (d);
@@ -924,7 +924,7 @@ int arch_set_info_guest( v->fpu_initialised = !!(flags &VGCF_I387_VALID ); v->arch.flags &= ~TF_kernel_mode; -if ( (flags & VGCF_in_kernel) ||has_hvm_container_domain (d)/*???*/ ) +if ( (flags & VGCF_in_kernel) ||is_hvm_domain (d)/*???*/ ) v->arch.flags |= TF_kernel_mode; v->arch.vgc_flags = flags;
@@ -969,7 +969,7 @@ int arch_set_info_guest( } } -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {for ( i =0 ; i <ARRAY_SIZE (v->arch.debugreg); ++i ) v->arch.debugreg[i] =c (debugreg[i]);
@@ -1993,7 +1993,7 @@ static void __context_switch(void)if ( xcr0 !=get_xcr0 () && !set_xcr0 (xcr0) )BUG (); -if ( cpu_has_xsaves &&has_hvm_container_vcpu (n) ) +if ( cpu_has_xsaves &&is_hvm_vcpu (n) )set_msr_xss (n->arch.hvm_vcpu.msr_xss); }vcpu_restore_fpu_eager (n);
@@ -2083,7 +2083,7 @@ void context_switch(struct vcpu *prev, struct vcpu *next)if (is_pv_domain (nextd) && (is_idle_domain (prevd) || -has_hvm_container_domain (prevd) || +is_hvm_domain (prevd) ||is_pv_32bit_domain (prevd) !=is_pv_32bit_domain (nextd)) ) {uint64_t efer =read_efer ();
@@ -2385,7 +2385,7 @@ int domain_relinquish_resources(struct domain *d)pit_deinit (d); -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) )hvm_domain_relinquish_resources (d);return 0 ;
@@ -2428,7 +2428,7 @@ void vcpu_mark_events_pending(struct vcpu *v)if ( already_pending )return ; -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )hvm_assert_evtchn_irq (v);else vcpu_kick (v);
xen/arch/x86/domain_build.c +2 -3
@@ -360,9 +360,8 @@ static unsigned long __init compute_dom0_nr_pages( avail -= max_pdx >> s; } - need_paging =has_hvm_container_domain (d) - ? !iommu_hap_pt_share || !paging_mode_hap (d) - : opt_dom0_shadow; + need_paging =is_hvm_domain (d) ? !iommu_hap_pt_share || !paging_mode_hap (d) + : opt_dom0_shadow;for ( ; ; need_paging =0 ) { nr_pages = dom0_nrpages;
xen/arch/x86/domctl.c +1 -1
@@ -1522,7 +1522,7 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)for ( i =0 ; i <ARRAY_SIZE (v->arch.debugreg); ++i )c (debugreg[i] = v->arch.debugreg[i]); -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {struct segment_register sreg;
xen/arch/x86/hvm/dm.c +1 -1
@@ -283,7 +283,7 @@ static int dm_op(domid_t domid,if ( rc )return rc; -if ( !has_hvm_container_domain (d) ) +if ( !is_hvm_domain (d) ) goto out; rc =xsm_dm_op (XSM_DM_PRIV , d);
xen/arch/x86/hvm/hvm.c +3 -3
@@ -3054,7 +3054,7 @@ static enum hvm_copy_result __hvm_copy(char *p;int count, todo = size; -ASSERT (has_hvm_container_vcpu (v)); +ASSERT (is_hvm_vcpu (v));/* * XXX Disable for 4.1.0: PV-on-HVM drivers will do grant-table ops
@@ -3995,7 +3995,7 @@ static int hvmop_set_param(return -ESRCH ; rc = -EINVAL ; -if ( !has_hvm_container_domain (d) ) +if ( !is_hvm_domain (d) ) goto out; rc =hvm_allow_set_param (d, &a);
@@ -4250,7 +4250,7 @@ static int hvmop_get_param(return -ESRCH ; rc = -EINVAL ; -if ( !has_hvm_container_domain (d) ) +if ( !is_hvm_domain (d) ) goto out; rc =hvm_allow_get_param (d, &a);
xen/arch/x86/hvm/irq.c +1 -1
@@ -480,7 +480,7 @@ int hvm_local_events_need_delivery(struct vcpu *v)void arch_evtchn_inject (struct vcpu *v) { -if (has_hvm_container_vcpu (v) ) +if (is_hvm_vcpu (v) )hvm_assert_evtchn_irq (v); }
xen/arch/x86/hvm/mtrr.c +1 -1
@@ -540,7 +540,7 @@ int hvm_get_mem_pinned_cacheattr(struct domain *d, gfn_t gfn,uint64_t mask = ~(uint64_t )0 << order;int rc = -ENXIO ; -ASSERT (has_hvm_container_domain (d)); +ASSERT (is_hvm_domain (d));rcu_read_lock (&pinned_cacheattr_rcu_lock); list_for_each_entry_rcu ( range,
xen/arch/x86/hvm/vmsi.c +1 -2
@@ -560,8 +560,7 @@ void msixtbl_init(struct domain *d) {struct hvm_io_handler *handler; -if ( !has_hvm_container_domain (d) || !has_vlapic (d) || -msixtbl_initialised (d) ) +if ( !is_hvm_domain (d) || !has_vlapic (d) ||msixtbl_initialised (d) )return ;INIT_LIST_HEAD (&d->arch.hvm_domain.msixtbl_list);
xen/arch/x86/hvm/vmx/vmcs.c +2 -2
@@ -768,7 +768,7 @@ void vmx_vmcs_exit(struct vcpu *v) {/* Don't confuse vmx_do_resume (for @v or @current!) */ vmx_clear_vmcs (v); -if (has_hvm_container_vcpu (current) ) +if (is_hvm_vcpu (current) )vmx_load_vmcs (current);spin_unlock (&v->arch.hvm_vmx.vmcs_lock);
@@ -1899,7 +1899,7 @@ static void vmcs_dump(unsigned char ch)for_each_domain ( d ) { -if ( !has_hvm_container_domain (d) ) +if ( !is_hvm_domain (d) )continue ;printk ("\n>>> Domain %d <<<\n" , d->domain_id);for_each_vcpu ( d, v )
xen/arch/x86/hvm/vmx/vmx.c +2 -2
@@ -240,7 +240,7 @@ static void vmx_pi_do_resume(struct vcpu *v)/* This function is called when pcidevs_lock is held */ void vmx_pi_hooks_assign (struct domain *d) { -if ( !iommu_intpost || !has_hvm_container_domain (d) ) +if ( !iommu_intpost || !is_hvm_domain (d) )return ;ASSERT (!d->arch.hvm_domain.pi_ops.vcpu_block);
@@ -254,7 +254,7 @@ void vmx_pi_hooks_assign(struct domain *d)/* This function is called when pcidevs_lock is held */ void vmx_pi_hooks_deassign (struct domain *d) { -if ( !iommu_intpost || !has_hvm_container_domain (d) ) +if ( !iommu_intpost || !is_hvm_domain (d) )return ;ASSERT (d->arch.hvm_domain.pi_ops.vcpu_block);
xen/arch/x86/mm.c +2 -2
@@ -438,7 +438,7 @@ int page_is_ram_type(unsigned long mfn, unsigned long mem_type)unsigned long domain_get_maximum_gpfn (struct domain *d) { -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) )return p2m_get_hostp2m (d)->max_mapped_pfn;/* NB. PV guests specify nr_pfns rather than max_pfn so we adjust here. */ return (arch_get_max_pfn (d) ?:1 ) -1 ;
@@ -3184,7 +3184,7 @@ long do_mmuext_op(break ; } -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {switch ( op.cmd ) {
xen/arch/x86/mm/paging.c +1 -1
@@ -420,7 +420,7 @@ static int paging_log_dirty_op(struct domain *d,* Mark dirty all currently write-mapped pages on e.g. the * final iteration of a save operation. */ -if (has_hvm_container_domain (d) && +if (is_hvm_domain (d) && (sc->mode &XEN_DOMCTL_SHADOW_LOGDIRTY_FINAL ) )hvm_mapped_guest_frames_mark_dirty (d);
xen/arch/x86/mm/shadow/common.c +4 -5
@@ -314,7 +314,7 @@ const struct x86_emulate_ops *shadow_init_emulation(struct vcpu *v = current;unsigned long addr; -ASSERT (has_hvm_container_vcpu (v)); +ASSERT (is_hvm_vcpu (v));memset (sh_ctxt,0 ,sizeof (*sh_ctxt));
@@ -358,7 +358,7 @@ void shadow_continue_emulation(struct sh_emulate_ctxt *sh_ctxt,struct vcpu *v = current;unsigned long addr, diff; -ASSERT (has_hvm_container_vcpu (v)); +ASSERT (is_hvm_vcpu (v));/* * We don't refetch the segment bases, because we don't emulate
@@ -1695,9 +1695,8 @@ void *sh_emulate_map_dest(struct vcpu *v, unsigned long vaddr,#ifndef NDEBUG /* We don't emulate user-mode writes to page tables. */ -if (has_hvm_container_domain (d) - ?hvm_get_cpl (v) ==3 - : !guest_kernel_mode (v,guest_cpu_user_regs ()) ) +if (is_hvm_domain (d) ?hvm_get_cpl (v) ==3 + : !guest_kernel_mode (v,guest_cpu_user_regs ()) ) {gdprintk (XENLOG_DEBUG ,"User-mode write to pagetable reached " "emulate_map_dest(). This should never happen!\n" );
xen/arch/x86/setup.c +1 -1
@@ -1723,7 +1723,7 @@ void __hwdom_init setup_io_bitmap(struct domain *d) {int rc; -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {bitmap_fill (d->arch.hvm_domain.io_bitmap,0x10000 ); rc = rangeset_report_ranges(d->arch.ioport_caps, 0, 0x10000,
xen/arch/x86/time.c +5 -6
@@ -940,7 +940,7 @@ static void __update_vcpu_system_time(struct vcpu *v, int force) }else { -if (has_hvm_container_domain (d) && hvm_tsc_scaling_supported ) +if (is_hvm_domain (d) && hvm_tsc_scaling_supported ) { tsc_stamp =hvm_scale_tsc (d, t->stamp.local_tsc); _u.tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac;
@@ -1950,7 +1950,7 @@ void tsc_get_info(struct domain *d, uint32_t *tsc_mode, uint64_t *elapsed_nsec, uint32_t *gtsc_khz, uint32_t *incarnation) { - bool_t enable_tsc_scaling = has_hvm_container_domain(d) && + bool_t enable_tsc_scaling = is_hvm_domain(d) && hvm_tsc_scaling_supported && !d->arch.vtsc; *incarnation = d->arch.incarnation;
@@ -2030,7 +2030,7 @@ void tsc_set_info(struct domain *d,* PV: guest has not migrated yet (and thus arch.tsc_khz == cpu_khz) */ if ( tsc_mode ==TSC_MODE_DEFAULT &&host_tsc_is_safe () && - (has_hvm_container_domain (d) ? + (is_hvm_domain (d) ? (d->arch.tsc_khz == cpu_khz ||hvm_get_tsc_scaling_ratio (d->arch.tsc_khz)) : incarnation ==0 ) )
@@ -2045,8 +2045,7 @@ void tsc_set_info(struct domain *d,case TSC_MODE_PVRDTSCP : d->arch.vtsc = !boot_cpu_has (X86_FEATURE_RDTSCP ) || !host_tsc_is_safe (); - enable_tsc_scaling =has_hvm_container_domain (d) && - !d->arch.vtsc && + enable_tsc_scaling =is_hvm_domain (d) && !d->arch.vtsc &&hvm_get_tsc_scaling_ratio (gtsc_khz ?: cpu_khz); d->arch.tsc_khz = (enable_tsc_scaling && gtsc_khz) ? gtsc_khz : cpu_khz;set_time_scale (&d->arch.vtsc_to_ns, d->arch.tsc_khz *1000 );
@@ -2063,7 +2062,7 @@ void tsc_set_info(struct domain *d,break ; } d->arch.incarnation = incarnation +1 ; -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) ) {if ( hvm_tsc_scaling_supported && !d->arch.vtsc ) d->arch.hvm_domain.tsc_scaling_ratio =
xen/arch/x86/traps.c +2 -2
@@ -799,7 +799,7 @@ void do_trap(struct cpu_user_regs *regs) }if ( ((trapnr == TRAP_copro_error) || (trapnr == TRAP_simd_error)) && - system_state >= SYS_STATE_active &&has_hvm_container_vcpu (curr) && + system_state >= SYS_STATE_active &&is_hvm_vcpu (curr) && curr->arch.hvm_vcpu.fpu_exception_callback ) { curr->arch.hvm_vcpu.fpu_exception_callback(
@@ -976,7 +976,7 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,break ;case 4 :/* HVM hypervisor leaf. */ -if ( !has_hvm_container_domain (d) || subleaf !=0 ) +if ( !is_hvm_domain (d) || subleaf !=0 )break ;if ( cpu_has_vmx_apic_reg_virt )
xen/arch/x86/x86_64/traps.c +2 -2
@@ -88,7 +88,7 @@ void show_registers(const struct cpu_user_regs *regs)enum context context;struct vcpu *v = system_state >= SYS_STATE_smp_boot ? current :NULL ; -if (guest_mode (regs) &&has_hvm_container_vcpu (v) ) +if (guest_mode (regs) &&is_hvm_vcpu (v) ) {struct segment_register sreg; context = CTXT_hvm_guest;
@@ -623,7 +623,7 @@ static void hypercall_page_initialise_ring3_kernel(void *hypercall_page)void hypercall_page_initialise (struct domain *d,void *hypercall_page) {memset (hypercall_page,0xCC ,PAGE_SIZE ); -if (has_hvm_container_domain (d) ) +if (is_hvm_domain (d) )hvm_hypercall_page_initialise (d, hypercall_page);else if ( !is_pv_32bit_domain (d) )hypercall_page_initialise_ring3_kernel (hypercall_page);
xen/drivers/passthrough/x86/iommu.c +1 -1
@@ -55,7 +55,7 @@ int arch_iommu_populate_page_table(struct domain *d)while ( !rc && (page =page_list_remove_head (&d->page_list)) ) { -if (has_hvm_container_domain (d) || +if (is_hvm_domain (d) || (page->u.inuse.type_info & PGT_type_mask) == PGT_writable_page ) {unsigned long mfn =page_to_mfn (page);
xen/include/asm-x86/domain.h +1 -1
@@ -16,7 +16,7 @@#define is_pv_32bit_domain (d) ((d)->arch.is_32bit_pv)#define is_pv_32bit_vcpu (v) (is_pv_32bit_domain((v)->domain)) -#define is_hvm_pv_evtchn_domain (d) (has_hvm_container_domain(d) && \ +#define is_hvm_pv_evtchn_domain (d) (is_hvm_domain(d) && \ d->arch.hvm_domain.irq.callback_via_type == HVMIRQ_callback_vector)#define is_hvm_pv_evtchn_vcpu (v) (is_hvm_pv_evtchn_domain(v->domain))#define is_domain_direct_mapped (d) ((void)(d), 0)
xen/include/asm-x86/event.h +1 -1
@@ -26,7 +26,7 @@ static inline int local_events_need_delivery(void)ASSERT (!is_idle_vcpu (v)); -return (has_hvm_container_vcpu (v) ?hvm_local_events_need_delivery (v) : +return (is_hvm_vcpu (v) ?hvm_local_events_need_delivery (v) : (vcpu_info (v, evtchn_upcall_pending) && !vcpu_info (v, evtchn_upcall_mask))); }
xen/include/asm-x86/guest_access.h +6 -6
@@ -14,27 +14,27 @@/* Raw access functions: no type checking. */ #define raw_copy_to_guest (dst, src, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ copy_to_user_hvm((dst), (src), (len)) : \ copy_to_user((dst), (src), (len)))#define raw_copy_from_guest (dst, src, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ copy_from_user_hvm((dst), (src), (len)) : \ copy_from_user((dst), (src), (len)))#define raw_clear_guest (dst, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ clear_user_hvm((dst), (len)) : \ clear_user((dst), (len)))#define __raw_copy_to_guest (dst, src, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ copy_to_user_hvm((dst), (src), (len)) : \ __copy_to_user((dst), (src), (len)))#define __raw_copy_from_guest (dst, src, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ copy_from_user_hvm((dst), (src), (len)) : \ __copy_from_user((dst), (src), (len)))#define __raw_clear_guest (dst, len) \ - (has_hvm_container_vcpu(current) ? \ + (is_hvm_vcpu(current) ? \ clear_user_hvm((dst), (len)) : \ clear_user((dst), (len)))
xen/include/asm-x86/hvm/hvm.h +1 -1
@@ -621,7 +621,7 @@ unsigned long hvm_cr4_guest_valid_bits(const struct vcpu *v, bool restore);#define arch_vcpu_block (v) ({ \ struct vcpu *v_ = (v); \ struct domain *d_ = v_->domain; \ - if ( has_hvm_container_domain(d_) && \ + if ( is_hvm_domain(d_) && \ (d_->arch.hvm_domain.pi_ops.vcpu_block) ) \ d_->arch.hvm_domain.pi_ops.vcpu_block(v_); \ })
xen/include/xen/sched.h +0 -2
@@ -874,8 +874,6 @@ void watchdog_domain_destroy(struct domain *d);#define is_pv_vcpu (v) (is_pv_domain((v)->domain))#define is_hvm_domain (d) ((d)->guest_type == guest_type_hvm)#define is_hvm_vcpu (v) (is_hvm_domain(v->domain)) -#define has_hvm_container_domain (d) ((d)->guest_type != guest_type_pv) -#define has_hvm_container_vcpu (v) (has_hvm_container_domain((v)->domain))#define is_pinned_vcpu (v) ((v)->domain->is_pinned || \ cpumask_weight((v)->cpu_hard_affinity) == 1)#ifdef CONFIG_HAS_PASSTHROUGH
xen/include/xen/tmem_xen.h +2 -3
@@ -185,9 +185,8 @@ typedef XEN_GUEST_HANDLE_PARAM(char) tmem_cli_va_param_t;static inline int tmem_get_tmemop_from_client (tmem_op_t *op,tmem_cli_op_t uops) {#ifdef CONFIG_COMPAT -if (has_hvm_container_vcpu (current) ? -hvm_guest_x86_mode (current) !=8 : -is_pv_32bit_vcpu (current) ) +if (is_hvm_vcpu (current) ?hvm_guest_x86_mode (current) !=8 + :is_pv_32bit_vcpu (current) ) {int rc;enum XLAT_tmem_op_u u;
Signature · 7 lines
2.10.1 (Apple Git-78) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
Quoted 4 lines · Roger Pau Monne
It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's point of view.
Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
In reply to Roger Pau MonneQuoted 4 lines · Roger Pau Monne
It is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's point of view.
Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH 2/3] x86: remove has_hvm_container_{domain/vcpu}
In reply to Roger Pau MonneQuoted 7 lines
From: Roger Pau Monne [mailto:[email protected]]
Sent: Friday, February 24, 2017 11:13 PMIt is now useless since PVHv1 is removed and PVHv2 is a HVM domain from Xen's point of view.
Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 3/3 x86/PVHv2: move pvh_setup_e820 together with the other pvh functions
In reply to Roger Pau MonneThis function is only used by PVHv2 domain build, so move it together with the other PVH domain build functions.
Just code motion, no functional change.
---
Cc: Jan Beulich <[email protected]>
Cc: Andrew Cooper <[email protected]>
--- xen/arch/x86/domain_build.c | 134 ++++++++++++++++++++++---------------------- 1 file changed, 67 insertions(+), 67 deletions(-)
xen/arch/x86/domain_build.c +67 -67
@@ -470,73 +470,6 @@ static void __init process_dom0_ioports_disable(struct domain *dom0) } } -static __init void pvh_setup_e820 (struct domain *d,unsigned long nr_pages) -{ -struct e820entry *entry, *entry_guest; -unsigned int i; -unsigned long pages, cur_pages =0 ; -uint64_t start, end; - -/* -* Craft the e820 memory map for Dom0 based on the hardware e820 map. -*/ - d->arch.e820 = xzalloc_array(struct e820entry, e820.nr_map); -if ( !d->arch.e820 ) -panic ("Unable to allocate memory for Dom0 e820 map" ); - entry_guest = d->arch.e820; - -/* Clamp e820 memory map to match the memory assigned to Dom0 */ -for ( i =0 , entry = e820.map; i < e820.nr_map; i++, entry++ ) - { -if ( entry->type !=E820_RAM ) - { - *entry_guest = *entry; - goto next; - } - -if ( nr_pages == cur_pages ) - { -/* -* We already have all the assigned memory, -* skip this entry -*/ -continue ; - } - -/* -* Make sure the start and length are aligned to PAGE_SIZE, because -* that's the minimum granularity of the 2nd stage translation. Since -* the p2m code uses PAGE_ORDER_4K internally, also use it here in -* order to prevent this code from getting out of sync. -*/ - start =ROUNDUP (entry->addr,PAGE_SIZE <<PAGE_ORDER_4K ); - end = (entry->addr + entry->size) & - ~((PAGE_SIZE <<PAGE_ORDER_4K ) -1 ); -if ( start >= end ) -continue ; - - entry_guest->type =E820_RAM ; - entry_guest->addr = start; - entry_guest->size = end - start; - pages =PFN_DOWN (entry_guest->size); -if ( (cur_pages + pages) > nr_pages ) - { -/* Truncate region */ - entry_guest->size = (nr_pages - cur_pages) <<PAGE_SHIFT ; - cur_pages = nr_pages; - } -else - { - cur_pages += pages; - } - next: - d->arch.nr_e820++; - entry_guest++; - } -ASSERT (cur_pages == nr_pages); -ASSERT (d->arch.nr_e820 <= e820.nr_map); -} -static __init void dom0_update_physmap (struct domain *d,unsigned long pfn,unsigned long mfn,unsigned long vphysmap_s) {
@@ -1685,6 +1618,73 @@ static void __init pvh_steal_low_ram(struct domain *d, unsigned long start, } } +static __init void pvh_setup_e820 (struct domain *d,unsigned long nr_pages) +{ +struct e820entry *entry, *entry_guest; +unsigned int i; +unsigned long pages, cur_pages =0 ; +uint64_t start, end; + +/* +* Craft the e820 memory map for Dom0 based on the hardware e820 map. +*/ + d->arch.e820 = xzalloc_array(struct e820entry, e820.nr_map); +if ( !d->arch.e820 ) +panic ("Unable to allocate memory for Dom0 e820 map" ); + entry_guest = d->arch.e820; + +/* Clamp e820 memory map to match the memory assigned to Dom0 */ +for ( i =0 , entry = e820.map; i < e820.nr_map; i++, entry++ ) + { +if ( entry->type !=E820_RAM ) + { + *entry_guest = *entry; + goto next; + } + +if ( nr_pages == cur_pages ) + { +/* +* We already have all the assigned memory, +* skip this entry +*/ +continue ; + } + +/* +* Make sure the start and length are aligned to PAGE_SIZE, because +* that's the minimum granularity of the 2nd stage translation. Since +* the p2m code uses PAGE_ORDER_4K internally, also use it here in +* order to prevent this code from getting out of sync. +*/ + start =ROUNDUP (entry->addr,PAGE_SIZE <<PAGE_ORDER_4K ); + end = (entry->addr + entry->size) & + ~((PAGE_SIZE <<PAGE_ORDER_4K ) -1 ); +if ( start >= end ) +continue ; + + entry_guest->type =E820_RAM ; + entry_guest->addr = start; + entry_guest->size = end - start; + pages =PFN_DOWN (entry_guest->size); +if ( (cur_pages + pages) > nr_pages ) + { +/* Truncate region */ + entry_guest->size = (nr_pages - cur_pages) <<PAGE_SHIFT ; + cur_pages = nr_pages; + } +else + { + cur_pages += pages; + } + next: + d->arch.nr_e820++; + entry_guest++; + } +ASSERT (cur_pages == nr_pages); +ASSERT (d->arch.nr_e820 <= e820.nr_map); +} +static int __init pvh_setup_p2m (struct domain *d) {struct vcpu *v = d->vcpu[0 ];
Signature · 7 lines
2.10.1 (Apple Git-78) _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH 3/3] x86/PVHv2: move pvh_setup_e820 together with the other pvh functions
Quoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.02.17 at 16:13, <[email protected]> wrote:
This function is only used by PVHv2 domain build, so move it together with the other PVH domain build functions.
Just code motion, no functional change.
Signed-off-by Roger Pau Monné <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel