All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/2] Add the driver of mbigen interrupt controller
Date: Mon, 28 Sep 2015 16:46:49 +0100	[thread overview]
Message-ID: <560960E9.6010302@arm.com> (raw)
In-Reply-To: <5605365A.80605@huawei.com>

On 25/09/15 12:56, majun (F) wrote:
> 
> 
> ? 2015/9/25 3:30, Marc Zyngier ??:
>> On Wed, 23 Sep 2015 15:24:50 +0800
>> "majun (F)" <majun258@huawei.com> wrote:
>>
>> [...]
>>
>>>>> +static int mbigen_device_init(struct mbigen_chip *chip,
>>>>> +                       struct device_node *node)
> [...]
>>>>> +
>>>>> +core_initcall(mbigen_init);
>>>>
>>>> That's the wrong thing to do. The interrupt controller should be
>>>> probed with IRQCHIP_DECLARE(). Yes, this creates a dependency
>>>> problem between the MSI layer and the irqchip layer, but that
>>>> should be easy (-ish) to solve.
>>>
>>> Based on our discusstion about DTS,I will change the code likes below:
>>> IRQCHIP_DECLARE(hisi_mbigen, "hisilicon,mbigen-v2", mbigen_of_init);
>>>
>>> Mbigen device is initialized as a interrupt controller.
>>>
>>> But I still can't call platform_msi_domain_alloc_irqs()
>>> to apply the msi irqs.
>>>
>>> It think this is what you said "dependency problem between
>>>  the MSI layer and the irqchip layer" , am i right ?
>>>
>>> Do you have any idea about this problem?
>>
>> You need to have multiple phases for initializing this beast:
>> - IRQCHIP_DECLARE() to create the irqchips, allocate the domains and
>>   the main data structures,
>> - platform device probing of the top-level device to do some HW probing
>>   and to kick of_platform_populate on the subnodes,
>> - Handle the the subnode probing, allocate the MSIs, and finish the
>>   initialization of the irqchip how that you have all the information.
> 
> Ok, I got it. But I still have a question.
> According to your suggestions, the initial flow is:
> 
> Step1: IRQCHIP_DECLARE() to create the irqchips, allocate the domains and
> 	the main data structures,
> Step2: Parse the device node and apply the irq(named as *device-virq*) within mbigen-device	
> 	domain (handled by irq core code).
> Step3: platform device probing of the top-level device to do some HW probing
> 	and to kick of_platform_populate on the subnodes,
> Step4: Handle the the subnode probing, allocate the MSIs(named as *msi-virq*), and finish the
> 	initialization of the irqchip how that you have all the information.
> 
> My questions is:
> 	How to connect msi-virq and device-virq ?
> 
> In my v4 version, I used the
> 
> irq_set_chained_handler(msi-virq, mbigen_handle_cascade_irq);
> 
> as msi-virq primary handler function .
> 
> Then find  device-virq in mbigen_handle_cascade_irq()
> and call device-virq corresponding handler fucntion.
> 
> But it seems not a right solution.
> 
> So I want try another solution for this problem.
> 
> [1] In step2, when the interrupt controller map function is called, using
> 	irq_set_chip_and_handler(device-irq, &mbigen_irq_chip, handle_fasteoi_irq);
> [2] In step4, using
> 	for_each_msi_entry(desc, &mgn_dev->dev) {
> 		request_irq( msi-virq, msi_irq_handler, **);
> 	}
> 
> But I am not sure about this solution, please review this and offer me some suggestions.

I don't see what is wrong with keeping it as a chained irq handler.
Actually, you really need it to be a chained handler (because this is
what it is). So using irq_set_chained_handler_and_data() is probably the
right thing to do.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <marc.zyngier@arm.com>
To: "majun (F)" <majun258@huawei.com>
Cc: Catalin Marinas <Catalin.Marinas@arm.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>,
	Will Deacon <Will.Deacon@arm.com>,
	Mark Rutland <Mark.Rutland@arm.com>,
	"jason@lakedaemon.net" <jason@lakedaemon.net>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"lizefan@huawei.com" <lizefan@huawei.com>,
	"huxinwei@huawei.com" <huxinwei@huawei.com>,
	"dingtianhong@huawei.com" <dingtianhong@huawei.com>,
	"zhaojunhua@hisilicon.com" <zhaojunhua@hisilicon.com>,
	"liguozhu@hisilicon.com" <liguozhu@hisilicon.com>,
	"xuwei5@hisilicon.com" <xuwei5@hisilicon.com>,
	"wei.chenwei@hisilicon.com" <wei.chenwei@hisilicon.com>,
	"guohanjun@huawei.com" <guohanjun@huawei.com>,
	"wuyun.wu@huawei.com" <wuyun.wu@huawei.com>,
	"guodong.xu@linaro.org" <guodong.xu@linaro.org>,
	"haojian.zhuang@linaro.org" <haojian.zhuang@linaro.org>,
	"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
	"usman.ahmad@linaro.org" <usman.ahmad@linaro.org>
Subject: Re: [PATCH v4 1/2] Add the driver of mbigen interrupt controller
Date: Mon, 28 Sep 2015 16:46:49 +0100	[thread overview]
Message-ID: <560960E9.6010302@arm.com> (raw)
In-Reply-To: <5605365A.80605@huawei.com>

On 25/09/15 12:56, majun (F) wrote:
> 
> 
> 在 2015/9/25 3:30, Marc Zyngier 写道:
>> On Wed, 23 Sep 2015 15:24:50 +0800
>> "majun (F)" <majun258@huawei.com> wrote:
>>
>> [...]
>>
>>>>> +static int mbigen_device_init(struct mbigen_chip *chip,
>>>>> +                       struct device_node *node)
> [...]
>>>>> +
>>>>> +core_initcall(mbigen_init);
>>>>
>>>> That's the wrong thing to do. The interrupt controller should be
>>>> probed with IRQCHIP_DECLARE(). Yes, this creates a dependency
>>>> problem between the MSI layer and the irqchip layer, but that
>>>> should be easy (-ish) to solve.
>>>
>>> Based on our discusstion about DTS,I will change the code likes below:
>>> IRQCHIP_DECLARE(hisi_mbigen, "hisilicon,mbigen-v2", mbigen_of_init);
>>>
>>> Mbigen device is initialized as a interrupt controller.
>>>
>>> But I still can't call platform_msi_domain_alloc_irqs()
>>> to apply the msi irqs.
>>>
>>> It think this is what you said "dependency problem between
>>>  the MSI layer and the irqchip layer" , am i right ?
>>>
>>> Do you have any idea about this problem?
>>
>> You need to have multiple phases for initializing this beast:
>> - IRQCHIP_DECLARE() to create the irqchips, allocate the domains and
>>   the main data structures,
>> - platform device probing of the top-level device to do some HW probing
>>   and to kick of_platform_populate on the subnodes,
>> - Handle the the subnode probing, allocate the MSIs, and finish the
>>   initialization of the irqchip how that you have all the information.
> 
> Ok, I got it. But I still have a question.
> According to your suggestions, the initial flow is:
> 
> Step1: IRQCHIP_DECLARE() to create the irqchips, allocate the domains and
> 	the main data structures,
> Step2: Parse the device node and apply the irq(named as *device-virq*) within mbigen-device	
> 	domain (handled by irq core code).
> Step3: platform device probing of the top-level device to do some HW probing
> 	and to kick of_platform_populate on the subnodes,
> Step4: Handle the the subnode probing, allocate the MSIs(named as *msi-virq*), and finish the
> 	initialization of the irqchip how that you have all the information.
> 
> My questions is:
> 	How to connect msi-virq and device-virq ?
> 
> In my v4 version, I used the
> 
> irq_set_chained_handler(msi-virq, mbigen_handle_cascade_irq);
> 
> as msi-virq primary handler function .
> 
> Then find  device-virq in mbigen_handle_cascade_irq()
> and call device-virq corresponding handler fucntion.
> 
> But it seems not a right solution.
> 
> So I want try another solution for this problem.
> 
> [1] In step2, when the interrupt controller map function is called, using
> 	irq_set_chip_and_handler(device-irq, &mbigen_irq_chip, handle_fasteoi_irq);
> [2] In step4, using
> 	for_each_msi_entry(desc, &mgn_dev->dev) {
> 		request_irq( msi-virq, msi_irq_handler, **);
> 	}
> 
> But I am not sure about this solution, please review this and offer me some suggestions.

I don't see what is wrong with keeping it as a chained irq handler.
Actually, you really need it to be a chained handler (because this is
what it is). So using irq_set_chained_handler_and_data() is probably the
right thing to do.

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2015-09-28 15:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-19  2:55 [PATCH v4 0/2] Support Mbigen interrupt controller MaJun
2015-08-19  2:55 ` MaJun
2015-08-19  2:55 ` [PATCH v4 1/2] Add the driver of mbigen " MaJun
2015-08-19  2:55   ` MaJun
2015-09-21 21:53   ` Marc Zyngier
2015-09-21 21:53     ` Marc Zyngier
2015-09-23  7:24     ` majun (F)
2015-09-23  7:24       ` majun (F)
2015-09-24 19:30       ` Marc Zyngier
2015-09-24 19:30         ` Marc Zyngier
2015-09-25 11:56         ` majun (F)
2015-09-25 11:56           ` majun (F)
2015-09-28 15:46           ` Marc Zyngier [this message]
2015-09-28 15:46             ` Marc Zyngier
2015-08-19  2:55 ` [PATCH v4 2/2] dt-binding:Documents of the mbigen bindings MaJun
2015-08-19  2:55   ` MaJun
2015-09-21 18:09   ` Marc Zyngier
2015-09-21 18:09     ` Marc Zyngier
2015-09-22 11:35     ` majun (F)
2015-09-22 14:41       ` Marc Zyngier
2015-09-22 14:41         ` Marc Zyngier
2015-09-23  7:24         ` majun (F)
2015-09-23  7:24           ` majun (F)
  -- strict thread matches above, loose matches on Subject: below --
2015-08-29  3:13 [PATCH v4 1/2] Add the driver of mbigen interrupt controller Alexey Klimov
2015-09-01  1:45 ` majun (F)
2015-09-01  1:45   ` majun (F)
2015-09-04  0:56   ` Alexey Klimov
2015-09-04  0:56     ` Alexey Klimov
2015-09-07  1:17     ` majun (F)
2015-09-07  1:17       ` majun (F)

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=560960E9.6010302@arm.com \
    --to=marc.zyngier@arm.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.