From patchwork Mon Nov 2 14:34:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 55900 Delivered-To: patch@linaro.org Received: by 10.112.61.134 with SMTP id p6csp1302376lbr; Mon, 2 Nov 2015 06:34:36 -0800 (PST) X-Received: by 10.182.66.116 with SMTP id e20mr14115934obt.68.1446474876074; Mon, 02 Nov 2015 06:34:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wk6si11911248oeb.101.2015.11.02.06.34.34; Mon, 02 Nov 2015 06:34:36 -0800 (PST) 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; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753876AbbKBOe1 (ORCPT + 28 others); Mon, 2 Nov 2015 09:34:27 -0500 Received: from mail-lf0-f43.google.com ([209.85.215.43]:33655 "EHLO mail-lf0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753786AbbKBOeW (ORCPT ); Mon, 2 Nov 2015 09:34:22 -0500 Received: by lfbf136 with SMTP id f136so48321742lfb.0 for ; Mon, 02 Nov 2015 06:34:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=/T/TwpbzvJBDQN9v2LwCAkz4UXMe0PhxTXyrVLJ2oCs=; b=vEH6TkkqDEuxt1DXDCWm7MwtV43AeCyI2wE+Kd/V1rf6WoakJUVMYrF8yjqq4PojGk y4b1acWVxaclbBpNo/Bs7sHYS4gzu3aAtH1FkKoW5VRDt9MqBKuVKQ527w8kcdVXBlo8 kH2YMyAKt8ZwEOgIZ1hNhVPDXKpeSow7akkSS8Ph6Nk+enLLpMu+J8ZVYJ3KvHUwVgEk i8iAzZZSW6diws2h5AKUyByXtjc4dLaYOJrKHP0v9y66a27UP8VupHXb4mTFYMOwzU0d VcbrBvV+JJkzw9dzGxOxfFOWV5pZ09NUd2DUe/+bgVrXHm5Wa8FuVa/KVKbF3pXYsiOw O4Kw== 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; bh=/T/TwpbzvJBDQN9v2LwCAkz4UXMe0PhxTXyrVLJ2oCs=; b=Wbb7hKu8emF4Xn5QAtWXXjLaKrMqsbd9G+cjmMmD4bt/CsuoQrd5XvVN2hTw0zuPv8 I4V0B/cgMNkizx4ZvuxeVYo+fXSyLQxNNyr2GcFZsbnFY8de1mGB2n/Z/gXIJ4yWOf2J 9lx8P+jjz6IF1LCXsd9dn+kX1L+fW76tyQPqWzbuLUFpcggZQj/ufB7CwfBQEqDVmWXO yU2aQ6YRWQq1RJzytdlySM3L1ADI/a2Q4zpc7++85O2UxJFbtgW2gUj4L9fkkRAeUTWy uqD2rdBSS+a7gIEhiK9eQtANO+jsqwJw59U54Nv6WhtzT4YD7+HDJ5yzPwzaOG1Y118T ux6Q== X-Gm-Message-State: ALoCoQl38/HrH3M9N5hm7X8OkfkX0HmqP+l6/QPL5eRmwUnAJg7vX1HlWuLkIVS9FNVd/LcJI/ok X-Received: by 10.25.33.143 with SMTP id h137mr6752642lfh.16.1446474860418; Mon, 02 Nov 2015 06:34:20 -0800 (PST) Received: from localhost.localdomain ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a13sm4028810lfa.32.2015.11.02.06.34.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Nov 2015 06:34:19 -0800 (PST) From: Linus Walleij To: Thomas Gleixner , Jason Cooper , Marc Zyngier Cc: linux-kernel@vger.kernel.org, Linus Walleij Subject: [PATCH 05/13 v3] irqchip/gic: assign irqchip dynamically Date: Mon, 2 Nov 2015 15:34:12 +0100 Message-Id: <1446474852-28043-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 2.4.3 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 v2->v3: - Handle the EOIMODE1 chips properly: select a proper &chip pointer at chip registration and store in the per-GIC .chip member. Saves hard-to-grasp code in the .map function too. We select the EOIMODE1 chip if and only if it's GIC0 and the machine suppors deactivation. - Name ordinary GIC chips GIC0, ... GICN and the EOIMODE1 chip GICEOI, as there can be only one such chip. 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 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 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..9c61ca182433 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 @@ -370,7 +371,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 +386,7 @@ static struct irq_chip gic_chip = { }; static struct irq_chip gic_eoimode1_chip = { - .name = "GICv2", + .name = "GICEOI", .irq_mask = gic_eoimode1_mask_irq, .irq_unmask = gic_unmask_irq, .irq_eoi = gic_eoimode1_eoi_irq, @@ -880,12 +880,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; - - if (static_key_true(&supports_deactivate)) { - if (d->host_data == (void *)&gic_data[0]) - chip = &gic_eoimode1_chip; - } + struct gic_chip_data *gic = d->host_data; + struct irq_chip *chip = &gic->chip; if (hw < 32) { irq_set_percpu_devid(irq); @@ -989,6 +985,9 @@ 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]; + gic->chip = gic_chip; + gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr); + #ifdef CONFIG_GIC_NON_BANKED if (percpu_offset) { /* Frankein-GIC without banked registers... */ unsigned int cpu; @@ -1079,8 +1078,10 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start, register_cpu_notifier(&gic_cpu_notifier); #endif set_handle_irq(gic_handle_irq); - if (static_key_true(&supports_deactivate)) + if (static_key_true(&supports_deactivate)) { pr_info("GIC: Using split EOI/Deactivate mode\n"); + gic->chip = gic_eoimode1_chip; + } } gic_dist_init(gic);