On Wed, May 04, 2016 at 02:09:46PM -0500, Suravee Suthikulpanit wrote: > This patch introduces AVIC-related data structure, and AVIC > initialization code. > > There are three main data structures for AVIC: > * Virtual APIC (vAPIC) backing page (per-VCPU) > * Physical APIC ID table (per-VM) > * Logical APIC ID table (per-VM) > > Currently, AVIC is disabled by default. Users can manually > enable AVIC via kernel boot option kvm-amd.avic=1 or during > kvm-amd module loading with parameter avic=1. > > Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx> > --- > arch/x86/include/asm/kvm_host.h | 4 + > arch/x86/include/asm/svm.h | 3 + > arch/x86/kvm/svm.c | 224 +++++++++++++++++++++++++++++++++++++++- > 3 files changed, 230 insertions(+), 1 deletion(-) ... > + * Note: > + * AVIC hardware walks the nested page table to check permissions, > + * but does not use the SPA address specified in the leaf page > + * table entry since it uses address in the AVIC_BACKING_PAGE pointer > + * field of the VMCB. Therefore, we set up the > + * APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (4KB) here. > + */ > +static int avic_init_access_page(struct kvm_vcpu *vcpu) > +{ > + int ret = 0; > + struct kvm *kvm = vcpu->kvm; > + > + if (!kvm->arch.apic_access_page_done) { > + ret = x86_set_memory_region(kvm, > + APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, > + APIC_DEFAULT_PHYS_BASE, > + PAGE_SIZE); > + if (ret) > + return ret; > + kvm->arch.apic_access_page_done = true; > + } > + > + return ret; > +} You can save yourself and indentation level: if (kvm->arch.apic_access_page_done) return ret; ret = x86_set_memory_region(kvm, APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, APIC_DEFAULT_PHYS_BASE, PAGE_SIZE); if (ret) return ret; kvm->arch.apic_access_page_done = true; -- Regards/Gruss, Boris. ECO tip #101: Trim your mails when you reply. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html