All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: David Gibson <david@gibson.dropbear.id.au>,
	qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v4 1/3] spapr: introduce a fixed IRQ number space
Date: Fri, 6 Jul 2018 16:16:38 +0200	[thread overview]
Message-ID: <20180706161638.07032b4f@bahia.lan> (raw)
In-Reply-To: <28391e09-2e15-6050-e452-0493172a73a4@kaod.org>

On Fri, 6 Jul 2018 15:27:17 +0200
Cédric Le Goater <clg@kaod.org> wrote:

>   > +/*
> > + * The register property of a VIO device is defined in livirt using a
> > + * base number + 0x1000 increment and in QEMU by incrementing the base
> > + * register number 0x71000000.
> > + *
> > + * The formula below tries to compute a unique index number from the
> > + * register value that will be used to define the IRQ number of the
> > + * VIO device. A maximum of 256 (0x100) VIO devices is covered.
> > + *
> > + * To minimize collisions, we define two distinct ranges depending on
> > + * the "reg" value definition:
> > + *
> > + *     [0x00 - 0x7f]    user/libvirt
> > + *     [0x80 - 0xff]    QEMU VIO model
> > + *
> > + * Collisions will be detected when the IRQ is claimed.
> > + */
> > +static inline uint32_t spapr_vio_reg_to_irq(uint32_t reg)
> > +{
> > +    if (reg >= SPAPR_VIO_REG_BASE) {
> > +        return SPAPR_IRQ_VIO | (reg & 0x7f) | 0x80;
> > +    } else {
> > +        return SPAPR_IRQ_VIO | ((reg & 0x7f) ^ ((reg >> 12) & 0x7f));  
> 
> This is not good enough for the VIO devices with a user defined "reg".
> 
> I propose to extract bits [29-28] and [16-12] to compose a 7bit index :
> 
> 	(((reg >> 28) & 0x3) << 5) | ((reg >> 12) & 0x1f)
> 

Looks good.

> That would give us a mapping :
> 
> 	0x00000000  -> 0
> 	0x00001000  -> 1
> 		...
> 	0x0001F000  -> 31
> 	0x10000000  -> 32
> 	0x10001000  -> 33
> 		...
> 	0x1001F000  -> 63
> 	0x20000000  -> 64
> 	0x20001000  -> 65
> 		...
> 	0x2001F000  -> 95
> 	0x30000000  -> 96
> 	0x30001000  -> 97
> 		...
> 	0x3001F000  -> 127
> 
> C.
> 
> 

  reply	other threads:[~2018-07-06 14:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-06  9:07 [Qemu-devel] [PATCH v4 0/3] spapr: introduce a fixed IRQ number space and an IRQ controller backend Cédric Le Goater
2018-07-06  9:07 ` [Qemu-devel] [PATCH v4 1/3] spapr: introduce a fixed IRQ number space Cédric Le Goater
2018-07-06 13:27   ` Cédric Le Goater
2018-07-06 14:16     ` Greg Kurz [this message]
2018-07-06 16:43       ` Cédric Le Goater
2018-07-06 13:36   ` Greg Kurz
2018-07-06 14:09     ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2018-07-20  2:38     ` [Qemu-devel] " David Gibson
2018-07-23 15:20       ` Cédric Le Goater
2018-07-20  2:18   ` David Gibson
2018-07-23 16:04     ` Cédric Le Goater
2018-07-06  9:07 ` [Qemu-devel] [PATCH v4 2/3] spapr: introduce a IRQ controller backend to the machine Cédric Le Goater
2018-07-06  9:07 ` [Qemu-devel] [PATCH v4 3/3] spapr: increase the size of the IRQ number space Cédric Le Goater

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=20180706161638.07032b4f@bahia.lan \
    --to=groug@kaod.org \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.