Minor cleanup.

Get rid of unused 'svm_feature' from the softc.

Get rid of the redundant 'vcpu_cnt' checks in svm.c. There is a similar check
in vmm.c against 'vm->active_cpus' before the AMD-specific code is called.

Submitted by:	Anish Gupta (akgupt3@gmail.com)
This commit is contained in:
neel 2014-09-16 04:01:55 +00:00
parent 97bffd44f6
commit 16169f746d
2 changed files with 1 additions and 15 deletions

View File

@ -564,8 +564,6 @@ svm_vminit(struct vm *vm, pmap_t pmap)
M_SVM, M_WAITOK | M_ZERO);
svm_sc->vm = vm;
svm_sc->svm_feature = svm_feature;
svm_sc->vcpu_cnt = VM_MAXCPU;
svm_sc->nptp = (vm_offset_t)vtophys(pmap->pm_pml4);
/*
@ -603,7 +601,7 @@ svm_vminit(struct vm *vm, pmap_t pmap)
msrpm_pa = vtophys(svm_sc->msr_bitmap);
pml4_pa = svm_sc->nptp;
for (i = 0; i < svm_sc->vcpu_cnt; i++) {
for (i = 0; i < VM_MAXCPU; i++) {
vcpu = svm_get_vcpu(svm_sc, i);
vcpu->lastcpu = NOCPU;
vcpu->vmcb_pa = vtophys(&vcpu->vmcb);
@ -1905,8 +1903,6 @@ svm_getreg(void *arg, int vcpu, int ident, uint64_t *val)
register_t *reg;
svm_sc = arg;
KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu));
vmcb = svm_get_vmcb(svm_sc, vcpu);
if (vmcb_read(vmcb, ident, val) == 0) {
@ -1936,8 +1932,6 @@ svm_setreg(void *arg, int vcpu, int ident, uint64_t val)
register_t *reg;
svm_sc = arg;
KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu));
vmcb = svm_get_vmcb(svm_sc, vcpu);
if (vmcb_write(vmcb, ident, val) == 0) {
return (0);
@ -1973,8 +1967,6 @@ svm_setdesc(void *arg, int vcpu, int type, struct seg_desc *desc)
uint16_t attrib;
svm_sc = arg;
KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu));
vmcb = svm_get_vmcb(svm_sc, vcpu);
VCPU_CTR1(svm_sc->vm, vcpu, "SVM:set_desc: Type%d\n", type);
@ -2006,8 +1998,6 @@ svm_getdesc(void *arg, int vcpu, int type, struct seg_desc *desc)
struct vmcb_segment *seg;
svm_sc = arg;
KASSERT(vcpu < svm_sc->vcpu_cnt, ("Guest doesn't have VCPU%d", vcpu));
VCPU_CTR1(svm_sc->vm, vcpu, "SVM:get_desc: Type%d\n", type);
seg = vmcb_seg(svm_get_vmcb(svm_sc, vcpu), type);

View File

@ -77,10 +77,6 @@ struct svm_softc {
/* Guest VCPU h/w and s/w context. */
struct svm_vcpu vcpu[VM_MAXCPU];
uint32_t svm_feature; /* SVM features from CPUID.*/
int vcpu_cnt; /* number of VCPUs for this guest.*/
} __aligned(PAGE_SIZE);
CTASSERT((offsetof(struct svm_softc, nptp) & PAGE_MASK) == 0);