Introduce a new boot parameter "virt_p2m" to be able to set XENFEAT_virtual_p2m for a pv domain.
As long as Xen tools and kdump don't support this new feature it is turned off by default. Signed-off-by: Juergen Gross <jgr...@suse.com> --- xen/arch/x86/domain.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index d98aabd..ccb54f6 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -2166,8 +2166,44 @@ static int __init init_vcpu_kick_softirq(void) } __initcall(init_vcpu_kick_softirq); +#define VIRT_P2M_DOM0 0x01 +#define VIRT_P2M_DOM0_LARGE 0x02 +#define VIRT_P2M_DOMU 0x04 +#define VIRT_P2M_DOMU_LARGE 0x08 +static unsigned virt_p2m = 0; + +static void __init parse_virt_p2m(const char *s) +{ + char *ss; + int b; + + do { + ss = strchr(s, ','); + if ( ss ) + *ss = '\0'; + + b = parse_bool(s); + if ( b == 0 ) + virt_p2m = 0; + else if ( b == 1 ) + virt_p2m = VIRT_P2M_DOM0 | VIRT_P2M_DOMU; + else if ( !strcmp(s, "dom0") ) + virt_p2m |= VIRT_P2M_DOM0; + else if ( !strcmp(s, "dom0_large") ) + virt_p2m |= VIRT_P2M_DOM0_LARGE; + else if ( !strcmp(s, "domu") ) + virt_p2m |= VIRT_P2M_DOMU; + else if ( !strcmp(s, "domu_large") ) + virt_p2m |= VIRT_P2M_DOMU_LARGE; + + s = ss + 1; + } while ( ss ); +} +custom_param("virt_p2m", parse_virt_p2m); + uint32_t arch_get_features(struct domain *d, unsigned int submap_idx) { +#define DOM_IS_LARGE(d) ((d)->max_pages > 1U << 27) uint32_t submap = 0; switch ( submap_idx ) @@ -2179,6 +2215,20 @@ uint32_t arch_get_features(struct domain *d, unsigned int submap_idx) submap |= (1U << XENFEAT_mmu_pt_update_preserve_ad) | (1U << XENFEAT_highmem_assist) | (1U << XENFEAT_gnttab_map_avail_bits); + if ( is_hardware_domain(d) ) + { + if ( virt_p2m & VIRT_P2M_DOM0 ) + submap |= 1U << XENFEAT_virtual_p2m; + if ( DOM_IS_LARGE(d) && virt_p2m & VIRT_P2M_DOM0_LARGE ) + submap |= 1U << XENFEAT_virtual_p2m; + } + else + { + if ( virt_p2m & VIRT_P2M_DOMU ) + submap |= 1U << XENFEAT_virtual_p2m; + if ( DOM_IS_LARGE(d) && virt_p2m & VIRT_P2M_DOMU_LARGE ) + submap |= 1U << XENFEAT_virtual_p2m; + } break; case guest_type_pvh: submap |= (1U << XENFEAT_hvm_safe_pvclock) | -- 2.1.2 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel