All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 05/13] irqchip/gic: assign irqchip dynamically
Date: Thu, 15 Oct 2015 17:16:00 +0100	[thread overview]
Message-ID: <561FD140.4010809@arm.com> (raw)
In-Reply-To: <1444916813-31024-6-git-send-email-linus.walleij@linaro.org>

Hi Linus,

On 15/10/15 14:46, Linus Walleij wrote:
> Instead of having the irqchip being a static struct, make it part
> of the per-instance data so we can assign it a dynamic name. This
> has the usable side effect of displaying the GIC with an instance
> number as GIC0, GIC1 ... GICn in /proc/interrupts, which is helpful
> when debugging cascaded GICs, such as on the ARM PB11MPCore.
> 
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Fellas please say what you think about this:
> Yes / No / Linus is an idiot
> This can be applied directly to the irqchip tree if you like
> it, AFAIK it has no dependencies.
> ---
>  drivers/irqchip/irq-gic.c | 36 +++++++++++++++++++-----------------
>  1 file changed, 19 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index bd021e1e4847..478279cf9517 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -58,6 +58,7 @@ union gic_base {
>  };
>  
>  struct gic_chip_data {
> +	struct irq_chip chip;
>  	union gic_base dist_base;
>  	union gic_base cpu_base;
>  #ifdef CONFIG_CPU_PM
> @@ -369,22 +370,6 @@ static void gic_handle_cascade_irq(struct irq_desc *desc)
>  	chained_irq_exit(chip, desc);
>  }
>  
> -static struct irq_chip gic_chip = {
> -	.name			= "GIC",
> -	.irq_mask		= gic_mask_irq,
> -	.irq_unmask		= gic_unmask_irq,
> -	.irq_eoi		= gic_eoi_irq,
> -	.irq_set_type		= gic_set_type,
> -#ifdef CONFIG_SMP
> -	.irq_set_affinity	= gic_set_affinity,
> -#endif
> -	.irq_get_irqchip_state	= gic_irq_get_irqchip_state,
> -	.irq_set_irqchip_state	= gic_irq_set_irqchip_state,
> -	.flags			= IRQCHIP_SET_TYPE_MASKED |
> -				  IRQCHIP_SKIP_SET_WAKE |
> -				  IRQCHIP_MASK_ON_SUSPEND,
> -};
> -
>  static struct irq_chip gic_eoimode1_chip = {
>  	.name			= "GICv2",
>  	.irq_mask		= gic_eoimode1_mask_irq,
> @@ -880,7 +865,8 @@ void __init gic_init_physaddr(struct device_node *node)
>  static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
>  				irq_hw_number_t hw)
>  {
> -	struct irq_chip *chip = &gic_chip;
> +	struct gic_chip_data *gic = d->host_data;
> +	struct irq_chip *chip = &gic->chip;
>  
>  	if (static_key_true(&supports_deactivate)) {
>  		if (d->host_data == (void *)&gic_data[0])
> @@ -989,6 +975,22 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
>  	BUG_ON(gic_nr >= MAX_GIC_NR);
>  
>  	gic = &gic_data[gic_nr];
> +
> +	/* Initialize irq_chip */
> +	gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr);
> +	gic->chip.irq_mask = gic_mask_irq;
> +	gic->chip.irq_unmask = gic_unmask_irq;
> +	gic->chip.irq_eoi = gic_eoi_irq;
> +	gic->chip.irq_set_type	= gic_set_type;
> +#ifdef CONFIG_SMP
> +	gic->chip.irq_set_affinity = gic_set_affinity;
> +#endif
> +	gic->chip.irq_get_irqchip_state = gic_irq_get_irqchip_state;
> +	gic->chip.irq_set_irqchip_state = gic_irq_set_irqchip_state;
> +	gic->chip.flags = IRQCHIP_SET_TYPE_MASKED |
> +		IRQCHIP_SKIP_SET_WAKE |
> +		IRQCHIP_MASK_ON_SUSPEND;
> +

How does it work when we want to use the ops from gic_eoimode1_chip? I
don't think it breaks, but it is a bit weird.

You could also replace this sequence by keeping the original structure
and assigning it to the embedded one (I don't think you save much by
replacing this with discreet field assignment).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-10-15 16:16 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-15 13:46 [PATCH 00/13] Device Tree support for RealView PB11MPCore Linus Walleij
2015-10-15 13:46 ` [PATCH 02/13] ARM: add DT bindings for the ARM11MPCore CPU cluster Linus Walleij
     [not found] ` <1444916813-31024-1-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-15 13:46   ` [PATCH 01/13] ARM: add some L220 DT settings Linus Walleij
2015-10-15 13:46     ` Linus Walleij
     [not found]     ` <1444916813-31024-2-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-10-15 13:57       ` Russell King - ARM Linux
2015-10-15 13:57         ` Russell King - ARM Linux
     [not found]         ` <20151015135730.GC32532-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2015-10-22 12:57           ` Linus Walleij
2015-10-22 12:57             ` Linus Walleij
2015-10-15 13:58       ` Rob Herring
2015-10-15 13:58         ` Rob Herring
2015-10-15 13:46   ` [PATCH 03/13] irqchips: fix ARM11MPCore GIC bindings Linus Walleij
2015-10-15 13:46     ` Linus Walleij
     [not found]     ` <1444916813-31024-4-git-send-email-linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-02 14:35       ` Rob Herring
2015-11-02 14:35         ` Rob Herring
2015-10-15 13:46 ` [PATCH 04/13] irqchip/gic: support RealView variant setup Linus Walleij
2015-10-15 16:06   ` Marc Zyngier
2015-10-16  8:28   ` Thomas Gleixner
2015-10-15 13:46 ` [PATCH 05/13] irqchip/gic: assign irqchip dynamically Linus Walleij
2015-10-15 16:16   ` Marc Zyngier [this message]
2015-10-15 13:46 ` [PATCH 06/13] clk: versatile-icst: convert to use regmap Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:08   ` Stephen Boyd
2015-10-15 19:08     ` Stephen Boyd
2015-10-23  9:27     ` Linus Walleij
2015-10-23  9:27       ` Linus Walleij
2015-10-23  9:37       ` Linus Walleij
2015-10-23  9:37         ` Linus Walleij
2015-10-23 16:24       ` Stephen Boyd
2015-10-23 16:24         ` Stephen Boyd
2015-10-27 15:56         ` Linus Walleij
2015-10-27 15:56           ` Linus Walleij
2015-10-15 13:46 ` [PATCH 07/13] clk: versatile-icst: refactor to allocate regmap separately Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:10   ` Stephen Boyd
2015-10-15 19:10     ` Stephen Boyd
2015-10-15 19:28   ` Stephen Boyd
2015-10-15 19:28     ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 08/13] clk: add ARM syscon ICST device tree bindings Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:23   ` Stephen Boyd
2015-10-15 19:23     ` Stephen Boyd
     [not found]     ` <20151015192325.GN4558-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-10-23  9:48       ` Linus Walleij
2015-10-23  9:48         ` Linus Walleij
2015-10-23  9:48         ` Linus Walleij
2015-10-23 16:43         ` Stephen Boyd
2015-10-23 16:43           ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 09/13] clk: versatile-icst: add device tree support Linus Walleij
2015-10-15 13:46   ` Linus Walleij
2015-10-15 19:26   ` Stephen Boyd
2015-10-15 19:26     ` Stephen Boyd
2015-10-26 13:14     ` Linus Walleij
2015-10-26 13:14       ` Linus Walleij
2015-10-26 13:31       ` Russell King - ARM Linux
2015-10-26 13:31         ` Russell King - ARM Linux
2015-10-29 13:00         ` Linus Walleij
2015-10-29 13:00           ` Linus Walleij
2015-10-15 19:28   ` Stephen Boyd
2015-10-15 19:28     ` Stephen Boyd
2015-10-15 13:46 ` [PATCH 10/13] soc: versatile: add support for the PB11MPCore Linus Walleij
2015-10-15 13:46 ` [PATCH 11/13] ARM: realview: select SP810 and ICST for the DT variant Linus Walleij
2015-10-15 13:46 ` [PATCH 12/13] ARM: realview: add an DT SMP boot method Linus Walleij
2015-10-15 13:46 ` [PATCH 13/13] ARM: realview: add device tree for PB11MPCore Linus Walleij

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=561FD140.4010809@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.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.