FreeBSD/sys/x86/xen/hvm.c
/*
 * Allocate and fill in the hypcall page.
 */
Allocate and fill in the hypcall page.
Allocate and fill in the hypcall page .
static int
xen_hvm_init_hypercall_stubs(enum xen_hvm_init_type init_type)
{
	uint32_t base, regs[4];
	int i;
	if (xen_pv_domain()) {
		return (0);
	}
	base = xen_hvm_cpuid_base();
	if (base == 0)
		return (ENXIO);
	if (init_type == XEN_HVM_INIT_COLD) {
		int major, minor;
		do_cpuid(base + 1, regs);
		major = regs[0] >> 16;
		minor = regs[0] & 0xffff;
		printf("XEN: Hypervisor version %d.%d detected.\n", major,
			minor);
		if (((major < 4) || (major == 4 && minor <= 5)) &&
		    msix_disable_migration == -1) {
			if (bootverbose)
				printf(
"Disabling MSI-X interrupt migration due to Xen hypervisor bug.\n"
"Set machdep.msix_disable_migration=0 to forcefully enable it.\n");
			msix_disable_migration = 1;
		}
	}
	do_cpuid(base + 2, regs);
	for (i = 0; i < regs[0]; i++)
		wrmsr(regs[1], vtophys(&hypercall_page + i * PAGE_SIZE) + i);
	return (0);
}
static int xen_hvm_init_hypercall_stubs ( enum xen_hvm_init_type init_type ) { uint32_t base , regs [ 4 ] ; int i ; if ( xen_pv_domain ( ) ) { return ( 0 ) ; } base = xen_hvm_cpuid_base ( ) ; if ( base == 0 ) return ( ENXIO ) ; if ( init_type == XEN_HVM_INIT_COLD ) { int major , minor ; do_cpuid ( base + 1 , regs ) ; major = regs [ 0 ] >> 16 ; minor = regs [ 0 ] & 0xffff ; printf ( " \n " , major , minor ) ; if ( ( ( major < 4 ) || ( major == 4 && minor <= 5 ) ) && msix_disable_migration == -1 ) { if ( bootverbose ) printf ( " \n " " \n " ) ; msix_disable_migration = 1 ; } } do_cpuid ( base + 2 , regs ) ; for ( i = 0 ; i < regs [ 0 ] ; i ++ ) wrmsr ( regs [ 1 ] , vtophys ( & hypercall_page + i * PAGE_SIZE ) + i ) ; return ( 0 ) ; }
Allocate and fill in the hypcall page.
Allocate and fill in the hypcall page .
/* hypercall page is already set in the PV case */ /*
			 * Xen hypervisors prior to 4.6.0 do not properly
			 * handle updates to enabled MSI-X table entries,
			 * so disable MSI-X interrupt migration in that
			 * case.
			 */ /*
	 * Find the hypercall pages.
	 */