From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hanjun Guo Subject: Re: [PATCH 02/11] ACPI / irqchip: Add self-probe infrastructure to initialize IRQ controller Date: Thu, 11 Jun 2015 20:55:09 +0800 Message-ID: <5579852D.1010509@linaro.org> References: <1431953961-22706-1-git-send-email-hanjun.guo@linaro.org> <1431953961-22706-3-git-send-email-hanjun.guo@linaro.org> <557858AC.6010701@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <557858AC.6010701@arm.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Marc Zyngier , Jason Cooper , Will Deacon , Catalin Marinas , "Rafael J. Wysocki" Cc: Lorenzo Pieralisi , Arnd Bergmann , "linux-acpi@vger.kernel.org" , "linaro-acpi@lists.linaro.org" , "linux-kernel@vger.kernel.org" , Tomasz Nowicki , Olof Johansson , "grant.likely@linaro.org" , Thomas Gleixner , Jiang Liu , "linux-arm-kernel@lists.infradead.org" List-Id: linux-acpi@vger.kernel.org Hi Marc, On 06/10/2015 11:33 PM, Marc Zyngier wrote: > Hi Hanjun, > > On 18/05/15 13:59, Hanjun Guo wrote: >> From: Tomasz Nowicki >> >> This self-probe infrastructure works in the similar way as OF, >> but there is some different in the mechanism: >> >> For OF, the init fn will be called once it finds comptiable strings >> in DT, but for ACPI, we init irqchips by static tables, and in >> static ACPI tables, there are no comptiable strings to indicate >> irqchips, so every init function with IRQCHIP_ACPI_DECLARE in the >> same table will be called, but thanks to the GIC version presented >> in ACPI table, we can init different GIC irqchips with this framework. > > This triggers an immediate question: If we can find out the GIC version > in the ACPI tables, which can't we just call the irqchips that implement > the support for this version? This is really a good question and triggers me to rethink about the implementation. > > i.e: the GICv2 irqchip code would have a line like: > > IRQCHIP_ACPI_DECLARE(gic_v2, ACPI_MADT_GIC_VER_V2, gic_v2_acpi_init); > > and the probing code would simply call the drivers that have declared > their interest for this version code. if we want to achieve this, we can redefine the strut for acpi_table_id: #define ACPI_TABLE_ID_LEN 5 struct acpi_table_id { __u8 id[ACPI_TABLE_ID_LEN]; const void *handler; kernel_ulong_t driver_data; }; then pass the ACPI_MADT_GIC_VER_V2 as the driver_data, it will work as you suggested. > > Having code that tests for the version in each driver is not an option > (this is exactly what we're trying to avoid). I also think it's awkward to do that in each driver, thanks for the suggestion! Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964810AbbFKM5B (ORCPT ); Thu, 11 Jun 2015 08:57:01 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:34384 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752942AbbFKMzV (ORCPT ); Thu, 11 Jun 2015 08:55:21 -0400 Message-ID: <5579852D.1010509@linaro.org> Date: Thu, 11 Jun 2015 20:55:09 +0800 From: Hanjun Guo User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Marc Zyngier , Jason Cooper , Will Deacon , Catalin Marinas , "Rafael J. Wysocki" CC: Jiang Liu , Lorenzo Pieralisi , Arnd Bergmann , Tomasz Nowicki , "grant.likely@linaro.org" , Thomas Gleixner , Olof Johansson , "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linaro-acpi@lists.linaro.org" Subject: Re: [PATCH 02/11] ACPI / irqchip: Add self-probe infrastructure to initialize IRQ controller References: <1431953961-22706-1-git-send-email-hanjun.guo@linaro.org> <1431953961-22706-3-git-send-email-hanjun.guo@linaro.org> <557858AC.6010701@arm.com> In-Reply-To: <557858AC.6010701@arm.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Marc, On 06/10/2015 11:33 PM, Marc Zyngier wrote: > Hi Hanjun, > > On 18/05/15 13:59, Hanjun Guo wrote: >> From: Tomasz Nowicki >> >> This self-probe infrastructure works in the similar way as OF, >> but there is some different in the mechanism: >> >> For OF, the init fn will be called once it finds comptiable strings >> in DT, but for ACPI, we init irqchips by static tables, and in >> static ACPI tables, there are no comptiable strings to indicate >> irqchips, so every init function with IRQCHIP_ACPI_DECLARE in the >> same table will be called, but thanks to the GIC version presented >> in ACPI table, we can init different GIC irqchips with this framework. > > This triggers an immediate question: If we can find out the GIC version > in the ACPI tables, which can't we just call the irqchips that implement > the support for this version? This is really a good question and triggers me to rethink about the implementation. > > i.e: the GICv2 irqchip code would have a line like: > > IRQCHIP_ACPI_DECLARE(gic_v2, ACPI_MADT_GIC_VER_V2, gic_v2_acpi_init); > > and the probing code would simply call the drivers that have declared > their interest for this version code. if we want to achieve this, we can redefine the strut for acpi_table_id: #define ACPI_TABLE_ID_LEN 5 struct acpi_table_id { __u8 id[ACPI_TABLE_ID_LEN]; const void *handler; kernel_ulong_t driver_data; }; then pass the ACPI_MADT_GIC_VER_V2 as the driver_data, it will work as you suggested. > > Having code that tests for the version in each driver is not an option > (this is exactly what we're trying to avoid). I also think it's awkward to do that in each driver, thanks for the suggestion! Thanks Hanjun From mboxrd@z Thu Jan 1 00:00:00 1970 From: hanjun.guo@linaro.org (Hanjun Guo) Date: Thu, 11 Jun 2015 20:55:09 +0800 Subject: [PATCH 02/11] ACPI / irqchip: Add self-probe infrastructure to initialize IRQ controller In-Reply-To: <557858AC.6010701@arm.com> References: <1431953961-22706-1-git-send-email-hanjun.guo@linaro.org> <1431953961-22706-3-git-send-email-hanjun.guo@linaro.org> <557858AC.6010701@arm.com> Message-ID: <5579852D.1010509@linaro.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Marc, On 06/10/2015 11:33 PM, Marc Zyngier wrote: > Hi Hanjun, > > On 18/05/15 13:59, Hanjun Guo wrote: >> From: Tomasz Nowicki >> >> This self-probe infrastructure works in the similar way as OF, >> but there is some different in the mechanism: >> >> For OF, the init fn will be called once it finds comptiable strings >> in DT, but for ACPI, we init irqchips by static tables, and in >> static ACPI tables, there are no comptiable strings to indicate >> irqchips, so every init function with IRQCHIP_ACPI_DECLARE in the >> same table will be called, but thanks to the GIC version presented >> in ACPI table, we can init different GIC irqchips with this framework. > > This triggers an immediate question: If we can find out the GIC version > in the ACPI tables, which can't we just call the irqchips that implement > the support for this version? This is really a good question and triggers me to rethink about the implementation. > > i.e: the GICv2 irqchip code would have a line like: > > IRQCHIP_ACPI_DECLARE(gic_v2, ACPI_MADT_GIC_VER_V2, gic_v2_acpi_init); > > and the probing code would simply call the drivers that have declared > their interest for this version code. if we want to achieve this, we can redefine the strut for acpi_table_id: #define ACPI_TABLE_ID_LEN 5 struct acpi_table_id { __u8 id[ACPI_TABLE_ID_LEN]; const void *handler; kernel_ulong_t driver_data; }; then pass the ACPI_MADT_GIC_VER_V2 as the driver_data, it will work as you suggested. > > Having code that tests for the version in each driver is not an option > (this is exactly what we're trying to avoid). I also think it's awkward to do that in each driver, thanks for the suggestion! Thanks Hanjun