From nobody Thu Apr 2 20:28:23 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3EA5D3FEB2D; Thu, 26 Mar 2026 15:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774538521; cv=none; b=MtGTXduwXMgvJlvjp9L6mCd7VidovZAixD6+erk0o5EJziD/wpA+yCjJLfmXdznk+JANv6nwPI5RBzfQOqrIL737uRak3jfKaRj88//9Nl0rOj6qhm31ovkQlu952L4gMlq8C3GSiFoTMwiW0gXsLxDtoCqXFB9Fyj1z8N6yYbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774538521; c=relaxed/simple; bh=Epu8C2tW1CDVh5bEQbkk1rEumyJ2rO8swBxjVg5WWMI=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=RlrJS6BbyRnK85ZqwMoGPZ9TIo2ikrM7yOzPgdxf72D8Itq2GOU+KW9iySe54XO9zS8dMs0g1oYwtZM4mYPcYSdBzNSrNpnV7tPQNUp2/+E0cMLV9aRWFjEsyZAu37KohCufoxUek1+goLVdIK2WZMeErAOfjZj1Vn1q/KkaELQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=T5tthFim; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=1NbtxEN0; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="T5tthFim"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="1NbtxEN0" Date: Thu, 26 Mar 2026 15:21:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1774538517; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBxZDZ4GAyJnehR5/rhbXBZvHTXr5LPsaKGLH9fIreo=; b=T5tthFimBZLlEM8dHLEWkcy+MD/Of2NXCUHIkibdm/FHkdRplHcYVBCphcj2uC9eulgemh GxVdQ/lQsEczmtAKRFvpAW0yGwnSn2nZ5jPUZyUmHnALyVfO8QhmxIyN0RRYSJqM1a0DxF JKrGsrp+ZzpW4plcSpD0eU2uvQa68rK7FxoAwIN5moJqyej7m3e/V9hDgKgCTwxJmLxIz5 VIpav/JI9Ga2npEhnlvNZvJE8lPlslExjf02W/b3yd+Z911ccYNUDSBB2gWqpsQnNP3lOv J2PgsUAXBYXKpYH2Ue+lVo5ShQ2JYx7lQV6p8cInjZTOT49lN/TgBQJIdUUGFQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1774538517; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iBxZDZ4GAyJnehR5/rhbXBZvHTXr5LPsaKGLH9fIreo=; b=1NbtxEN0kep/bnE5h0Y6qJtoTX4F9+A2nKl4wFrGkAfkQXOv05LA/6UK+NfCG/QH2QXKy3 VM8/8T+zfDCYqQDQ== From: "tip-bot2 for Icenowy Zheng" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: irq/drivers] irqchip/loongson-pch-lpc: Extract non-ACPI-related code from ACPI init Cc: Jiaxun Yang , Icenowy Zheng , Thomas Gleixner , Huacai Chen , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20260321092032.3502701-5-zhengxingda@iscas.ac.cn> References: <20260321092032.3502701-5-zhengxingda@iscas.ac.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <177453851662.1647592.17512125517929334102.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the irq/drivers branch of tip: Commit-ID: 29c10a0af04e9b3eb7b06e72e9f75fccca45205e Gitweb: https://git.kernel.org/tip/29c10a0af04e9b3eb7b06e72e9f75fccc= a45205e Author: Icenowy Zheng AuthorDate: Sat, 21 Mar 2026 17:20:30 +08:00 Committer: Thomas Gleixner CommitterDate: Thu, 26 Mar 2026 16:15:03 +01:00 irqchip/loongson-pch-lpc: Extract non-ACPI-related code from ACPI init A lot of code can be shared between the existing ACPI init flow with the upcoming OF init flow. Extract it into a dedicated function. The re-ordering of parent interrupt allocation requires the architecture code to reserve legacy interrupts from the dynamic allocation by overriding arch_dynirq_lower_bound(), otherwise the parent of LPC irqchip will be allocated in the intended static range of LPC interrupts, which leads to allocation failure of LPC interrupts. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Icenowy Zheng Signed-off-by: Thomas Gleixner Reviewed-by: Huacai Chen Link: https://patch.msgid.link/20260321092032.3502701-5-zhengxingda@iscas.a= c.cn --- drivers/irqchip/irq-loongson-pch-lpc.c | 57 ++++++++++++++++--------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-lpc.c b/drivers/irqchip/irq-l= oongson-pch-lpc.c index 3ad46ec..2bb6659 100644 --- a/drivers/irqchip/irq-loongson-pch-lpc.c +++ b/drivers/irqchip/irq-loongson-pch-lpc.c @@ -175,13 +175,10 @@ static struct syscore pch_lpc_syscore =3D { .ops =3D &pch_lpc_syscore_ops, }; =20 -int __init pch_lpc_acpi_init(struct irq_domain *parent, - struct acpi_madt_lpc_pic *acpi_pchlpc) +static int __init pch_lpc_init(phys_addr_t addr, unsigned long size, + struct fwnode_handle *irq_handle, int parent_irq) { - int parent_irq; struct pch_lpc *priv; - struct irq_fwspec fwspec; - struct fwnode_handle *irq_handle; =20 priv =3D kzalloc_obj(*priv); if (!priv) @@ -189,7 +186,7 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent, =20 raw_spin_lock_init(&priv->lpc_lock); =20 - priv->base =3D ioremap(acpi_pchlpc->address, acpi_pchlpc->size); + priv->base =3D ioremap(addr, size); if (!priv->base) goto free_priv; =20 @@ -198,12 +195,6 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent, goto iounmap_base; } =20 - irq_handle =3D irq_domain_alloc_named_fwnode("lpcintc"); - if (!irq_handle) { - pr_err("Unable to allocate domain handle\n"); - goto iounmap_base; - } - /* * The LPC interrupt controller is a legacy i8259-compatible device, * which requires a static 1:1 mapping for IRQs 0-15. @@ -213,15 +204,10 @@ int __init pch_lpc_acpi_init(struct irq_domain *paren= t, &pch_lpc_domain_ops, priv); if (!priv->lpc_domain) { pr_err("Failed to create IRQ domain\n"); - goto free_irq_handle; + goto iounmap_base; } pch_lpc_reset(priv); =20 - fwspec.fwnode =3D parent->fwnode; - fwspec.param[0] =3D acpi_pchlpc->cascade + GSI_MIN_PCH_IRQ; - fwspec.param[1] =3D IRQ_TYPE_LEVEL_HIGH; - fwspec.param_count =3D 2; - parent_irq =3D irq_create_fwspec_mapping(&fwspec); irq_set_chained_handler_and_data(parent_irq, lpc_irq_dispatch, priv); =20 pch_lpc_priv =3D priv; @@ -230,8 +216,6 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent, =20 return 0; =20 -free_irq_handle: - irq_domain_free_fwnode(irq_handle); iounmap_base: iounmap(priv->base); free_priv: @@ -239,3 +223,36 @@ free_priv: =20 return -ENOMEM; } + +int __init pch_lpc_acpi_init(struct irq_domain *parent, struct acpi_madt_l= pc_pic *acpi_pchlpc) +{ + struct fwnode_handle *irq_handle; + struct irq_fwspec fwspec; + int parent_irq, ret; + + irq_handle =3D irq_domain_alloc_named_fwnode("lpcintc"); + if (!irq_handle) { + pr_err("Unable to allocate domain handle\n"); + return -ENOMEM; + } + + fwspec.fwnode =3D parent->fwnode; + fwspec.param[0] =3D acpi_pchlpc->cascade + GSI_MIN_PCH_IRQ; + fwspec.param[1] =3D IRQ_TYPE_LEVEL_HIGH; + fwspec.param_count =3D 2; + parent_irq =3D irq_create_fwspec_mapping(&fwspec); + if (parent_irq <=3D 0) { + pr_err("Unable to map LPC parent interrupt\n"); + irq_domain_free_fwnode(irq_handle); + return -ENOMEM; + } + + ret =3D pch_lpc_init(acpi_pchlpc->address, acpi_pchlpc->size, irq_handle,= parent_irq); + if (ret) { + irq_dispose_mapping(parent_irq); + irq_domain_free_fwnode(irq_handle); + return ret; + } + + return 0; +}