Bochs SVM:which processor support nRIP?

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
akgupt3
Posts: 1
Joined: Tue Dec 18, 2012 3:52 pm

Bochs SVM:which processor support nRIP?

Post by akgupt3 »

Hi all,
I see that Bochs SVM NRIP support is only for Generic (AMD?)processor.

anish-mac:bochs-2.6 akgupt3$ grep -nr SVM_NRIP cpu
cpu/cpuid.h:433:#define BX_CPUID_SVM_NRIP_SAVE (1 << 3)
cpu/generic_cpuid.cc:644: leaf->edx = BX_CPUID_SVM_NESTED_PAGING | BX_CPUID_SVM_NRIP_SAVE;
cpu/generic_cpuid.cc:1078: BX_CPUID_SVM_NRIP_SAVE;
cpu/svm.cc:582: if (BX_SUPPORT_SVM_EXTENSION(BX_CPUID_SVM_NRIP_SAVE))

PhenomX3 8650 doesn't support nRIP, I verified using FreeBSD and checked CPUID Fn8000_000A using a kernel module.

I am not sure how to specify to use Generic AMD core in bochsrc file, for Phenom, I specified model=phenom_8650_toliman but for Generic, I had it as vendor_string=AuthenticAMD but bochs didn't start, error us "cpu directive is malformed".

Looks like Phenom also doesn't support instruction decode(SVM CPUID capability), I wonder how can hypervisor increment RIP w/o nRIP and instruction decode.
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Bochs SVM:which processor support nRIP?

Post by stlw »

Hi,

You could browse for various CPUIDs here:
http://instlatx64.atw.hu/

Yes, you cannot configure the nrip (or any other svm subfeature) using bx_generic cpuid.
Also the CPUID definition modules currently doesn't include CPUs which cannot be fully emulated by Bochs with all their bell and whistles - might be it is already time to change it.
I am aware of one AMD CPU which supported NRIP - it is Bulldozer.
Bochs doesn't support some of the Bulldozer features and therefore its CPUID definition wasn't added to CPUDB yet.
Might be I need to create smth like Bulldozer ES which will have subset of real Bulldozer which Bochs knows to emulate.

BTW, if you know to re-compile Bochs sources you could simply go to phenomx3_8650_toliman.cc file and add NRIP into it - you will receive phenom which does support NRIP.

Currently phenom has:

Code: Select all

Bit32u phenom_8650_toliman_t::get_svm_extensions_bitmask(void) const
{
  return BX_CPUID_SVM_NESTED_PAGING |
         BX_CPUID_SVM_LBR_VIRTUALIZATION |
         BX_CPUID_SVM_SVM_LOCK;
}

// leaf 0x8000000A : SVM //
void phenom_8650_toliman_t::get_ext_cpuid_leaf_A(cpuid_function_t *leaf) const
{
  leaf->eax = 0x01; /* SVM revision ID */
  leaf->ebx = 0x40; /* number of ASIDs */
  leaf->ecx = 0;

  // * [0:0]   NP - Nested paging support
  // * [1:1]   LBR virtualization
  // * [2:2]   SVM Lock
  //   [3:3]   NRIPS - Next RIP save on VMEXIT
  //   [4:4]   TscRate - MSR based TSC ratio control
  //   [5:5]   VMCB Clean bits support
  //   [6:6]   Flush by ASID support
  //   [7:7]   Decode assists support
  //   [9:8]   Reserved
  //   [10:10] Pause filter support
  //   [11:11] Reserved
  //   [12:12] Pause filter threshold support
  //   [31:13] Reserved

  leaf->edx = BX_CPUID_SVM_NESTED_PAGING |
              BX_CPUID_SVM_LBR_VIRTUALIZATION |
              BX_CPUID_SVM_SVM_LOCK;
}
so you've got an idea how to extend it :)

Stanislav
stlw
Member
Member
Posts: 357
Joined: Fri Apr 04, 2008 6:43 am
Contact:

Re: Bochs SVM:which processor support nRIP?

Post by stlw »

small correction - NRIP is already included in bx_generic - so you could use it if you enbale SVM.

just set cpu: model=bx_generic and you will have access to leaf CPUID of Bochs options.
See example:

#cpuid: x86_64=1, mmx=1, sep=1, sse=sse4_2, apic=xapic, aes=1, movbe=1, xsave=1
#cpuid: family=6, model=0x1a, stepping=5

configure list of options you want to have (if you have some conficts it will report you when you run Bochs).
use svm=1

Stanislav
Post Reply