linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yun Wu (Abel)" <wuyun.wu@huawei.com>
To: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Grant Likely <grant.likely@linaro.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Yingjoe Chen <yingjoe.chen@mediatek.com>,
	Yijing Wang <wangyijing@huawei.com>
Subject: Re: [patch 08/16] genirq: Introduce callback irq_chip.irq_write_msi_msg
Date: Tue, 18 Nov 2014 21:52:24 +0800	[thread overview]
Message-ID: <546B4F18.5060705@huawei.com> (raw)
In-Reply-To: <546B4D0D.9050601@linux.intel.com>

On 2014/11/18 21:43, Jiang Liu wrote:

> On 2014/11/18 21:33, Yun Wu (Abel) wrote:
>> On 2014/11/18 18:19, Thomas Gleixner wrote:
>>
>>> On Tue, 18 Nov 2014, Yun Wu (Abel) wrote:
>>>> On 2014/11/12 21:43, Thomas Gleixner wrote:
>>>>>  struct irq_chip {
>>>>> @@ -359,6 +360,7 @@ struct irq_chip {
>>>>>  	void		(*irq_release_resources)(struct irq_data *data);
>>>>>  
>>>>>  	void		(*irq_compose_msi_msg)(struct irq_data *data, struct msi_msg *msg);
>>>>> +	void		(*irq_write_msi_msg)(struct irq_data *data, struct msi_msg *msg);
>>>>
>>>> Hmm... It's really weird.
>>>> I don't think it's the interrupt controllers' responsibility to write messages
>>>> for all the endpoint devices since the methods of configuring message registers
>>>> may different between these devices. And theoretically, the endpoint devices
>>>> themselves should take the responsibility to configure their message registers.
>>>> To say the least, the write_msg callback here still need to call some certain
>>>> interfaces provided by the corresponding device.
>>>>
>>>> There would be lots of ARM new devices capable of sending message
>>>> based interrupts to interrupt controllers, does all the drivers of
>>>> the devices need to expose a write_msg callback to interrupt
>>>> controllers?
>>>
>>> Well, writing the message _IS_ part of the interrupt controller.
>>>
>>> So in order to enable non PCI based MSI we want to have generic
>>> infrastructure with minimal per device/device class callbacks and of
>>> course you need to provide that callback for your special device.
>>>
>>> We already have non PCI based MSI controllers in x86 today and we need
>>> to handle the whole stuff with tons of copied coded extra for each of
>>> those. So consolidating it into common infrastructure allows us to get
>>> rid of the pointless copied code and reduce the per device effort to
>>> the relevant hardware specific callbacks. irq_write_msi_msg being one
>>> of those.
>>>
>>
>> At least, we have the same goal.
>> I will illustrate my thoughts by an example.
>> The current code is something like:
>>
>> Device A
>> ========
>> void A_write_msg() { ... }
>>
>> Group B
>> (a group of devices behave same on writing messages, i.e. PCI)
>> =======
>> void B_write_msg() { ... }
>>
>> Controller
>> ==========
>> irq_chip.irq_write_msi_msg () {
>> 	if (A)
>> 		A_write_msg();
>> 	if (B)
>> 		B_write_msg();
>> }
>>
>> It's horrible when new devices come out, since we need to modify the
>> controller part for each new device.
>> What I suggested is:
>>
>> MSI Core
>> ========
>> struct msi_ops { .write_msg, };
>> struct msi_desc { .msi_ops, };
>>
>> write_msg() {
>> 	X = get_dev();
>> 	irq_chip.compose_msg(X);	// IRQ chips' responsibility
>> 	X_msi_ops.write_msg();		// nothing to do with IRQ chips
>> }
>>
>> Device A
>> ========
>> void A_write_msg() { ... }
>> A_msi_ops.write_msg = A_write_msg;
>>
>> Group B
>> =======
>> void B_write_msg() { ... }
>> B_msi_ops.write_msg = B_write_msg;
>>
>> Please correct me if I misunderstood anything.
> Hi Yun,
> 	We provide an irq_chip for each type of interrupt controller
> instead of devices. For the example mentioned above, if device A
> and Group B has different interrupt controllers, we just need to
> implement irq_chip_A and irq_chip_B and set irq_chip.irq_write_msi_msg()
> to suitable callbacks.
> 	The framework already achieves what you you want:)

What if device A and group B have the same interrupt controller?

Regards,
	Abel


  reply	other threads:[~2014-11-18 13:53 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-12 13:42 [patch 00/16] genirq: Hierarchical irq domains and generic MSI interrupt code Thomas Gleixner
2014-11-12 13:42 ` [patch 01/16] irqdomain: Introduce new interfaces to support hierarchy irqdomains Thomas Gleixner
2014-11-18  9:24   ` Yun Wu (Abel)
2014-11-18  9:54     ` Thomas Gleixner
2014-11-18 11:48       ` Yun Wu (Abel)
2014-11-24 12:33   ` Yun Wu (Abel)
2014-11-24 13:13     ` Thomas Gleixner
2014-11-24 14:01       ` Yun Wu (Abel)
2014-11-24 14:11         ` Jiang Liu
2014-11-24 14:19           ` Yun Wu (Abel)
2014-11-24 14:33             ` Jiang Liu
2014-11-24 14:46               ` Yun Wu (Abel)
2014-11-24 14:32         ` Thomas Gleixner
2014-11-24 14:45           ` Yun Wu (Abel)
2014-11-12 13:42 ` [patch 02/16] irqdomain: Do irq_find_mapping and set_type for hierarchy irqdomain in case OF Thomas Gleixner
2014-11-12 13:42 ` [patch 03/16] genirq: Introduce helper functions to support stacked irq_chip Thomas Gleixner
2014-11-12 13:42 ` [patch 04/16] genirq: Introduce irq_chip.irq_compose_msi_msg() to support stacked irqchip Thomas Gleixner
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:02     ` Thomas Gleixner
2014-11-18 11:47       ` Yun Wu (Abel)
2014-11-18 12:43         ` Jiang Liu
2014-11-18 13:16           ` Yun Wu (Abel)
2014-11-18 13:25             ` Jiang Liu
2014-11-18 13:48               ` Yun Wu (Abel)
2014-11-18 13:55                 ` Jiang Liu
2014-11-18 14:03                   ` Yun Wu (Abel)
2014-11-18 14:06                     ` Jiang Liu
2014-11-12 13:42 ` [patch 05/16] genirq: Add IRQ_SET_MASK_OK_DONE " Thomas Gleixner
2014-11-12 13:43 ` [patch 06/16] genirq: Split out flow handler typedefs into seperate header file Thomas Gleixner
2014-11-12 13:43 ` [patch 07/16] genirq: Introduce helper irq_domain_set_info() to reduce duplicated code Thomas Gleixner
2014-11-13  9:57   ` Yingjoe Chen
2014-11-13 10:00     ` Jiang Liu
2014-11-13 10:48       ` Marc Zyngier
2014-11-14 15:31   ` Marc Zyngier
2014-11-14 15:41     ` Jiang Liu
2014-11-14 17:35       ` Marc Zyngier
2014-11-15  1:26         ` Jiang Liu
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:03     ` Thomas Gleixner
2014-11-18 11:47       ` Yun Wu (Abel)
2014-11-18 12:38         ` Jiang Liu
2014-11-18 13:28           ` Yun Wu (Abel)
2014-11-18 13:37             ` Jiang Liu
2014-11-12 13:43 ` [patch 08/16] genirq: Introduce callback irq_chip.irq_write_msi_msg Thomas Gleixner
2014-11-18  9:26   ` Yun Wu (Abel)
2014-11-18 10:19     ` Thomas Gleixner
2014-11-18 13:33       ` Yun Wu (Abel)
2014-11-18 13:43         ` Jiang Liu
2014-11-18 13:52           ` Yun Wu (Abel) [this message]
2014-11-18 14:03             ` Jiang Liu
2014-11-18 14:15               ` Jiang Liu
2014-11-18 14:22               ` Yun Wu (Abel)
2014-11-18 14:29                 ` Jiang Liu
2014-11-18 14:46                   ` Yun Wu (Abel)
2014-11-18 17:14                     ` Marc Zyngier
2014-11-19  3:38                       ` Yun Wu (Abel)
2014-11-19  8:55                         ` Marc Zyngier
2014-11-18 14:32                 ` Thomas Gleixner
2014-11-19  6:57                   ` Yun Wu (Abel)
2014-11-19  8:02                     ` Jiang Liu
2014-11-19  9:20                     ` Marc Zyngier
2014-12-10  9:26                       ` Yun Wu (Abel)
2014-11-18 14:19             ` Thomas Gleixner
2014-11-18 14:34               ` Yun Wu (Abel)
2014-11-18 14:52                 ` Jiang Liu
2014-11-19  3:47                   ` Yun Wu (Abel)
2014-11-19 11:09                     ` Thomas Gleixner
2014-11-18 17:21                 ` Marc Zyngier
2014-11-19  3:40                   ` Yun Wu (Abel)
2014-11-19 11:11                     ` Thomas Gleixner
2014-12-10  9:11                       ` Yun Wu (Abel)
2014-12-10 10:25                         ` Thomas Gleixner
2014-12-11  3:01                           ` Yun Wu (Abel)
2014-11-18 13:51         ` Jiang Liu
2014-11-12 13:43 ` [patch 09/16] genirq: Add generic msi irq domain support Thomas Gleixner
2014-11-18 12:07   ` Yun Wu (Abel)
2014-11-18 12:49     ` Jiang Liu
2014-11-18 13:55       ` Yun Wu (Abel)
2014-11-18 14:24         ` Thomas Gleixner
2014-11-18 14:39           ` Yun Wu (Abel)
2014-11-20  2:29           ` Jiang Liu
2014-11-12 13:43 ` [patch 10/16] PCI/MSI: Move cached entry functions to irq core Thomas Gleixner
2014-11-12 13:43 ` [patch 11/16] PCI/MSI: Remove unnecessary braces around single statements Thomas Gleixner
2014-11-12 13:43 ` [patch 12/16] PCI/MSI: Simplify PCI MSI code by initializing msi_desc.nvec_used earlier Thomas Gleixner
2014-11-12 13:43 ` [patch 13/16] PCI/MSI: Kill redundant call of irq_set_msi_desc() for MSI-X interrupts Thomas Gleixner
2014-11-12 13:43 ` [patch 14/16] PCI/MSI: Rename __read_msi_msg() to __pci_read_msi_msg() Thomas Gleixner
2014-11-12 13:43 ` [patch 15/16] PCI/MSI: Rename write_msi_msg() to pci_write_msi_msg() Thomas Gleixner
2014-11-12 16:50   ` Jiang Liu
2014-11-12 13:43 ` [patch 16/16] PCI/MSI: Enhance core to support hierarchy irqdomain Thomas Gleixner
2014-11-12 15:29   ` Marc Zyngier
2014-11-12 16:43     ` Thomas Gleixner
2014-11-12 14:13 ` [patch 00/16] genirq: Hierarchical irq domains and generic MSI interrupt code Yingjoe Chen
2014-11-12 14:48   ` Thomas Gleixner
2014-11-18  9:24 ` Yun Wu (Abel)

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=546B4F18.5060705@huawei.com \
    --to=wuyun.wu@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=grant.likely@linaro.org \
    --cc=jiang.liu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=tglx@linutronix.de \
    --cc=wangyijing@huawei.com \
    --cc=yingjoe.chen@mediatek.com \
    /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).