From 16169f746d3710b2943f893dbddcad4b605027ac Mon Sep 17 00:00:00 2001 From: neel Date: Tue, 16 Sep 2014 04:01:55 +0000 Subject: [PATCH] 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) --- sys/amd64/vmm/amd/svm.c | 12 +----------- sys/amd64/vmm/amd/svm_softc.h | 4 ---- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/sys/amd64/vmm/amd/svm.c b/sys/amd64/vmm/amd/svm.c index 2de59ac07a97..70c2e712a2ee 100644 --- a/sys/amd64/vmm/amd/svm.c +++ b/sys/amd64/vmm/amd/svm.c @@ -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); diff --git a/sys/amd64/vmm/amd/svm_softc.h b/sys/amd64/vmm/amd/svm_softc.h index 0cf163fc4904..ed368df21660 100644 --- a/sys/amd64/vmm/amd/svm_softc.h +++ b/sys/amd64/vmm/amd/svm_softc.h @@ -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);