From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sinan Kaya Subject: Re: [PATCH] acpi: add support for extended IRQ to PCI link Date: Mon, 9 Nov 2015 17:29:58 -0500 Message-ID: <56411E66.2030104@codeaurora.org> References: <1446998832-7023-1-git-send-email-okaya@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: linux-acpi-owner@vger.kernel.org To: Andy Shevchenko Cc: "linux-acpi@vger.kernel.org" , timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com, Andy Gross , linux-arm-msm@vger.kernel.org, linux-arm Mailing List , "Rafael J. Wysocki" , Len Brown , "linux-kernel@vger.kernel.org" List-Id: linux-arm-msm@vger.kernel.org On 11/8/2015 3:35 PM, Andy Shevchenko wrote: > On Sun, Nov 8, 2015 at 6:07 PM, Sinan Kaya wro= te: >> The ACPI compiler uses the extended format when >> used interrupt numbers are greater than 256. >> The PCI link code currently only supports simple >> interrupt format. The IRQ numbers are represented >> using 32 bits when extended IRQ syntax. This patch >> changes the interrupt number type to 32 bits and >> places an upper limit of 1020 as possible interrupt >> id. Additional checks have been placed to prevent >> out of bounds writes. > > In commit messages and in comments I see this narrow lines, any reaso= n > to make them short, except increasing number of lines? > done >> if (acpi_irq_balance || !link->irq.active) { >> - /* >> - * Select the best IRQ. This is done in reverse to = promote >> - * the use of IRQs 9, 10, 11, and >15. >> - */ >> - for (i =3D (link->irq.possible_count - 1); i >=3D 0;= i--) { >> - if (acpi_irq_penalty[irq] > >> - acpi_irq_penalty[link->irq.possible[i]]) >> - irq =3D link->irq.possible[i]; >> + >> + if (irq < ACPI_MAX_IRQS) { >> + /* >> + * Select the best IRQ. This is done in rev= erse to >> + * promote the use of IRQs 9, 10, 11, and >1= 5. >> + */ >> + for (i =3D (link->irq.possible_count - 1); i= >=3D 0; >> + i--) { > > Why not > > if ((acpi_irq_balance || !link->irq.active) && irq < ACPI_MAX_IRQS) { > int i =3D link->irq.possible_count; > > while (--i) { > =E2=80=A6 > } > } done > >> + if ((link->irq.possible[i] < ACPI_MA= X_IRQS) && >> + (acpi_irq_penalty[irq] > >> + acpi_irq_penalty[link->irq.possi= ble[i]])) >> + irq =3D link->irq.possible[i= ]; >> + } >> } >> } >> if (acpi_irq_penalty[irq] >=3D PIRQ_PENALTY_ISA_ALWAYS) { > --=20 Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, In= c. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a=20 Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" i= n the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751599AbbKIWaG (ORCPT ); Mon, 9 Nov 2015 17:30:06 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:39577 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbbKIWaB (ORCPT ); Mon, 9 Nov 2015 17:30:01 -0500 Subject: Re: [PATCH] acpi: add support for extended IRQ to PCI link To: Andy Shevchenko References: <1446998832-7023-1-git-send-email-okaya@codeaurora.org> Cc: "linux-acpi@vger.kernel.org" , timur@codeaurora.org, cov@codeaurora.org, jcm@redhat.com, Andy Gross , linux-arm-msm@vger.kernel.org, linux-arm Mailing List , "Rafael J. Wysocki" , Len Brown , "linux-kernel@vger.kernel.org" From: Sinan Kaya Message-ID: <56411E66.2030104@codeaurora.org> Date: Mon, 9 Nov 2015 17:29:58 -0500 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/8/2015 3:35 PM, Andy Shevchenko wrote: > On Sun, Nov 8, 2015 at 6:07 PM, Sinan Kaya wrote: >> The ACPI compiler uses the extended format when >> used interrupt numbers are greater than 256. >> The PCI link code currently only supports simple >> interrupt format. The IRQ numbers are represented >> using 32 bits when extended IRQ syntax. This patch >> changes the interrupt number type to 32 bits and >> places an upper limit of 1020 as possible interrupt >> id. Additional checks have been placed to prevent >> out of bounds writes. > > In commit messages and in comments I see this narrow lines, any reason > to make them short, except increasing number of lines? > done >> if (acpi_irq_balance || !link->irq.active) { >> - /* >> - * Select the best IRQ. This is done in reverse to promote >> - * the use of IRQs 9, 10, 11, and >15. >> - */ >> - for (i = (link->irq.possible_count - 1); i >= 0; i--) { >> - if (acpi_irq_penalty[irq] > >> - acpi_irq_penalty[link->irq.possible[i]]) >> - irq = link->irq.possible[i]; >> + >> + if (irq < ACPI_MAX_IRQS) { >> + /* >> + * Select the best IRQ. This is done in reverse to >> + * promote the use of IRQs 9, 10, 11, and >15. >> + */ >> + for (i = (link->irq.possible_count - 1); i >= 0; >> + i--) { > > Why not > > if ((acpi_irq_balance || !link->irq.active) && irq < ACPI_MAX_IRQS) { > int i = link->irq.possible_count; > > while (--i) { > … > } > } done > >> + if ((link->irq.possible[i] < ACPI_MAX_IRQS) && >> + (acpi_irq_penalty[irq] > >> + acpi_irq_penalty[link->irq.possible[i]])) >> + irq = link->irq.possible[i]; >> + } >> } >> } >> if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { > -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project From mboxrd@z Thu Jan 1 00:00:00 1970 From: okaya@codeaurora.org (Sinan Kaya) Date: Mon, 9 Nov 2015 17:29:58 -0500 Subject: [PATCH] acpi: add support for extended IRQ to PCI link In-Reply-To: References: <1446998832-7023-1-git-send-email-okaya@codeaurora.org> Message-ID: <56411E66.2030104@codeaurora.org> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 11/8/2015 3:35 PM, Andy Shevchenko wrote: > On Sun, Nov 8, 2015 at 6:07 PM, Sinan Kaya wrote: >> The ACPI compiler uses the extended format when >> used interrupt numbers are greater than 256. >> The PCI link code currently only supports simple >> interrupt format. The IRQ numbers are represented >> using 32 bits when extended IRQ syntax. This patch >> changes the interrupt number type to 32 bits and >> places an upper limit of 1020 as possible interrupt >> id. Additional checks have been placed to prevent >> out of bounds writes. > > In commit messages and in comments I see this narrow lines, any reason > to make them short, except increasing number of lines? > done >> if (acpi_irq_balance || !link->irq.active) { >> - /* >> - * Select the best IRQ. This is done in reverse to promote >> - * the use of IRQs 9, 10, 11, and >15. >> - */ >> - for (i = (link->irq.possible_count - 1); i >= 0; i--) { >> - if (acpi_irq_penalty[irq] > >> - acpi_irq_penalty[link->irq.possible[i]]) >> - irq = link->irq.possible[i]; >> + >> + if (irq < ACPI_MAX_IRQS) { >> + /* >> + * Select the best IRQ. This is done in reverse to >> + * promote the use of IRQs 9, 10, 11, and >15. >> + */ >> + for (i = (link->irq.possible_count - 1); i >= 0; >> + i--) { > > Why not > > if ((acpi_irq_balance || !link->irq.active) && irq < ACPI_MAX_IRQS) { > int i = link->irq.possible_count; > > while (--i) { > ? > } > } done > >> + if ((link->irq.possible[i] < ACPI_MAX_IRQS) && >> + (acpi_irq_penalty[irq] > >> + acpi_irq_penalty[link->irq.possible[i]])) >> + irq = link->irq.possible[i]; >> + } >> } >> } >> if (acpi_irq_penalty[irq] >= PIRQ_PENALTY_ISA_ALWAYS) { > -- Sinan Kaya Qualcomm Technologies, Inc. on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project