qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, agraf@suse.de
Subject: Re: [Qemu-devel] [PATCH 1/3] spapr: allow creating devices with -device
Date: Mon, 30 May 2011 13:16:29 +1000	[thread overview]
Message-ID: <20110530031629.GA5926@yookeroo.fritz.box> (raw)
In-Reply-To: <4DDCAFD6.1060900@redhat.com>

On Wed, May 25, 2011 at 09:29:26AM +0200, Paolo Bonzini wrote:
> On 05/25/2011 12:12 AM, David Gibson wrote:
> >>@@ -602,6 +604,8 @@ static int spapr_vio_busdev_init(DeviceState *qdev, DeviceInfo *qinfo)
> >>      }
> >>
> >>      dev->qdev.id = id;
> >>+    dev->vio_irq_num = bus->irq++;
> >>+    dev->qirq = xics_find_qirq(spapr->icp, dev->vio_irq_num);
> >
> >I'd prefer to see an spapr_allocate_irq() function, rather than open
> >coding this multiple times.
> 
> I don't understand.  This is the only call to xics_find_qirq, unlike
> before this patch.  It's not open coded multiple times.

Uh, sorry, I wasn't thinking it through when I assumed it was
duplicated.

Actually, in any case I wouldn't mind multiple calls to
xics_find_qirq(), it's the actual allocation - the irq++ - being
potentially duplicated which bothers me.  It's not now, but with this
approach it would need to be when we add non VIO devices to the system
which is coming (PCI, virtio, ..).

> I can surely add a spapr_allocate_irq() function that would keep the
> code independent of the particular interrupt controller.  Would you
> prefer something that gives back the virtual IRQ number as well:
> 
>     qemu_irq *spapr_allocate_irq(uint32_t *p_vio_irq_num)
> 
> or should I keep that in the VIOsPAPRBus, like this:
> 
>     qemu_irq *spapr_allocate_irq(uint32_t p_vio_irq_num)

In fact just returning the xics irq num and using xics_find_qirq() on
that would be ok by me.  The point is that I don't want the policy for
irq allocation on the global interrupt controller to be open coded
here at the bus level.

> ?  Should I pass a sPAPREnvironment too, or should it just use the global?

Passing it would be preferable.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

  reply	other threads:[~2011-05-30  3:17 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-24 11:45 [Qemu-devel] [PATCH 0/3] spapr qdevification Paolo Bonzini
2011-05-24 11:45 ` [Qemu-devel] [PATCH 1/3] spapr: allow creating devices with -device Paolo Bonzini
2011-05-24 13:03   ` Markus Armbruster
2011-05-24 13:08     ` Paolo Bonzini
2011-05-24 13:34       ` Markus Armbruster
2011-05-24 22:12   ` David Gibson
2011-05-25  7:29     ` Paolo Bonzini
2011-05-30  3:16       ` David Gibson [this message]
2011-05-24 11:45 ` [Qemu-devel] [PATCH 2/3] spapr: prepare for qdevification of irq Paolo Bonzini
2011-05-24 11:45 ` [Qemu-devel] [PATCH 3/3] spapr: make irq customizable via qdev Paolo Bonzini
2011-05-24 22:14   ` David Gibson
2011-05-25  7:30     ` Paolo Bonzini
2011-05-30  3:16       ` David Gibson
2011-05-25 15:13     ` Markus Armbruster
2011-05-30  3:17       ` David Gibson
2011-05-24 13:04 ` [Qemu-devel] [PATCH 0/3] spapr qdevification Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110530031629.GA5926@yookeroo.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=agraf@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).