All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
	xen-devel@lists.xensource.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH 3/4] xen: events: add xen_allocate_irq_{dynamic, gsi} and xen_free_irq
Date: Tue, 11 Jan 2011 13:46:25 -0500	[thread overview]
Message-ID: <20110111184625.GB29378@dumpdata.com> (raw)
In-Reply-To: <1294766416-11407-3-git-send-email-ian.campbell@citrix.com>

On Tue, Jan 11, 2011 at 05:20:15PM +0000, Ian Campbell wrote:
> This is neater than open-coded calls to irq_alloc_desc_at and
> irq_free_desc.
> 
> No intended behavioural change.
> 
> Note that we previously were not checking the return value of
> irq_alloc_desc_at which would be failing for GSI<NR_IRQS_LEGACY
> because the core architecture code has already allocated those for
> us. Hence the additional check against NR_IRQS_LEGACY in
> xen_allocate_irq_gsi.
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
> ---
>  drivers/xen/events.c |   53 +++++++++++++++++++++++++++++++++-----------------
>  1 files changed, 35 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/xen/events.c b/drivers/xen/events.c
> index ae8d45d..74fb216 100644
> --- a/drivers/xen/events.c
> +++ b/drivers/xen/events.c
> @@ -384,7 +384,7 @@ static int get_nr_hw_irqs(void)
>  	return ret;
>  }
>  
> -static int find_unbound_irq(void)
> +static int xen_allocate_irq_dynamic(void)
>  {
>  	struct irq_data *data;
>  	int irq, res;
> @@ -442,6 +442,30 @@ static bool identity_mapped_irq(unsigned irq)
>  	return irq < get_nr_hw_irqs();
>  }
>  
> +static int xen_allocate_irq_gsi(unsigned gsi)
> +{
> +	int irq;
> +
> +	if (!identity_mapped_irq(gsi) &&
> +	    (xen_initial_domain() || !xen_pv_domain()))

Perhaps 'xen_hvm_domain()' would sound better? That way there
are less _not_ expressions to think through?

> +		return xen_allocate_irq_dynamic();

Ok, so this ends up allocating an IRQ for all non-physical
IRQs, such as the spinlock, call IPI, and so on, correct?

> +
> +	/* Legacy IRQ descriptors are already allocated by the arch. */
> +	if (gsi < NR_IRQS_LEGACY)
> +		return gsi;
> +
> +	irq = irq_alloc_desc_at(gsi, -1);
> +	if (irq < 0)
> +		panic("Unable to allocate to IRQ%d (%d)\n", gsi, irq);
> +
> +	return irq;
> +}
> +
> +static void xen_free_irq(unsigned irq)
> +{
> +	irq_free_desc(irq);
This is still OK even if the IRQ is < NR_IRQS_LEGACY? You mention
"Legacy IRQ descriptors are already allocated by the arch" so I would
think that the arch would take care of de-allocating those?

  reply	other threads:[~2011-01-11 18:46 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-11 17:19 [PATCH 0/4] xen: events: improve event channel IRQ allocation strategy Ian Campbell
2011-01-11 17:20 ` [PATCH 1/4] xen: handled remapped IRQs when enabling a pcifront PCI device Ian Campbell
2011-01-11 17:20 ` [PATCH 2/4] xen:events: move find_unbound_irq inside CONFIG_PCI_MSI Ian Campbell
2011-01-11 17:20 ` [PATCH 3/4] xen: events: add xen_allocate_irq_{dynamic, gsi} and xen_free_irq Ian Campbell
2011-01-11 18:46   ` Konrad Rzeszutek Wilk [this message]
2011-01-11 19:32     ` Ian Campbell
2011-02-03  8:30   ` [PATCH] xen: events: do not free legacy IRQs Ian Campbell
2011-02-03  9:49     ` Ian Campbell
2011-01-11 17:20 ` [PATCH 4/4] xen: events: allocate GSIs and dynamic IRQs from separate IRQ ranges Ian Campbell
2011-01-11 19:14   ` Konrad Rzeszutek Wilk
2011-01-11 19:39     ` Ian Campbell
2011-01-11 18:34 ` [PATCH 0/4] xen: events: improve event channel IRQ allocation strategy Konrad Rzeszutek Wilk
2011-01-11 19:25   ` Ian Campbell
2011-01-11 20:40     ` Konrad Rzeszutek Wilk
2011-01-12 10:04       ` Ian Campbell

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=20110111184625.GB29378@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=jeremy@goop.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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.