From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v5 3/6] xen/arm: observe itargets setting in vgic_enable_irqs and vgic_disable_irqs Date: Thu, 12 Jun 2014 10:45:52 +0100 Message-ID: <539976D0.4050305@linaro.org> References: <1402504032-13267-3-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: <1402504032-13267-3-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 11/06/14 17:27, Stefano Stabellini wrote: > +static struct vcpu *_vgic_get_target_vcpu(struct vcpu *v, unsigned int irq) [..] > +struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int irq) Can you add comment explaining what are the differences between these 2 functions? AFAIU, the first one is assuming the rank lock is taken. If so, I would add an ASSERT in it. I would avoid people misuse the 2 functions. > case GICD_ISPENDR ... GICD_ISPENDRN: > @@ -589,12 +625,23 @@ static int vgic_distr_mmio_write(struct vcpu *v, mmio_info_t *info) > if ( dabt.size != 0 && dabt.size != 2 ) goto bad_width; > rank = vgic_rank_offset(v, 8, gicd_reg - GICD_ITARGETSR); > if ( rank == NULL) goto write_ignore; > + /* 8-bit vcpu mask for this domain */ BUG_ON(v->domain->max_vcpus > 8)? Just for enforcement. > + tr = (1 << v->domain->max_vcpus) - 1; > + tr = tr | (tr << 8) | (tr << 16) | (tr << 24); > + tr &= *r; > + /* ignore zero writes */ > + if ( !tr ) > + goto write_ignore; > + if ( dabt.size == 2 && > + !((tr & 0xff) && (tr & (0xff << 8)) && > + (tr & (0xff << 16)) && (tr & (0xff << 24)))) > + goto write_ignore; I quite difficult to understand this check. Does this check is only for word-access? AFAIU, with byte-access it's possible to write 0 in itargets. For this case, the register may contain some 1 out of the byte offset. Regards, -- Julien Grall