From owner-svn-src-projects@FreeBSD.ORG Tue Sep 16 04:01:56 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CB3F1289; Tue, 16 Sep 2014 04:01:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABCAFCD1; Tue, 16 Sep 2014 04:01:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8G41uZm005443; Tue, 16 Sep 2014 04:01:56 GMT (envelope-from neel@FreeBSD.org) Received: (from neel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8G41ue5005441; Tue, 16 Sep 2014 04:01:56 GMT (envelope-from neel@FreeBSD.org) Message-Id: <201409160401.s8G41ue5005441@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: neel set sender to neel@FreeBSD.org using -f From: Neel Natu Date: Tue, 16 Sep 2014 04:01:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r271662 - projects/bhyve_svm/sys/amd64/vmm/amd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Sep 2014 04:01:57 -0000 Author: neel Date: Tue Sep 16 04:01:55 2014 New Revision: 271662 URL: http://svnweb.freebsd.org/changeset/base/271662 Log: 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) Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm.c ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Tue Sep 16 03:31:40 2014 (r271661) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm.c Tue Sep 16 04:01:55 2014 (r271662) @@ -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 iden 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 iden 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 typ 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 typ 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); Modified: projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h ============================================================================== --- projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h Tue Sep 16 03:31:40 2014 (r271661) +++ projects/bhyve_svm/sys/amd64/vmm/amd/svm_softc.h Tue Sep 16 04:01:55 2014 (r271662) @@ -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);