Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1245378

Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt controller.

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From "majun (F)" <majun258@huawei.com>
Newsgroups linux.kernel
Subject Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt controller.
Date Tue, 13 Oct 2015 08:40:02 +0200
Message-ID <qj1pE-6O2-17@gated-at.bofh.it> (permalink)
References <qembn-1aV-13@gated-at.bofh.it> <qembn-1aV-11@gated-at.bofh.it> <qexgu-oR-21@gated-at.bofh.it> <qfLU6-20A-5@gated-at.bofh.it> <qhGdA-3Jr-29@gated-at.bofh.it> <qhYk9-4Ky-1@gated-at.bofh.it> <qhZpT-6hV-11@gated-at.bofh.it> <qilA6-4GV-5@gated-at.bofh.it> <qimFP-6vi-5@gated-at.bofh.it> <qirYR-5F6-3@gated-at.bofh.it>
X-Original-To Thomas Gleixner <tglx@linutronix.de>, Marc Zyngier <marc.zyngier@arm.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0
MIME-Version 1.0
Content-Type text/plain; charset="utf-8"
Content-Transfer-Encoding 8bit
X-Originating-IP [10.177.235.245]
X-Cfilter-Loop Reflected
X-Mirapoint-Virus-Rapid-Raw score=unknown(0), refid=str=0001.0A090202.561CA59B.00BF,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32
X-Mirapoint-Loop-ID 8d4db507988ad8f5774f1a441f42b65b
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 114
Organization linux.* mail to news gateway
X-Original-Cc <Catalin.Marinas@arm.com>, <linux-kernel@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <Will.Deacon@arm.com>, <mark.rutland@arm.com>, <jason@lakedaemon.net>, <lizefan@huawei.com>, <huxinwei@huawei.com>, <dingtianhong@huawei.com>, <zhaojunhua@hisilicon.com>, <liguozhu@hisilicon.com>, <xuwei5@hisilicon.com>, <wei.chenwei@hisilicon.com>, <guohanjun@huawei.com>, <wuyun.wu@huawei.com>, <guodong.xu@linaro.org>, <haojian.zhuang@linaro.org>, <zhangfei.gao@linaro.org>, <usman.ahmad@linaro.org>, <klimov.linux@gmail.com>
X-Original-Date Tue, 13 Oct 2015 14:32:44 +0800
X-Original-Message-ID <561CA58C.2060207@huawei.com>
X-Original-References <1443605949-15396-1-git-send-email-majun258@huawei.com> <1443605949-15396-2-git-send-email-majun258@huawei.com> <alpine.DEB.2.11.1509302242220.4500@nanos> <5610D3BD.1040408@huawei.com> <alpine.DEB.2.11.1510091441200.6097@nanos> <5618D3EC.6050501@huawei.com> <20151010110942.52d34a4b@arm.com> <alpine.DEB.2.11.1510111150270.6097@nanos> <20151011120331.09093ffc@arm.com> <alpine.DEB.2.11.1510111335150.6097@nanos>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1245378

Show key headers only | View raw


Hi Thomas:

在 2015/10/12 0:45, Thomas Gleixner 写道:
> On Sun, 11 Oct 2015, Marc Zyngier wrote:
>> On Sun, 11 Oct 2015 11:54:49 +0200
>> Thomas Gleixner <tglx@linutronix.de> wrote:
>>
>>> On Sat, 10 Oct 2015, Marc Zyngier wrote:
>>>> On Sat, 10 Oct 2015 17:01:32 +0800
>>>> "majun (F)" <majun258@huawei.com> wrote:
>>>>> But there is a problem If i make the structure like you said.
>>>>>
>>>>> For example, my hardware structure likes below:
>>>>>
>>>>> uart ------> mbigen --> ITS-pMSI --> ITS --> GIC
>>>>>      virq1
>>>>>
>>>>> virq1 means the virq number allocted by irq_of_parse_and_map() function
>>>>> when system parse the uart dts node in initializing  stage.
>>>>>
>>>>> To create a ITS device, I need to call msi_domain_alloc_irqs() function
>>>>> in my mbigen alloc function.
>>>>>
>>>>> In this function, a new virq number(named as virq2 ) which different from
>>>>> virq1 is allocated.
>>>>> So, this is a big problem.
>>>>
>>>> I think I see what your problem is:
>>>> - The wired interrupt (uart -> mbigen) is allocated through DT (and
>>>>   must be available early, because of of_platform_populate),
>>>> - The MSI (mgigen -> ITS) is dynamic (and allocated much later,
>>>>   because the device model kicks in after irqchip init, and we cannot
>>>>   allocate MSIs without a device).
>>>
>>> Why do we need that wired interrupt at all? 
>>>
>>> We can make mbigen the 'msi-parent' of the device and let the
>>> msi_domain_ops::msi_prepare() callback figure out the actual wiring
>>> through device->fwnode.
>>
>> That's because the device behind the mbigen can't do any MSI at all.
>> Think of a 8250 uart, for example.
>>
>> If we make the mbigen the msi-parent of the uart, then we need to teach
>> the 8250 driver to request MSIs.
> 
> I really do not understand why of_platform_populate cares about
> interrupt allocations. That's outright stupid. We should care about
> that at device probe time, i.e. at the point where the driver is
> registered and probed if there is matching platform data. If we do it
> in of_platform_populate then we allocate interrupts even for devices
> which do not have a driver, i.e. we just waste memory.
> 
> So we better teach a couple of drivers to handle that instead of
> inventing horrible workarounds.
> 
>> It also means that the DT doesn't represent the HW anymore (this
>> wired interrupt actually exists).
> 
> I think the abstraction here is wrong. If it would be correct, then
> PCI-MSI would be wrong. The MSI part of PCI is a MSI producer, mbigen
> is as well. Technically MSI is not integral part of the PCI device, it
> just happens to have it's configuration registers in the PCI
> configuration space of the device:
> 
>     [PCI-BUS]------[Interrupt mode selector]
>     	      	|        |
>     	      	|        |
> 		------[Legacy irq gate]<-----
> 		|        |                  |
> 		|        |                  |---[Device interrupt]
> 		|        |                  |
> 		------[MSI unit]<------------
> 
> So you have a 'wire' from the device to the MSI unit, but we do not
> care about that 'wire'. All we care about are the MSI configuration
> registers. We find them via the PCI device which gives us the address
> of the PCI configuration space.
> 
> So now in the mbigen case this looks like this:
> 
>     [MSI-BUS] ----- [MBIGEN]<-------------------[Device interrupt]
> 
> Again, you have a 'wire' from the device to the MSI unit (MBIGEN) and
> we do not care about that 'wire' either. What we care about is how we
> find the MSI (mbigen) configuration registers for a particular
> device. So we need a DT/ACPI entry which describes those configuration
> registers and whatever supplementary information is required. That
> will make the mbigen driver extremly simple.
> 

According to your suggestions, I tried to make the hardware structure likes below:

device(8250 uart) -> mbigne -> ITS-pMSI --> ITS --> GIC

And  8250 uart dts node is:

 8250_uart {
	compatible = "xxx";
	msi-parent = < &mbigen>;
	config_addr = <xxxxx> ; /* configuration register */
	interrupts = <x>;
	interrupt-parent = ?
}

My question is what's the interrupt-parent should be?



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-09 15:50 +0200
  Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. "majun (F)" <majun258@huawei.com> - 2015-10-10 11:10 +0200
    Re: [PATCH v5 1/3] initialize each mbigen device node as a  interrupt controller. Marc Zyngier <marc.zyngier@arm.com> - 2015-10-10 12:20 +0200
      Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-11 12:00 +0200
        Re: [PATCH v5 1/3] initialize each mbigen device node as a  interrupt controller. Marc Zyngier <marc.zyngier@arm.com> - 2015-10-11 13:10 +0200
          Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-11 18:50 +0200
            Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. "majun (F)" <majun258@huawei.com> - 2015-10-13 08:40 +0200
              Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-13 09:00 +0200
                Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. "majun (F)" <majun258@huawei.com> - 2015-10-14 10:30 +0200
                Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-14 10:30 +0200
                Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. "majun (F)" <majun258@huawei.com> - 2015-10-14 11:10 +0200
            Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Marc Zyngier <marc.zyngier@arm.com> - 2015-10-14 11:00 +0200
              Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Thomas Gleixner <tglx@linutronix.de> - 2015-10-14 11:20 +0200
                Re: [PATCH v5 1/3] initialize each mbigen device node as a interrupt  controller. Marc Zyngier <marc.zyngier@arm.com> - 2015-10-14 11:50 +0200

csiph-web