From: santosh.shilimkar@ti.com (Santosh Shilimkar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs
Date: Sun, 03 Apr 2011 11:36:47 +0530 [thread overview]
Message-ID: <4D980E77.10907@ti.com> (raw)
In-Reply-To: <BANLkTimJwCkabdEhQ89NgEaWyYaX6kSgUQ@mail.gmail.com>
Colin,
On 4/3/2011 8:57 AM, Colin Cross wrote:
> On Fri, Apr 1, 2011 at 1:31 PM, Colin Cross<ccross@google.com> wrote:
>> On Fri, Apr 1, 2011 at 7:50 AM, Will Deacon<will.deacon@arm.com> wrote:
>>> Currently, the gic uses handle_level_irq for handling SPIs (Shared
>>> Peripheral Interrupts), requiring active interrupts to be masked at
>>> the distributor level during IRQ handling.
>>>
>>> On a virtualised system, only the CPU interfaces are virtualised in
>>> hardware. Accesses to the distributor must be trapped by the
>>> hypervisor, adding latency to the critical interrupt path in Linux.
>>>
>>> This patch modifies the GIC code to use handle_fasteoi_irq for handling
>>> interrupts, which only requires us to signal EOI to the CPU interface
>>> when handling is complete. Cascaded IRQ handling is also updated to use
>>> the chained IRQ enter/exit functions to honour the flow control of the
>>> parent chip.
>>>
>>> Note that commit 846afbd1 ("GIC: Dont disable INT in ack callback")
>>> broke cascading interrupts by forgetting to add IRQ masking. This is
>>> no longer an issue because the unmask call is now unnecessary.
>>>
>>> Tested on Versatile Express and Realview EB (1176 w/ cascaded GICs).
>>>
>>> Cc: Abhijeet Dharmapurikar<adharmap@codeaurora.org>
>>> Cc: Russell King - ARM Linux<linux@arm.linux.org.uk>
>>> Acked-by: Catalin Marinas<catalin.marinas@arm.com>
>>> Signed-off-by: Will Deacon<will.deacon@arm.com>
>>> ---
>>> arch/arm/common/gic.c | 24 +++++++++---------------
>>> 1 files changed, 9 insertions(+), 15 deletions(-)
>>>
>>> diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
>>> index f70ec7d..f8719ec 100644
>>> --- a/arch/arm/common/gic.c
>>> +++ b/arch/arm/common/gic.c
>>> @@ -84,15 +84,6 @@ static inline unsigned int gic_irq(struct irq_data *d)
>>> /*
>>> * Routines to acknowledge, disable and enable interrupts
>>> */
>>> -static void gic_ack_irq(struct irq_data *d)
>>> -{
>>> - spin_lock(&irq_controller_lock);
>>> - if (gic_arch_extn.irq_ack)
>>> - gic_arch_extn.irq_ack(d);
>>> - writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
>>> - spin_unlock(&irq_controller_lock);
>>> -}
>>> -
>>> static void gic_mask_irq(struct irq_data *d)
>>> {
>>> u32 mask = 1<< (d->irq % 32);
>>> @@ -115,6 +106,11 @@ static void gic_unmask_irq(struct irq_data *d)
>>> spin_unlock(&irq_controller_lock);
>>> }
>>>
>>> +static void gic_eoi_irq(struct irq_data *d)
>>> +{
>>> + writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
>>> +}
>>> +
>>> static int gic_set_type(struct irq_data *d, unsigned int type)
>>> {
>>> void __iomem *base = gic_dist_base(d);
>>> @@ -218,8 +214,7 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
>>> unsigned int cascade_irq, gic_irq;
>>> unsigned long status;
>>>
>>> - /* primary controller ack'ing */
>>> - chip->irq_ack(&desc->irq_data);
>>> + chained_irq_enter(chip, desc);
>>>
>>> spin_lock(&irq_controller_lock);
>>> status = readl(chip_data->cpu_base + GIC_CPU_INTACK);
>>> @@ -236,15 +231,14 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
>>> generic_handle_irq(cascade_irq);
>>>
>>> out:
>>> - /* primary controller unmasking */
>>> - chip->irq_unmask(&desc->irq_data);
>>> + chained_irq_exit(chip, desc);
>>> }
>>>
>>> static struct irq_chip gic_chip = {
>>> .name = "GIC",
>>> - .irq_ack = gic_ack_irq,
>>> .irq_mask = gic_mask_irq,
>>> .irq_unmask = gic_unmask_irq,
>>> + .irq_eoi = gic_eoi_irq,
>>> .irq_set_type = gic_set_type,
>>> .irq_retrigger = gic_retrigger,
>>> #ifdef CONFIG_SMP
>>> @@ -319,7 +313,7 @@ static void __init gic_dist_init(struct gic_chip_data *gic,
>>> * Setup the Linux IRQ subsystem.
>>> */
>>> for (i = irq_start; i< irq_limit; i++) {
>>> - irq_set_chip_and_handler(i,&gic_chip, handle_level_irq);
>>> + irq_set_chip_and_handler(i,&gic_chip, handle_fasteoi_irq);
>>> irq_set_chip_data(i, gic);
>>> set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
>>> }
>>> --
>>> 1.7.0.4
>>>
>>>
>>
>> Tested-by: Colin Cross<ccross@android.com>
>> Works on tegra after fixing the problems with the tegra gpio patch.
>>
>
> In further testing I found one bug. d7ed36a added gic_arch_extn,
> which needs to be used in gic_eoi. arch/arm/mach-tegra/irq.c will
> need to be fixed to replace tegra_ack with tegra_eoi, and any other
> platform that uses gic_arch_extn also needs to be checked (omap4?).
> This patch fixes gic.c:
>
OMAP4 interrupt controller extension doesn't use 'irq_ack' extension.
So it should be ok.
Will,
Have already tested your V3 vesrion while generating the GIC
IO_relaxed patch and it worked OK. This series seems to be same.
I shall try this on OMAP4 and let you know ?
> diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
> index 6ecd5c7..8e46dac 100644
> --- a/arch/arm/common/gic.c
> +++ b/arch/arm/common/gic.c
> @@ -118,7 +118,11 @@ static void gic_unmask_irq(struct irq_data *d)
>
> static void gic_eoi_irq(struct irq_data *d)
> {
> + spin_lock(&irq_controller_lock);
> + if (gic_arch_extn.irq_eoi)
> + gic_arch_extn.irq_eoi(d);
> writel(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
> + spin_unlock(&irq_controller_lock);
> }
>
> static int gic_set_type(struct irq_data *d, unsigned int type)
next prev parent reply other threads:[~2011-04-03 6:06 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-01 14:50 [PATCH 0/6] Use chained handler entry/exit functions in platform code Will Deacon
2011-04-01 14:50 ` [PATCH 1/6] ARM: omap: update GPIO chained IRQ handler to use entry/exit functions Will Deacon
2011-04-01 14:50 ` [PATCH 2/6] ARM: tegra: " Will Deacon
2011-04-01 20:29 ` Colin Cross
2011-04-03 12:13 ` Will Deacon
2011-04-01 14:50 ` [PATCH 3/6] ARM: s5pv310: update IRQ combiner to use chained " Will Deacon
2011-04-01 14:50 ` [PATCH 4/6] ARM: msm: update GPIO chained IRQ handler to use " Will Deacon
2011-04-01 14:50 ` [PATCH 5/6] ARM: nmk: update GPIO chained IRQ handler to " Will Deacon
2011-04-01 14:50 ` [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs Will Deacon
2011-04-01 20:31 ` Colin Cross
2011-04-03 3:27 ` Colin Cross
2011-04-03 6:06 ` Santosh Shilimkar [this message]
2011-04-03 12:18 ` Will Deacon
2011-04-03 12:20 ` Santosh Shilimkar
2011-04-03 12:17 ` Will Deacon
2011-04-03 22:38 ` Colin Cross
2011-04-05 12:48 ` Will Deacon
-- strict thread matches above, loose matches on Subject: below --
2011-04-12 18:35 [PATCH v2 0/6] Use chained handler entry/exit functions in platform code Will Deacon
2011-04-12 18:35 ` [PATCH 6/6] ARM: gic: use handle_fasteoi_irq for SPIs Will Deacon
2011-04-16 1:52 ` Abhijeet Dharmapurikar
2011-04-19 11:20 ` Santosh Shilimkar
2011-04-19 15:16 ` Will Deacon
2011-04-20 4:20 ` Santosh Shilimkar
2011-04-30 2:38 ` Colin Cross
2011-04-30 9:54 ` Thomas Gleixner
2011-04-30 16:42 ` Colin Cross
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=4D980E77.10907@ti.com \
--to=santosh.shilimkar@ti.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.