Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3700140imw; Thu, 7 Jul 2022 06:19:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZenZ6J11W9TA4moxEB/Nb0pnPm3oNNcny6m1kmI62t4sbf9cN5ZKaqxt38DfDYVvpmTVz X-Received: by 2002:a17:90a:1943:b0:1ef:8146:f32f with SMTP id 3-20020a17090a194300b001ef8146f32fmr5276426pjh.112.1657199966596; Thu, 07 Jul 2022 06:19:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657199966; cv=none; d=google.com; s=arc-20160816; b=Q+h6zBamY3aXswrPmSQ7zt+Nn/O/h5P/j1xfCiZO8c/nlWdyue/cvcZ4O3J1JVlepY WSL4M5/+2IB8RzerAIArDQWUNPd4p/CPx8AtsiGKLl//qLeY1eNBzq3wgMbrVTVishgb o6vixNlm6/CRU7r1Ggau/DGrZ7RROM0ioVDHwKPJwE5VLN173QbHLj/cK/ntlPy5ZAtF blcDjWpUo0Q/Q64N2vp8CE9GmN524m5QljnShNZLORtcUzdUyFEqKk/lYDrsHriIFFIT 52JT+zlH9QT0NDxONG/BPbGehPsYFfMX4yJszsiMLvqvK04pJaIBLwlvPJmQqxHlyPq5 7m0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date:dkim-signature; bh=1P06J6aFhlBgtk90IPHwEexqqAfile8VvsvngkacMP0=; b=u6MeWoaHwRmfq5dmnLFi01QPPfY5zBNSsrVj+5lqSijODxIQ2LgFKElaYT5h3OhMhA UeLheDNNhIF7aoQ7Ox4B4LIHF5E7wWnlzI0Q6ZDxUZAgBZ941Z08U+UQZwrB0meGWMjt hpTEY+Vq8B9lawszBYauUHsd9YSa+1Q4bnVNiuCf/knzap5X3sJjO8YqgSaP3nDX2i9A 5i810Gntiun/YrW2cKxKJpnIM3IMZ3Ttc85U1Lk94dojUNJDcfRqxGYSmV9s0hxy7yhS uhNK8xbpQBKmArWe6ye0RcSHaILrnGjyQ0DhoWvOjqz+hHNdPu6tE96KKUMwZvdnN5ze ogbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dejzk4g+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a631b07000000b0040d27a77a2dsi18805661pgb.47.2022.07.07.06.19.00; Thu, 07 Jul 2022 06:19:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dejzk4g+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235635AbiGGM7Q (ORCPT + 99 others); Thu, 7 Jul 2022 08:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235519AbiGGM7L (ORCPT ); Thu, 7 Jul 2022 08:59:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E6F613E16 for ; Thu, 7 Jul 2022 05:59:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADC21612C3 for ; Thu, 7 Jul 2022 12:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09DBDC3411E; Thu, 7 Jul 2022 12:59:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1657198749; bh=GL7/L+N8uPKWABVlRV+BfAz/iipWdU1VftMQQqJwNrA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dejzk4g+RkGEdCUI4uLj7Me9FpG2nKWWgkHNZkSRS0blSsbjUHPoM/Rw6sh4sUpW9 1asDjOMI9aJV36KR+VpeNF7z8qMTPAQAhENSBPvf3zG4dhwW8Hwmlay50uFWsk/+Vs HyUcyav4XzkUCgWYG3p6vEN/Mvw7uF1bLjhVecxzgKfXOI8IhEpPLpHDp4zrwrwjWZ Vg8RTcZRwVjMNbgGSkUyRwUqvaUQNM7kUvaWYlFQBDY525bIMTXVzR3+bApON4i+dI 6soOERXDuDJfYug2dvBw+7eQVjan2AQktB49jW/4Il1xPi45aLAeOwW6d91ZHeSKU1 Ems1ZCZKtz1rw== Received: from [185.201.63.253] (helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1o9R62-005v5W-Lf; Thu, 07 Jul 2022 13:59:06 +0100 Date: Thu, 07 Jul 2022 13:59:02 +0100 Message-ID: <87y1x5krjd.wl-maz@kernel.org> From: Marc Zyngier To: Jianmin Lv Cc: Thomas Gleixner , linux-kernel@vger.kernel.org, Hanjun Guo , Lorenzo Pieralisi , Jiaxun Yang , Huacai Chen Subject: Re: [PATCH V14 14/15] irqchip / ACPI: Introduce ACPI_IRQ_MODEL_LPIC for LoongArch In-Reply-To: <1656837932-18257-15-git-send-email-lvjianmin@loongson.cn> References: <1656837932-18257-1-git-send-email-lvjianmin@loongson.cn> <1656837932-18257-15-git-send-email-lvjianmin@loongson.cn> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.201.63.253 X-SA-Exim-Rcpt-To: lvjianmin@loongson.cn, tglx@linutronix.de, linux-kernel@vger.kernel.org, guohanjun@huawei.com, lorenzo.pieralisi@arm.com, jiaxun.yang@flygoat.com, chenhuacai@loongson.cn X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 03 Jul 2022 09:45:31 +0100, Jianmin Lv 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 > --- > 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. M. -- Without deviation from the norm, progress is not possible.