[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v7 13/15] x86/hvm: Remove loop from hvm_save_mtrr_msr func
Signed-off-by: Alexandru Isaila <aisaila@xxxxxxxxxxxxxxx> --- xen/arch/x86/hvm/mtrr.c | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c index d311031..4c1e850 100644 --- a/xen/arch/x86/hvm/mtrr.c +++ b/xen/arch/x86/hvm/mtrr.c @@ -666,46 +666,37 @@ int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start, return 0; } -static void hvm_save_mtrr_msr_one(struct vcpu *v, struct hvm_hw_mtrr *hw_mtrr) +static int hvm_save_mtrr_msr(struct domain *d, hvm_domain_context_t *h) { + struct vcpu *v = NULL; + struct hvm_hw_mtrr hw_mtrr; struct mtrr_state *mtrr_state = &v->arch.hvm_vcpu.mtrr; int i; + /* save mtrr&pat */ - hvm_get_guest_pat(v, &hw_mtrr->msr_pat_cr); + hvm_get_guest_pat(v, &hw_mtrr.msr_pat_cr); - hw_mtrr->msr_mtrr_def_type = mtrr_state->def_type + hw_mtrr.msr_mtrr_def_type = mtrr_state->def_type | (mtrr_state->enabled << 10); - hw_mtrr->msr_mtrr_cap = mtrr_state->mtrr_cap; + hw_mtrr.msr_mtrr_cap = mtrr_state->mtrr_cap; for ( i = 0; i < MTRR_VCNT; i++ ) { /* save physbase */ - hw_mtrr->msr_mtrr_var[i*2] = + hw_mtrr.msr_mtrr_var[i*2] = ((uint64_t*)mtrr_state->var_ranges)[i*2]; /* save physmask */ - hw_mtrr->msr_mtrr_var[i*2+1] = + hw_mtrr.msr_mtrr_var[i*2+1] = ((uint64_t*)mtrr_state->var_ranges)[i*2+1]; } for ( i = 0; i < NUM_FIXED_MSR; i++ ) - hw_mtrr->msr_mtrr_fixed[i] = + hw_mtrr.msr_mtrr_fixed[i] = ((uint64_t*)mtrr_state->fixed_ranges)[i]; -} - -static int hvm_save_mtrr_msr(struct domain *d, hvm_domain_context_t *h) -{ - struct vcpu *v; - struct hvm_hw_mtrr hw_mtrr; - /* save mtrr&pat */ - - for_each_vcpu(d, v) - { - hvm_save_mtrr_msr_one(v, &hw_mtrr); + if ( hvm_save_entry(MTRR, v->vcpu_id, h, &hw_mtrr) != 0 ) + return 1; - if ( hvm_save_entry(MTRR, v->vcpu_id, h, &hw_mtrr) != 0 ) - return 1; - } return 0; } -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |