From: "Jan Beulich" Subject: Re: [PATCH] x86/hvm: implement save/restore for posted interrupts Date: Thu, 03 Jul 2014 16:27:25 +0100 Message-ID: <53B5927D02000078000205B5@mail.emea.novell.com> References: <1404400159-27346-1-git-send-email-olaf@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1404400159-27346-1-git-send-email-olaf@aepfle.de> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Kevin Tian , Keir Fraser , Eddie Dong , xen-devel@lists.xen.org, Dongxiao Xu , Jun Nakajima List-Id: xen-devel@lists.xenproject.org >>> On 03.07.14 at 17:09, wrote: > --- a/xen/arch/x86/hvm/vmx/vmx.c > +++ b/xen/arch/x86/hvm/vmx/vmx.c > @@ -1654,6 +1654,18 @@ static void vmx_sync_pir_to_irr(struct vcpu *v) > vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]); > } > > +static void vmx_sync_irr_to_pir(struct vcpu *v) > +{ > + struct vlapic *vlapic = vcpu_vlapic(v); > + unsigned int vector; > + > + for ( vector = 0; vector < NR_VECTORS; vector++ ) { Coding style. > + if ( vlapic_test_vector(vector, &vlapic->regs->data[APIC_IRR]) ) > + vlapic_set_irq(vlapic, vector, > + vlapic_test_vector(vector, &vlapic->regs->data[APIC_TMR])); You would get away with using vlapic_test_and_clear_vector() (i.e. without introducing vlapic_test_vector()), since vlapic_set_irq() will set the flag again if it was found set here. And still the question remains whether to really use vlapic_set_irq() here, or rather open code the pieces of it that we actually need (at once allowing to eliminate two indirect function calls). Let's see what the VMX maintainers have to say. Jan