From: Ian Campbell Subject: Re: [PATCH v4 4/4] xen/arm: physical irq follow virtual irq Date: Wed, 11 Jun 2014 16:14:32 +0100 Message-ID: <1402499672.16332.37.camel@kazak.uk.xensource.com> References: <1402076908-26740-4-git-send-email-stefano.stabellini@eu.citrix.com> <1402403262.1250.90.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: 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 Cc: julien.grall@citrix.com, xen-devel@lists.xensource.com, JBeulich@suse.com List-Id: xen-devel@lists.xenproject.org On Wed, 2014-06-11 at 15:47 +0100, Stefano Stabellini wrote: > > > +void vgic_move_irqs(struct vcpu *v) > > > +{ > > > + const cpumask_t *cpu_mask = cpumask_of(v->processor); > > > + struct domain *d = v->domain; > > > + struct pending_irq *p; > > > + int i, j, k; > > > + > > > + for ( i = 0; i < DOMAIN_NR_RANKS(d); i++ ) > > > + { > > > + for ( j = 0 ; j < 8 ; j++ ) > > > + { > > > + for ( k = 0; k < 4; k++ ) > > > + { > > > + uint8_t target = byte_read(d->arch.vgic.shared_irqs[i].itargets[j], 0, k); > > > > i,j,k are pretty opaque here (and I wrote that before I saw the > > machinations going on in the irq_to_pending call!). > > > > Please just iterate over irqs and use the rank accessor functions to get > > to the correct itargets to read. Which might be clearest with the > > irq_to_rank helper I proposed on an earlier patch. > > I hacked the alternative solution and I prefer this version. But, but, this way is horrible! How much worse could the alternative have been!