Beispiel #1
0
static void vmx_cpu_basic_info()
{
   rd_msr_vmx_basic_info(info->vm.vmx_info);
   rd_msr_vmx_misc_data(info->vm.vmx_misc);

   if(info->vm.vmx_info.true_f1)
   {
      rd_msr_vmx_true_pin_ctls(info->vm.vmx_fx_pin);
      rd_msr_vmx_true_proc_ctls(info->vm.vmx_fx_proc);
      rd_msr_vmx_true_entry_ctls(info->vm.vmx_fx_entry);
      rd_msr_vmx_true_exit_ctls(info->vm.vmx_fx_exit);
   }
   else
   {
      rd_msr_vmx_pin_ctls(info->vm.vmx_fx_pin);
      rd_msr_vmx_proc_ctls(info->vm.vmx_fx_proc);
      rd_msr_vmx_entry_ctls(info->vm.vmx_fx_entry);
      rd_msr_vmx_exit_ctls(info->vm.vmx_fx_exit);
   }

#ifdef CONFIG_VMX_CPU_DBG
   vmx_show_basic_info();
   vmx_show_misc_data();
   vmx_show_fixed_pin_ctls();
   vmx_show_fixed_proc_ctls();
   vmx_show_fixed_entry_ctls();
   vmx_show_fixed_exit_ctls();
#endif

   /* should be 1 if uguest available, and as we need uguest */
   if(!info->vm.vmx_misc.lma)
      panic("vmx misc ia32e/lma missing");

#ifdef CONFIG_VMX_FEAT_EXIT_EXT_IO
   if(!info->vm.vmx_info.io_insn)
      panic("vmx ins/outs info not given on VM-exit");
#endif
}
Beispiel #2
0
static void vmx_cpu_features()
{
   feat_ctl_msr_t feat;

   if(!vmx_supported())
      panic("vmx not supported");

   rd_msr_feature_ctrl(feat);

   if(!feat.vmx && feat.lock)
      panic("vmx feature BIOS-locked: 0x%x", feat.raw);

   if(!feat.lock)
   {
      if(!feat.vmx)
	 feat.vmx = 1;

      feat.lock = 1;
      wr_msr_feature_ctrl(feat);
   }

   rd_msr_vmx_basic_info(info->vm.vmx_info);

   debug(VMX_CPU, "vmx revision %d\n", info->vm.vmx_info.revision_id);

   if(info->vm.vmx_info.true_f1)
   {
      rd_msr_vmx_true_pin_ctls(info->vm.vmx_fx_pin);
      rd_msr_vmx_true_proc_ctls(info->vm.vmx_fx_proc);
      rd_msr_vmx_true_exit_ctls(info->vm.vmx_fx_exit);
      rd_msr_vmx_true_entry_ctls(info->vm.vmx_fx_entry);
   }
   else
   {
      rd_msr_vmx_pin_ctls(info->vm.vmx_fx_pin);
      rd_msr_vmx_proc_ctls(info->vm.vmx_fx_proc);
      rd_msr_vmx_exit_ctls(info->vm.vmx_fx_exit);
      rd_msr_vmx_entry_ctls(info->vm.vmx_fx_entry);
   }

   if(!vmx_allow_proc2(info->vm.vmx_fx_proc))
      panic("vmx missing features (secondary proc based) !");

   rd_msr_vmx_proc2_ctls(info->vm.vmx_fx_proc2);

   if(!vmx_allow_ept(info->vm.vmx_fx_proc2))
      panic("vmx ept not supported");

   if(!vmx_allow_dt(info->vm.vmx_fx_proc2))
      panic("vmx desc table exiting not supported");

   if(!vmx_allow_vpid(info->vm.vmx_fx_proc2))
      panic("vmx vpid not supported");

   if(!vmx_allow_uguest(info->vm.vmx_fx_proc2))
      panic("vmx missing unrestricted guest\n");

   rd_msr_vmx_ept_cap(info->vm.vmx_ept_cap);

   if(!info->vm.vmx_ept_cap.wb)
      panic("vmx ept mem type only UC");

   if(!info->vm.vmx_ept_cap.pwl4)
      panic("unsupported page walk length");

   rd_msr_vmx_fixed_cr0(info->vm.vmx_fx_cr0);
   rd_msr_vmx_fixed_cr4(info->vm.vmx_fx_cr4);

   /* unrestricted guest */
   info->vm.vmx_fx_cr0.allow_0 &= ~(CR0_PG|CR0_PE);
   info->vm.vmx_fx_cr0.allow_1 |=  (CR0_PG|CR0_PE);
}