[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [RFC PATCH 5/9] x86/HVM/SVM: Add AVIC initialization code
>>> On 19.09.16 at 07:52, <suravee.suthikulpanit@xxxxxxx> wrote: > +int svm_avic_init_vcpu(struct vcpu *v) > +{ > + struct vlapic *vlapic = vcpu_vlapic(v); > + struct arch_svm_struct *s = &v->arch.hvm_svm; > + > + if ( svm_avic ) > + s->avic_bk_pg = vlapic->regs_page; Why this copying? Can't consuming code not use vlapic->regs_page? > +int svm_avic_init_vmcb(struct vcpu *v) > +{ > + paddr_t ma; > + u32 apic_id_reg; > + struct arch_svm_struct *s = &v->arch.hvm_svm; > + struct vmcb_struct *vmcb = s->vmcb; > + struct svm_domain *d = &v->domain->arch.hvm_domain.svm; > + struct svm_avic_phy_ait_entry entry; > + > + if ( !svm_avic ) > + return 0; > + > + vmcb->avic_bk_pg_pa = page_to_maddr(s->avic_bk_pg) & AVIC_HPA_MASK; > + ma = d->avic_log_ait_mfn; > + vmcb->avic_log_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK; > + ma = d->avic_phy_ait_mfn; > + vmcb->avic_phy_apic_id = (ma << PAGE_SHIFT) & AVIC_HPA_MASK; > + vmcb->avic_phy_apic_id |= AVIC_PHY_APIC_ID_MAX; > + > + dprintk(XENLOG_DEBUG, "SVM: %s: bpa=%#llx, lpa=%#llx, ppa=%#llx\n", > + __func__, (unsigned long long)vmcb->avic_bk_pg_pa, > + (unsigned long long) vmcb->avic_log_apic_id, > + (unsigned long long) vmcb->avic_phy_apic_id); > + > + > + apic_id_reg = *avic_get_bk_page_entry(v, APIC_ID); > + s->avic_phy_id_cache = avic_get_phy_ait_entry(v, apic_id_reg >> 24); > + if ( !s->avic_phy_id_cache ) > + return -EINVAL; > + > + entry = *(s->avic_phy_id_cache); > + smp_rmb(); > + entry.bk_pg_ptr = (vmcb->avic_bk_pg_pa >> 12) & 0xffffffffff; Please avoid such open coded constants. Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |