From patchwork Fri Oct 23 22:15:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 55511 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1487234lbq; Fri, 23 Oct 2015 15:16:38 -0700 (PDT) X-Received: by 10.68.200.104 with SMTP id jr8mr7362617pbc.91.1445638598347; Fri, 23 Oct 2015 15:16:38 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v13si32585489pas.84.2015.10.23.15.16.38; Fri, 23 Oct 2015 15:16:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbbJWWQg (ORCPT + 28 others); Fri, 23 Oct 2015 18:16:36 -0400 Received: from mail-lf0-f43.google.com ([209.85.215.43]:32953 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752620AbbJWWQP (ORCPT ); Fri, 23 Oct 2015 18:16:15 -0400 Received: by lffv3 with SMTP id v3so98031562lff.0 for ; Fri, 23 Oct 2015 15:16:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=vo6KwH4x5ZXuYboNahdwcB9OnUhy5MdDFvV/9EuWaHE=; b=hrfneG5T/BvUDZWfSLFxYGAoUXBSgR7Gs3dg251qIpATVeVaYC6L2bh/eaJ9qVkxtb z5Pf3V1DTKgpaZehGUCv3FGaBKDwvWs9s3pRGFWI9eDerJbBXNfxI4pLf7m5s7m5lzro ccxCD4PwjrMkh4CrkuF04H64eYVf15fQar8A00cY6upWqo4ewIqTucvOm/l9gaG37iHC +KxvNYBr6BPI6Nyd1D0uCTORTtjFq0rq1nJJmz/tkRYW/lyHn9ezSa1763/C8o+DZEQK DdQa9GvHS1aYaiW9wXK8gPGH3giJIOY3B8YMSQzEtdyda/5mz7kfAYUDwcDZmfR7d4Q/ HPDA== X-Gm-Message-State: ALoCoQlSiKXGmle53UYlgb7RFVysxJPAidunN9F52AVX0Oye7BNbR83ns9YoRj/+FzgEHpkALZva X-Received: by 10.112.55.2 with SMTP id n2mr12514725lbp.59.1445638574161; Fri, 23 Oct 2015 15:16:14 -0700 (PDT) Received: from localhost.localdomain.localdomain (c-297471d5.01-192-6c756e10.cust.bredbandsbolaget.se. [213.113.116.41]) by smtp.gmail.com with ESMTPSA id f77sm3062710lfi.3.2015.10.23.15.16.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Oct 2015 15:16:13 -0700 (PDT) From: Linus Walleij To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Linus Walleij Subject: [PATCH 3/3] irqchip/gic: assign irqchip dynamically Date: Sat, 24 Oct 2015 00:15:53 +0200 Message-Id: <1445638553-8825-3-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1445638553-8825-1-git-send-email-linus.walleij@linaro.org> References: <1445638553-8825-1-git-send-email-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Cc: Jason Cooper Cc: Marc Zyngier Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Keep the static structs around, just delete the .name field assign them to the chips at registration time, updating the name field with the instance number. - Also enumerate the EOIMODE1 sub-chips. - Broke out this irqchip stuff from the rest of the series so as not to stress the irqchip maintainers. It has no dependencies on the other patches anyways, and can be merged stand-alone. Marc: can't test the EOIMODE1 thing, it's far above me, but it "should work". Is it correct that there is one unique and coupled EOIMODE1 instance per GIC instance like this? --- drivers/irqchip/irq-gic.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) -- 2.4.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c index 9ec8cf5137d9..fe87ac32fdbe 100644 --- a/drivers/irqchip/irq-gic.c +++ b/drivers/irqchip/irq-gic.c @@ -58,6 +58,8 @@ union gic_base { }; struct gic_chip_data { + struct irq_chip chip; + struct irq_chip eoimode1_chip; union gic_base dist_base; union gic_base cpu_base; #ifdef CONFIG_CPU_PM @@ -370,7 +372,6 @@ static void gic_handle_cascade_irq(struct irq_desc *desc) } static struct irq_chip gic_chip = { - .name = "GIC", .irq_mask = gic_mask_irq, .irq_unmask = gic_unmask_irq, .irq_eoi = gic_eoi_irq, @@ -386,7 +387,6 @@ static struct irq_chip gic_chip = { }; static struct irq_chip gic_eoimode1_chip = { - .name = "GICv2", .irq_mask = gic_eoimode1_mask_irq, .irq_unmask = gic_unmask_irq, .irq_eoi = gic_eoimode1_eoi_irq, @@ -880,11 +880,12 @@ 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]) - chip = &gic_eoimode1_chip; + chip = &gic->eoimode1_chip; } if (hw < 32) { @@ -989,6 +990,13 @@ 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 = gic_chip; + gic->eoimode1_chip = gic_eoimode1_chip; + gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr); + gic->eoimode1_chip.name = kasprintf(GFP_KERNEL, "GICv2%d", gic_nr); + #ifdef CONFIG_GIC_NON_BANKED if (percpu_offset) { /* Frankein-GIC without banked registers... */ unsigned int cpu;