From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [RFC PATCH 2/3] x86: Add inject_realmode_interrupt() wrapper Date: Mon, 09 Aug 2010 22:57:35 -0400 Message-ID: <4C60C01F.8020700@redhat.com> References: <1281295456-11114-1-git-send-email-m.gamal005@gmail.com> <1281295456-11114-3-git-send-email-m.gamal005@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:33534 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751925Ab0HJC5n (ORCPT ); Mon, 9 Aug 2010 22:57:43 -0400 In-Reply-To: <1281295456-11114-3-git-send-email-m.gamal005@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/08/2010 03:24 PM, Mohammed Gamal wrote: > This adds a wrapper function inject_realmode_interrupt() around the > emulator function emulate_int_real() to allow real mode interrupt injection. > > Signed-off-by: Mohammed Gamal > --- > arch/x86/kvm/x86.c | 14 ++++++++++++++ > arch/x86/kvm/x86.h | 1 + > 2 files changed, 15 insertions(+), 0 deletions(-) > Really has no business in x86.c, as it's there to work around a vmx specific problem. > > +int inject_realmode_interrupt(struct kvm_vcpu *vcpu, int irq) > +{ > + struct x86_emulate_ctxt *ctxt =&vcpu->arch.emulate_ctxt; > + int rc; > + > + rc = emulate_int_real(ctxt,&emulate_ops, irq); > + > + if (rc != X86EMUL_CONTINUE) > + return EMULATE_FAIL; > + > + return EMULATE_DONE; > +} > +EXPORT_SYMBOL_GPL(inject_realmode_interrupt); Doesn't seem to add much value. I'd say just export emulate_int_real() and call it from vmx.c. Hmm, you aren't initializing the context. So I guess you do need this function (and I guess it's better to keep it in x86.c near the rest of the emulation stuff, just make sure the emulation context is initialized). -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.