lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <22902b5c7616d47f6e48acc536a70da7@kernel.org>
Date:   Thu, 14 Jul 2022 11:21:04 +0100
From:   Marc Zyngier <maz@...nel.org>
To:     Jianmin Lv <lvjianmin@...ngson.cn>
Cc:     Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org,
        Hanjun Guo <guohanjun@...wei.com>,
        Lorenzo Pieralisi <lorenzo.pieralisi@....com>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        Huacai Chen <chenhuacai@...ngson.cn>
Subject: Re: [PATCH V14 14/15] irqchip / ACPI: Introduce ACPI_IRQ_MODEL_LPIC
 for LoongArch

On 2022-07-14 11:02, Jianmin Lv wrote:
> On 2022/7/8 上午11:17, Jianmin Lv wrote:
>> 
>> 
>> On 2022/7/7 下午8:59, Marc Zyngier wrote:
>>> On Sun, 03 Jul 2022 09:45:31 +0100,
>>> Jianmin Lv <lvjianmin@...ngson.cn> wrote:
>>>> 
>>>> For LoongArch, ACPI_IRQ_MODEL_LPIC is introduced, and then the
>>>> callback acpi_get_gsi_domain_id and acpi_gsi_to_irq_fallback are
>>>> implemented.
>>>> 
>>>> The acpi_get_gsi_domain_id callback returns related fwnode handle
>>>> of irqdomain for different GSI range.
>>>> 
>>>> The acpi_gsi_to_irq_fallback will create new mapping for gsi when
>>>> the mapping of it is not found.
>>>> 
>>>> Signed-off-by: Jianmin Lv <lvjianmin@...ngson.cn>
>>>> ---
>>>>   drivers/acpi/bus.c                  |  3 +++
>>>>   drivers/irqchip/irq-loongarch-cpu.c | 37 
>>>> +++++++++++++++++++++++++++++++++++++
>>>>   include/linux/acpi.h                |  1 +
>>>>   3 files changed, 41 insertions(+)
>>>> 
>>>> diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
>>>> index 86fa61a..63fbf00 100644
>>>> --- a/drivers/acpi/bus.c
>>>> +++ b/drivers/acpi/bus.c
>>>> @@ -1145,6 +1145,9 @@ static int __init acpi_bus_init_irq(void)
>>>>       case ACPI_IRQ_MODEL_PLATFORM:
>>>>           message = "platform specific model";
>>>>           break;
>>>> +    case ACPI_IRQ_MODEL_LPIC:
>>>> +        message = "LPIC";
>>>> +        break;
>>>>       default:
>>>>           pr_info("Unknown interrupt routing model\n");
>>>>           return -ENODEV;
>>>> diff --git a/drivers/irqchip/irq-loongarch-cpu.c 
>>>> b/drivers/irqchip/irq-loongarch-cpu.c
>>>> index c2f7411..1b241d7 100644
>>>> --- a/drivers/irqchip/irq-loongarch-cpu.c
>>>> +++ b/drivers/irqchip/irq-loongarch-cpu.c
>>>> @@ -15,6 +15,41 @@
>>>>   static struct irq_domain *irq_domain;
>>>> +static int lpic_gsi_to_irq(u32 gsi)
>>>> +{
>>>> +    /* Only pch irqdomain transferring is required for LoongArch. 
>>>> */
>>>> +    if (gsi >= GSI_MIN_PCH_IRQ && gsi <= GSI_MAX_PCH_IRQ)
>>>> +        return acpi_register_gsi(NULL, gsi, ACPI_LEVEL_SENSITIVE, 
>>>> ACPI_ACTIVE_HIGH);
>>>> +    return -1;
>>> 
>>> The expected return value on failure is 0 (which indicates that no
>>> interrupt was mapped). Here, things will break as acpi_gsi_to_irq()
>>> stores the result as unsigned, and compares the result to 0.
>>> 
>> 
>> Ok, thanks, I'll change the return value to 0 on failure and change 
>> return type to unsigned int.
>> 
>> 
> 
> Hi, Marc, if the return type is changed to unsigned int, the return
> type of the fallback handler in the patch:
> ACPI: irq: Allow acpi_gsi_to_irq() to have an arch-specific fallback
> 
> should be changed to unsigned int too, yes?

Yes, of course.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ