Message ID | 1474264368-4104-10-git-send-email-suravee.suthikulpanit@amd.com |
---|---|
State | New |
Headers | show |
>>> On 19.09.16 at 07:52, <suravee.suthikulpanit@amd.com> wrote: > --- a/xen/arch/x86/hvm/svm/svm.c > +++ b/xen/arch/x86/hvm/svm/svm.c > @@ -1495,6 +1495,16 @@ const struct hvm_function_table * __init start_svm(void) > svm_function_table.hap_capabilities = HVM_HAP_SUPERPAGE_2MB | > ((cpuid_edx(0x80000001) & 0x04000000) ? HVM_HAP_SUPERPAGE_1GB : 0); > > + if ( !cpu_has_svm_avic ) > + svm_avic = 0; > + > + if ( svm_avic ) > + { > + svm_function_table.deliver_posted_intr = svm_avic_deliver_posted_intr, > + svm_function_table.virtual_intr_delivery_enabled = svm_avic_enabled, > + printk("SVM: AVIC enabled\n"); > + } > + > return &svm_function_table; > } > > --- a/xen/include/asm-x86/hvm/svm/avic.h > +++ b/xen/include/asm-x86/hvm/svm/avic.h > @@ -41,4 +41,9 @@ void svm_avic_vmexit_do_incomp_ipi(struct cpu_user_regs *regs); > void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs); > > void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vector); > + > +static inline int svm_avic_enabled(void) > +{ > + return svm_avic; > +} Why is this an inline function (and in a header) when its only use is for setting a function pointer? Jan
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index caf9984..a9c09a7 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1495,6 +1495,16 @@ const struct hvm_function_table * __init start_svm(void) svm_function_table.hap_capabilities = HVM_HAP_SUPERPAGE_2MB | ((cpuid_edx(0x80000001) & 0x04000000) ? HVM_HAP_SUPERPAGE_1GB : 0); + if ( !cpu_has_svm_avic ) + svm_avic = 0; + + if ( svm_avic ) + { + svm_function_table.deliver_posted_intr = svm_avic_deliver_posted_intr, + svm_function_table.virtual_intr_delivery_enabled = svm_avic_enabled, + printk("SVM: AVIC enabled\n"); + } + return &svm_function_table; } diff --git a/xen/include/asm-x86/hvm/svm/avic.h b/xen/include/asm-x86/hvm/svm/avic.h index e1eb66c..8411854 100644 --- a/xen/include/asm-x86/hvm/svm/avic.h +++ b/xen/include/asm-x86/hvm/svm/avic.h @@ -41,4 +41,9 @@ void svm_avic_vmexit_do_incomp_ipi(struct cpu_user_regs *regs); void svm_avic_vmexit_do_noaccel(struct cpu_user_regs *regs); void svm_avic_deliver_posted_intr(struct vcpu *v, u8 vector); + +static inline int svm_avic_enabled(void) +{ + return svm_avic; +} #endif /* _SVM_AVIC_H_ */
Hook up virtual_intr_delivery_enabled and deliver_posted_intr functions when AVIC is enabled. Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> --- xen/arch/x86/hvm/svm/svm.c | 10 ++++++++++ xen/include/asm-x86/hvm/svm/avic.h | 5 +++++ 2 files changed, 15 insertions(+)