linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: haojian.zhuang@linaro.org (Haojian Zhuang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v16 8/9] irq: enable hip04 irq chip
Date: Thu, 7 Aug 2014 13:26:23 +0800	[thread overview]
Message-ID: <CAD6h2NTitNd8CEu0YGgb5PBasYzbtUspgeCD3fCBnx23h2tMWw@mail.gmail.com> (raw)
In-Reply-To: <53E2493A.1080202@arm.com>

On 6 August 2014 23:26, Andre Przywara <andre.przywara@arm.com> wrote:
> Hi,
>
> to me this looks much better than the version integrated into irq-gic.c
> and is reasonably small and self-contained.
>
> See for comments below...
>
> On 04/08/14 03:58, Haojian Zhuang wrote:
>> HiP04 GIC is the variate of ARM GICv2.
>>
>> ARM GICv2 supports 8 cores. HiP04 GIC extends to support 16 cores. It
>> results that bit fields in GIC_DIST_TARGET & GIC_DIST_SOFTINT are
>> different from ARM GICv2. And the maximium IRQ is downgrade from 1020 to 510.
>>
>> Since different register offset & bitfields definitation breaks
>> compartible with ARM GICv2, create a new hip04 irq driver.
>>
>> Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
>> ---
>>  drivers/irqchip/Makefile    |   1 +
>>  drivers/irqchip/irq-hip04.c | 429 ++++++++++++++++++++++++++++++++++++++++++++
>>  2 files changed, 430 insertions(+)
>>  create mode 100644 drivers/irqchip/irq-hip04.c
>>
>> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
>> index c57e642..23dcf45 100644
>> --- a/drivers/irqchip/Makefile
>> +++ b/drivers/irqchip/Makefile
>> @@ -2,6 +2,7 @@ obj-$(CONFIG_IRQCHIP)                 += irqchip.o
>>
>>  obj-$(CONFIG_ARCH_BCM2835)           += irq-bcm2835.o
>>  obj-$(CONFIG_ARCH_EXYNOS)            += exynos-combiner.o
>> +obj-$(CONFIG_ARCH_HIP04)             += irq-hip04.o
>>  obj-$(CONFIG_ARCH_MMP)                       += irq-mmp.o
>>  obj-$(CONFIG_ARCH_MVEBU)             += irq-armada-370-xp.o
>>  obj-$(CONFIG_ARCH_MXS)                       += irq-mxs.o
>> diff --git a/drivers/irqchip/irq-hip04.c b/drivers/irqchip/irq-hip04.c
>> new file mode 100644
>> index 0000000..751a7ee
>> --- /dev/null
>> +++ b/drivers/irqchip/irq-hip04.c
>> @@ -0,0 +1,429 @@
>> +/*
>> + * Hisilicon HiP04 INTC
>> + *
>> + * Copyright (C) 2002-2014 ARM Limited.
>> + * Copyright (c) 2013-2014 Hisilicon Ltd.
>> + * Copyright (c) 2013-2014 Linaro Ltd.
>> + *
>> + * This program is free software; you can redistribute it and/or modify
>> + * it under the terms of the GNU General Public License version 2 as
>> + * published by the Free Software Foundation.
>> + *
>> + * Interrupt architecture for the HIP04 INTC:
>> + *
>> + * o There is one Interrupt Distributor, which receives interrupts
>> + *   from system devices and sends them to the Interrupt Controllers.
>> + *
>> + * o There is one CPU Interface per CPU, which sends interrupts sent
>> + *   by the Distributor, and interrupts generated locally, to the
>> + *   associated CPU. The base address of the CPU interface is usually
>> + *   aliased so that the same address points to different chips depending
>> + *   on the CPU it is accessed from.
>> + *
>> + * Note that IRQs 0-31 are special - they are local to each CPU.
>> + * As such, the enable set/clear, pending set/clear and active bit
>> + * registers are banked per-cpu for these sources.
>> + */
>
> I'd find it more useful to have a reference to the GIC code here and
> only list the delta of the two drivers.
> Since you removed (almost) any references to GIC, to an uninitiated
> reader it's not obvious that this is in fact a stripped and tweaked GIC.
>
> So you could copy some of the rationale from the commit message into
> here, something along the lines of:
> ---------
> This is derived from irq-gic.c to support the HiSilicon HiP04 interrupt
> controller, which is similar to the GIC, but deviates at some points.
> Support for power management, non-banked registers, cascaded GICs (and
> multiple controllers in general) and bigLittle support has been removed
> from the GIC driver.
> Affinity related functions have been adjusted to match the HiSilicon
> hardware implementation.
> ---------
>
> By the way, you removed CONFIG_CPU_PM support, is there any reason for
> that? I don't see an issue code-wise with keeping this in.
>
Since we didn't enable power management on HiP04 yet, I removed them.
If we enable power management later, I could append them again.

>
>> +
>> +void hip04_cpu_if_down(void)
>> +{
>> +     writel_relaxed(0, hip04_data.cpu_base + GIC_CPU_CTRL);
>> +}
>
> Where is this used? The GIC counterpart is only called by some VExpress
> code, does your platform need a similar call? Otherwise (and since you
> don't seem to provide a public prototype) this function can be removed.
>

I should remove it. It doesn't help me.

>
>> +
>> +#ifdef CONFIG_SMP
>> +static void hip04_raise_softirq(const struct cpumask *mask, unsigned int irq)
>> +{
>> +     int cpu;
>> +     unsigned long flags, map = 0;
>> +
>> +     raw_spin_lock_irqsave(&irq_controller_lock, flags);
>> +
>> +     /* Convert our logical CPU mask into a physical one. */
>> +     for_each_cpu(cpu, mask)
>> +             map |= hip04_cpu_map[cpu];
>
> Are we sure that mask does not contain any CPU number higher than
> NR_HIP04_CPU_IF?
>
Yes, the maximum CPU number is 16. We shouldn't configure higher CPU
numbers in HiP04.

Regards
Haojian

  reply	other threads:[~2014-08-07  5:26 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-04  2:57 [PATCH v16 0/9] enable HiP04 SoC Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 1/9] ARM: mcpm: support 4 clusters Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 2/9] ARM: hisi: enable MCPM implementation Haojian Zhuang
2014-08-04 22:43   ` Nicolas Pitre
2014-08-05  0:07     ` Haojian Zhuang
2014-08-05  1:02       ` Nicolas Pitre
2014-08-05  1:18         ` Haojian Zhuang
2014-08-05  1:32           ` Nicolas Pitre
2014-08-05  1:38             ` Haojian Zhuang
2014-08-05  2:01               ` Nicolas Pitre
2014-08-05  2:05                 ` Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 3/9] ARM: hisi: enable HiP04 Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 4/9] document: dt: add the binding on HiP04 Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 5/9] ARM: dts: add hip04 dts Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 6/9] ARM: config: enable hisilicon hip04 Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 7/9] ARM: debug: add HiP04 debug uart Haojian Zhuang
2014-08-04  2:58 ` [PATCH v16 8/9] irq: enable hip04 irq chip Haojian Zhuang
2014-08-06 15:26   ` Andre Przywara
2014-08-07  5:26     ` Haojian Zhuang [this message]
2014-08-04  2:58 ` [PATCH v16 9/9] of: fdt: fix memory address be truncated Haojian Zhuang
2014-08-24 18:27   ` Olof Johansson

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=CAD6h2NTitNd8CEu0YGgb5PBasYzbtUspgeCD3fCBnx23h2tMWw@mail.gmail.com \
    --to=haojian.zhuang@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).