From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v4 1/4] xen/arm: observe itargets setting in vgic_enable_irqs and vgic_disable_irqs Date: Sat, 07 Jun 2014 15:33:55 +0100 Message-ID: <539322D3.8040504@linaro.org> References: <1402076908-26740-1-git-send-email-stefano.stabellini@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1402076908-26740-1-git-send-email-stefano.stabellini@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini , xen-devel@lists.xensource.com Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com List-Id: xen-devel@lists.xenproject.org Hi Stefano, On 06/06/14 18:48, Stefano Stabellini wrote: > return 0; > } > > @@ -369,6 +377,22 @@ read_as_zero: > return 1; > } > > +struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq) > +{ > + int target; > + struct vgic_irq_rank *rank; > + struct vcpu *v_target; > + > + rank = vgic_irq_rank(v, 1, irq/32); > + vgic_lock_rank(v, rank); > + target = byte_read(rank->itargets[(irq%32)/4], 0, irq % 4); > + /* just return the first vcpu in the mask */ > + target = find_next_bit((const unsigned long *) &target, 8, 0); int* and unsigned long* doesn't have the same alignment on aarch64. This may end up to a data abort for Xen side. IIRC, Ian has fixed a similar issue in commit 5224a733. [..] > } > if ( p->desc != NULL ) > { > @@ -502,6 +530,7 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info) > int offset = (int)(info->gpa - v->domain->arch.vgic.dbase); > int gicd_reg = REG(offset); > uint32_t tr; > + int i; > > switch ( gicd_reg ) > { > @@ -585,6 +614,21 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info) > rank = vgic_irq_rank(v, 8, gicd_reg - GICD_ITARGETSR); > if ( rank == NULL) goto write_ignore; > vgic_lock_rank(v, rank); > + tr = *r & ~(rank->itargets[REG_RANK_INDEX(8, gicd_reg - GICD_ITARGETSR)]); Write in GICD_ITARGETSR can be either half-word or word. If I'm not mistaken you sanity check only handle word access. Regards, -- Julien Grall