Exemplo n.º 1
0
/* -----------------------------------------------------------------------------
   vmx_turn_on()
	Turn on VT operation on all CPUs.
   -------------------------------------------------------------------------- */
int
host_vmxon(boolean_t exclusive)
{
	int error;
	boolean_t do_it = FALSE; /* do the cpu sync outside of the area holding the lock */

	if (!vmx_globally_available())
		return VMX_UNSUPPORTED;

	simple_lock(&vmx_use_count_lock);

	if (vmx_exclusive) {
		error = VMX_INUSE;
	} else {
		vmx_use_count++;
		if (vmx_use_count == 1) /* was turned off before */
			do_it = TRUE;
		vmx_exclusive = exclusive;

		VMX_KPRINTF("VMX use count: %d\n", vmx_use_count);
		error = VMX_OK;
	}

	simple_unlock(&vmx_use_count_lock);

	if (do_it) {
		vmx_allocate_vmxon_regions();
		mp_rendezvous(NULL, (void (*)(void *))vmx_on, NULL, NULL);
	}
	return error;
}
Exemplo n.º 2
0
/*
 * Update EIST settings on all processors.
 */
void driver::eist_update_all_cpus(uint16_t vid) {
 void *p;
        
 IOSimpleLockLock(eist_lock);
 p=&vid;
 mp_rendezvous(eist_update_setup, eist_update_action, eist_update_teardown, p);
 IOSimpleLockUnlock(eist_lock);
}
void throttleAllCPUs(PState* p) {
	dbg("Starting throttle with CTL 0x%x\n", CTL(p->Frequency, p->Voltage));
	IOSimpleLockLock(Lock);
	
	mp_rendezvous(disableInterrupts, throttleCPU, enableInterrupts, p);
	IODelay(p->Latency); // maybe wait longer?
	
	totalThrottles++;
	
	IOSimpleLockUnlock(Lock);
	dbg("Throttle done.\n");
}
Exemplo n.º 4
0
static void get_cpu_info_data()
{
    cpu_info_t values[NCPUS];

    mp_rendezvous(NULL, (void (*)(void *))cpu_info_callback,
                  NULL, (void *) values);

    printf("---- get_cpu_info_data ----\n");

    for (int i = 0; i < NCPUS; i++)
    {
        printf("-- cpu_info_t: os_id %d socket %d, core %d, apic %d\n",
               values[i].os_id, values[i].socket, values[i].core, values[i].apic);
    }
}
Exemplo n.º 5
0
static void get_cpu_tick_diff()
{
    // to get nanos:
    // static mach_timebase_info_data_t timebase_info;
    // mach_timebase_info(&timebase_info);
    tsc_t values[NCPUS];

    mp_rendezvous(NULL, get_cpu_tick_diff_callback, NULL, (void *) values);

    printf("---- get_cpu_tick_diff ----\n");

    for (int i = 0; i < NCPUS; i++)
    {
        printf("-- cpu: %d raw: %llu corrected: %llu --\n", i, values[i].raw, values[i].corrected);
    }
}
Exemplo n.º 6
0
/* -----------------------------------------------------------------------------
   vmx_turn_off()
	Turn off VT operation on all CPUs.
   -------------------------------------------------------------------------- */
void
host_vmxoff()
{
	boolean_t do_it = FALSE; /* do the cpu sync outside of the area holding the lock */

	simple_lock(&vmx_use_count_lock);

	if (vmx_use_count) {
		vmx_use_count--;
		vmx_exclusive = FALSE;
		if (!vmx_use_count)
			do_it = TRUE;
	}

	simple_unlock(&vmx_use_count_lock);

	if (do_it) {
		mp_rendezvous(NULL, (void (*)(void *))vmx_off, NULL, NULL);
		vmx_free_vmxon_regions();
	}

	VMX_KPRINTF("VMX use count: %d\n", vmx_use_count);
}