From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Stabellini Subject: Re: [PATCH v5 3/6] xen/arm: observe itargets setting in vgic_enable_irqs and vgic_disable_irqs Date: Thu, 12 Jun 2014 15:42:53 +0100 Message-ID: References: <1402504032-13267-3-git-send-email-stefano.stabellini@eu.citrix.com> <539976D0.4050305@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <539976D0.4050305@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com, Ian.Campbell@citrix.com, Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, 12 Jun 2014, Julien Grall wrote: > 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. OK > > 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. OK > > + 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? The previous test covers byte-access after the change of the following patch. I should move it to this patch to make it clearer. > 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.