From: Stefano Stabellini Subject: Re: [RFC PATCH] xen/arm: Deliver interrupts to vcpu specified in IROUTER Date: Tue, 9 Sep 2014 00:25:23 +0100 Message-ID: References: <1409839463-4437-1-git-send-email-vijay.kilari@gmail.com> <1410184031.3680.36.camel@kazak.uk.xensource.com> <1410188085.3680.47.camel@kazak.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1410188085.3680.47.camel@kazak.uk.xensource.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: Ian Campbell Cc: Vijay Kilari , Stefano Stabellini , Prasun Kapoor , manish.jaggi@caviumnetworks.com, Julien Grall , Tim Deegan , "xen-devel@lists.xen.org" , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Mon, 8 Sep 2014, Ian Campbell wrote: > On Mon, 2014-09-08 at 19:55 +0530, Vijay Kilari wrote: > > On Mon, Sep 8, 2014 at 7:33 PM, Vijay Kilari wrote: > > > On Mon, Sep 8, 2014 at 7:17 PM, Ian Campbell wrote: > > >> On Mon, 2014-09-08 at 19:11 +0530, Vijay Kilari wrote: > > >> > > >> Why have we dropped the list? > > > > > > I have not dropped the list. I still see list in my email. > > > > > >> > > >>> Hi Stefano, > > >>> > > >>> Apart from your comments below, I encounter below scenario. > > >>> > > >>> The below function vgic_irq_rank() in vgic.c is not generic. The rank is always > > >>> depends on register type it is going to access. So it cannot be > > >>> just hardcoded. > > >>> > > >>> struct vgic_irq_rank *(struct vcpu *v, unsigned int irq) > > >>> { > > >>> return vgic_rank_offset(v, 8, irq, DABT_WORD); > > >>> } > > >>> > > >>> This function works ok for GIC v2. But this cannot be used for > > >>> GICv3 to access registers like IROUTER which are u64. The rank > > >>> calcuation goes wrong and there by takes wrong rank lock. > > >> > > >> This sounds to me like a bug which should be fixed. A rank is just a > > >> group of 32 consecutive IRQs and their associated register values, it > > >> shouldn't matter whether those registers are 8-, 16-, 32- or 64-bits. > > > > > > Now I think of creating a callback to return the right rank for given irq > > > based on v2 or v3. This will fix and keep the old code intact. > > > > This should fix the issue. > > Looks plausible. Will you fold it into your series? It looks OK to me too. > > struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq) > > { > > - return vgic_rank_offset(v, 8, irq, DABT_WORD); > > + int rank = irq/32; > > > > + if ( rank == 0 ) > > + return v->arch.vgic.private_irqs; > > + else if ( rank <= DOMAIN_NR_RANKS(v->domain) ) > > + return &v->domain->arch.vgic.shared_irqs[rank - 1]; > > + else > > + return NULL; > > } > >