linux-mips
[Top] [All Lists]

RE: How to chip->startup() with IRQs disabled

To: "Jayachandran C." <jayachandranc@netlogicmicro.com>
Subject: RE: How to chip->startup() with IRQs disabled
From: "Om Narasimhan" <onarasimhan@netlogicmicro.com>
Date: Fri, 26 Aug 2011 19:30:42 -0700
Cc: <linux-mips@linux-mips.org>
References: <74B0AE1BA53C37449DE49BB274F9A2DBC4D052@orion8.netlogicmicro.com> <CA+7sy7CSauuSAgF1Ai8dRbcVzVkdj7zWxVjOuyUJw2WSUwk5bg@mail.gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Thread-index: AcxkXxFexKfiew3eTL+AONbDJYpN1gAAWKVW
Thread-topic: How to chip->startup() with IRQs disabled
>On Sat, Aug 27, 2011 at 7:09 AM, Om Narasimhan
><onarasimhan@netlogicmicro.com> wrote:
>> Hi,
>> I am working on a chip with multiple cores. I have defined
>> static struct irq_chip new_plat_chip = {
>> ...
>>        .startup = n_irq_startup,
>>        .mask = n_irq_shutdown,
>> ...
>> };
>>
>> In n_irq_startup(), I have to make sure that all cores have set RVEC bit and
>> corresponding EIMR bit. So, I try using on_each_cpu() (because EIMR can be 
>> set
>> only by running code on that particular cpu) to run a function to set EIMR.
>>
>> n_irq_startup() is called as chip->startup() from __setup_irq() (from
>> request_threaded_irq, in turn from request_irq() ) with a spin lock held
>> (desc->lock, in kernel/irq/manage.c).  This causes a stack dump from
>> on_each_cpu(). Since it is wrong to call on_each_cpu with interrupts 
>> disabled,
>> I want to change this piece of code.
>
>>In XLR code
>>(http://git.linux-mips.org/?p=linux.git;a=blob;f=arch/mips/netlogic/xlr/smp.c)
>>we do the initialization of EIMR in nlm_init_secondary() which is
>>registered as .init_secondary method in smp_ops.  on_each_cpu() may not be the
>>right way to do this.

There is a problem with that approach. At initialization time one has no idea
about the interrupts that should be set. E.g, in our system, PCIe interrupts
need be enabled only if there is a device attached to one of the pcie bus.
Moreover, whether the device requests Intx, MSI or MSI-X is determinable only at
the event of request_irq(). That means, it is imperative that we defer setting
EIMR till request_irq()

Om.

<Prev in Thread] Current Thread [Next in Thread>