svn commit: r271662 - projects/bhyve_svm/sys/amd64/vmm/amd
Neel Natu
neel at FreeBSD.org
Tue Sep 16 04:01:57 UTC 2014
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 at 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);
More information about the svn-src-projects
mailing list