From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 05E75342C80; Mon, 12 Jan 2026 08:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207441; cv=none; b=ZpVOdX6hgQ85TbhVvq17EbEPAF29HssfTpIb0nSS6keDZvNXxmAFTRiICCd5E8GvZ+1MqLPUAyaxriZtUKRXPsLoVmtEqz9HooRu9ztrHjjDBv51q17541S1Jkp3ItqJs1jTFnWbVTRS469UuUzac3KXqkfpkeeEmmmPYJs0Wuc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207441; c=relaxed/simple; bh=aKhduY20fT9Hpvr0jeldTUmtyfo5KwPrSMTVQGzYKtA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LmZoeeTkhxoggkR3GIoaDjxWsKV8r3nXXmvEvZMkk07ZQJmhe/ZEl2g0D68R3YuMpZP4XBzAQu9ObeqgyLjzkwce2kphwLPVm634YyWtEXOsRUdgPQ5Y8KYeWeoVnNBQOd4JPAQgYiiO5qqbPWmBYEyTaZMRF63Scd5rkbsrrsE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5CDEC116D0; Mon, 12 Jan 2026 08:43:58 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 1/7] irqchip/loongarch-avec: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:14 +0800 Message-ID: <20260112084320.1982244-2-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" csr_read64() is only available on 64BIT LoongArch platform, so use recently added adaptive csr_read() instead, so as to make the driver work on both 32BIT and 64BIT platform. BTW, make avecintc_enable() be a no-op since it is only needed by 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongarch-avec.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/irqchip/irq-loongarch-avec.c b/drivers/irqchip/irq-loo= ngarch-avec.c index ba556c008cf3..bd29bf4c07ed 100644 --- a/drivers/irqchip/irq-loongarch-avec.c +++ b/drivers/irqchip/irq-loongarch-avec.c @@ -58,11 +58,13 @@ struct avecintc_data { =20 static inline void avecintc_enable(void) { - u64 value; + if (IS_ENABLED(CONFIG_MACH_LOONGSON64)) { + u64 value; =20 - value =3D iocsr_read64(LOONGARCH_IOCSR_MISC_FUNC); - value |=3D IOCSR_MISC_FUNC_AVEC_EN; - iocsr_write64(value, LOONGARCH_IOCSR_MISC_FUNC); + value =3D iocsr_read64(LOONGARCH_IOCSR_MISC_FUNC); + value |=3D IOCSR_MISC_FUNC_AVEC_EN; + iocsr_write64(value, LOONGARCH_IOCSR_MISC_FUNC); + } } =20 static inline void avecintc_ack_irq(struct irq_data *d) @@ -167,7 +169,7 @@ void complete_irq_moving(void) struct pending_list *plist =3D this_cpu_ptr(&pending_list); struct avecintc_data *adata, *tdata; int cpu, vector, bias; - uint64_t isr; + unsigned long isr; =20 guard(raw_spinlock)(&loongarch_avec.lock); =20 @@ -177,16 +179,16 @@ void complete_irq_moving(void) bias =3D vector / VECTORS_PER_REG; switch (bias) { case 0: - isr =3D csr_read64(LOONGARCH_CSR_ISR0); + isr =3D csr_read(LOONGARCH_CSR_ISR0); break; case 1: - isr =3D csr_read64(LOONGARCH_CSR_ISR1); + isr =3D csr_read(LOONGARCH_CSR_ISR1); break; case 2: - isr =3D csr_read64(LOONGARCH_CSR_ISR2); + isr =3D csr_read(LOONGARCH_CSR_ISR2); break; case 3: - isr =3D csr_read64(LOONGARCH_CSR_ISR3); + isr =3D csr_read(LOONGARCH_CSR_ISR3); break; } =20 @@ -234,7 +236,7 @@ static void avecintc_irq_dispatch(struct irq_desc *desc) chained_irq_enter(chip, desc); =20 while (true) { - unsigned long vector =3D csr_read64(LOONGARCH_CSR_IRR); + unsigned long vector =3D csr_read(LOONGARCH_CSR_IRR); if (vector & IRR_INVALID_MASK) break; =20 --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4E90E32A3C1; Mon, 12 Jan 2026 08:44:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207462; cv=none; b=UJJzuXKfZuU81V7FFt2Jadi6IkhXukpalozEixgAnJux9wTebkGsYPwWKoAtztfyHh8F6oC7RcuxYy5ks5XmJFn84Ydykn+EYeB4e78DDTSsbd6QQMIQFQ4453cWC6UasENUHFMUUtLdTGO5hQcKRlEX5PJR+UBWkrrHch2nmCs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207462; c=relaxed/simple; bh=dXK5xc/0Iy/RjvinuAmJfA4hXGDZuFREYUPikq+i30c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iVAe0B39f022mMBXnUxE8GZK0pptX32Uu6sxUPlIYie6VKd6y4LBJAcWZw70X8CNbJFInMJ5uT2Pft/mdDHDsLMNI3MgDKC6/JQG5ADVaAdigZRnchUQcj+1sSwh9+4KM3X4FpiS1OX0cpdSCNtGN5+8R0RVZ2ekUXANx54mmHE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A960C116D0; Mon, 12 Jan 2026 08:44:20 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 2/7] irqchip/loongson-liointc: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:15 +0800 Message-ID: <20260112084320.1982244-3-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type. Currently we pass acpi_liointc->address to it. This can only work on 64BIT platform because its type is u64, so cast it to phys_addr_t and then the driver works on both 32BIT and 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-liointc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-loongson-liointc.c b/drivers/irqchip/irq-l= oongson-liointc.c index 0033c2188abc..f001a34878ba 100644 --- a/drivers/irqchip/irq-loongson-liointc.c +++ b/drivers/irqchip/irq-loongson-liointc.c @@ -394,8 +394,9 @@ static int __init acpi_cascade_irqdomain_init(void) =20 int __init liointc_acpi_init(struct irq_domain *parent, struct acpi_madt_l= io_pic *acpi_liointc) { - int ret; + phys_addr_t addr =3D acpi_liointc->address; struct fwnode_handle *domain_handle; + int ret; =20 parent_int_map[0] =3D acpi_liointc->cascade_map[0]; parent_int_map[1] =3D acpi_liointc->cascade_map[1]; @@ -403,7 +404,7 @@ int __init liointc_acpi_init(struct irq_domain *parent,= struct acpi_madt_lio_pic parent_irq[0] =3D irq_create_mapping(parent, acpi_liointc->cascade[0]); parent_irq[1] =3D irq_create_mapping(parent, acpi_liointc->cascade[1]); =20 - domain_handle =3D irq_domain_alloc_fwnode(&acpi_liointc->address); + domain_handle =3D irq_domain_alloc_fwnode(&addr); if (!domain_handle) { pr_err("Unable to allocate domain handle\n"); return -ENOMEM; --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DADA232A3C1; Mon, 12 Jan 2026 08:44:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207478; cv=none; b=QWiwpTBKwCLsRgqTT0SosXFwm7wUdQIAKKovarcBjAGpSlPn35iotL6a8UnX9Lg4uJO840nu5A8zC5/IwHAwP07YiioWRmThivOt0L7cOv4xeHr/xtz9eRQFx55+RuSKAMkdmRlMTO67CEKh6hm71TTn3gSQ/iZSTxrFLfuSLUg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207478; c=relaxed/simple; bh=+DrtJfuavYoccwOIdmy5if+qbnnLpqRQOHzCCWTiBPc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fecDpJNw0WaaT80WClMOuk6CJUUdHiaaokT6glxvCUxqNp+vuZcC7VcE4eYoE4MTLVD4i5bmFtFtpHXGiPENElghJUri0n0rfZjukdV9X51aFTQK0Oyn0RrPsDjVNqPqPhF3jVEbOPdO/cz20irqK3c/u5jUZLBU/eGWtFL/afg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB84C116D0; Mon, 12 Jan 2026 08:44:36 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 3/7] irqchip/loongson-eiointc: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:16 +0800 Message-ID: <20260112084320.1982244-4-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" iocsr_read64()/iocsr_write64() are only available on 64BIT LoongArch platform, so add and use a pair of helpers, i.e. read_isr()/write_isr() instead, so as to make the driver work on both 32BIT and 64BIT platform. BTW, make eiointc_enable() be a no-op since it is only needed by 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-eiointc.c | 44 ++++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-l= oongson-eiointc.c index ad2105685b48..7fd0397d37f1 100644 --- a/drivers/irqchip/irq-loongson-eiointc.c +++ b/drivers/irqchip/irq-loongson-eiointc.c @@ -37,9 +37,9 @@ #define EXTIOI_ENABLE_INT_ENCODE BIT(2) #define EXTIOI_ENABLE_CPU_ENCODE BIT(3) =20 -#define VEC_REG_COUNT 4 -#define VEC_COUNT_PER_REG 64 -#define VEC_COUNT (VEC_REG_COUNT * VEC_COUNT_PER_REG) +#define VEC_COUNT 256 +#define VEC_COUNT_PER_REG BITS_PER_LONG +#define VEC_REG_COUNT (VEC_COUNT / BITS_PER_LONG) #define VEC_REG_IDX(irq_id) ((irq_id) / VEC_COUNT_PER_REG) #define VEC_REG_BIT(irq_id) ((irq_id) % VEC_COUNT_PER_REG) #define EIOINTC_ALL_ENABLE 0xffffffff @@ -85,11 +85,13 @@ static struct eiointc_priv *eiointc_priv[MAX_IO_PICS]; =20 static void eiointc_enable(void) { - uint64_t misc; + if (IS_ENABLED(CONFIG_MACH_LOONGSON64)) { + uint64_t misc; =20 - misc =3D iocsr_read64(LOONGARCH_IOCSR_MISC_FUNC); - misc |=3D IOCSR_MISC_FUNC_EXT_IOI_EN; - iocsr_write64(misc, LOONGARCH_IOCSR_MISC_FUNC); + misc =3D iocsr_read64(LOONGARCH_IOCSR_MISC_FUNC); + misc |=3D IOCSR_MISC_FUNC_EXT_IOI_EN; + iocsr_write64(misc, LOONGARCH_IOCSR_MISC_FUNC); + } } =20 static int cpu_to_eio_node(int cpu) @@ -281,12 +283,34 @@ static int eiointc_router_init(unsigned int cpu) return 0; } =20 +#if VEC_COUNT_PER_REG =3D=3D 32 +static unsigned long read_isr(int i) +{ + return iocsr_read32(EIOINTC_REG_ISR + (i << 2)); +} + +static void write_isr(int i, unsigned long val) +{ + iocsr_write32(val, EIOINTC_REG_ISR + (i << 2)); +} +#else +static unsigned long read_isr(int i) +{ + return iocsr_read64(EIOINTC_REG_ISR + (i << 3)); +} + +static void write_isr(int i, unsigned long val) +{ + iocsr_write64(val, EIOINTC_REG_ISR + (i << 3)); +} +#endif + static void eiointc_irq_dispatch(struct irq_desc *desc) { struct eiointc_ip_route *info =3D irq_desc_get_handler_data(desc); struct irq_chip *chip =3D irq_desc_get_chip(desc); bool handled =3D false; - u64 pending; + unsigned long pending; int i; =20 chained_irq_enter(chip, desc); @@ -299,14 +323,14 @@ static void eiointc_irq_dispatch(struct irq_desc *des= c) * read ISR for these 64 interrupt vectors rather than all vectors */ for (i =3D info->start; i < info->end; i++) { - pending =3D iocsr_read64(EIOINTC_REG_ISR + (i << 3)); + pending =3D read_isr(i); =20 /* Skip handling if pending bitmap is zero */ if (!pending) continue; =20 /* Clear the IRQs */ - iocsr_write64(pending, EIOINTC_REG_ISR + (i << 3)); + write_isr(i, pending); while (pending) { int bit =3D __ffs(pending); int irq =3D bit + VEC_COUNT_PER_REG * i; --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 F41B0331A5D; Mon, 12 Jan 2026 08:44:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207500; cv=none; b=f7hT0lSRhnys+PxGynoVg4XqzKZmCrzbGRuHVFM6Pi9d+WtCRqYL3fFjSLbAw5wz49taX3ih6wORdFqtXGtMua9G0t2r4MM2rY2JrFU2/IAZ8bf658b2xBxmlt4K7JWkwJMvlIMe18U0xEprtTT6s9vHRp5FcauZaM8UmGfTWcY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207500; c=relaxed/simple; bh=YPsKWla8G5Acl7rRSlbGKMRcCpoedfItddAu4Gdzf/0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PjLBnHJvlWiYXaQj4SPWotc24KQW0NaDzn3pp9RChXUQtrs9dfQVolRnv5mViMHhgbEG/6ihNScBcYuGj1a48K5LsBWVqmujJkNHS/cgLyaC5P6D6AWncfQy/eJ+baZVCMlejqnkQEcS63i33NQpskrIr4Cg1Gf3GtKyKvrpNzU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B143C116D0; Mon, 12 Jan 2026 08:44:57 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 4/7] irqchip/loongson-htvec: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:17 +0800 Message-ID: <20260112084320.1982244-5-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type. Currently we pass acpi_htvec->address to it. This can only work on 64BIT platform because its type is u64, so cast it to phys_addr_t and then the driver works on both 32BIT and 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-htvec.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loo= ngson-htvec.c index d2be8e954e92..03c3992b39c8 100644 --- a/drivers/irqchip/irq-loongson-htvec.c +++ b/drivers/irqchip/irq-loongson-htvec.c @@ -298,8 +298,8 @@ static int __init acpi_cascade_irqdomain_init(void) int __init htvec_acpi_init(struct irq_domain *parent, struct acpi_madt_ht_pic *acpi_htvec) { - int i, ret; - int num_parents, parent_irq[8]; + int i, ret, num_parents, parent_irq[8]; + phys_addr_t addr =3D acpi_htvec->address; struct fwnode_handle *domain_handle; =20 if (!acpi_htvec) @@ -307,7 +307,7 @@ int __init htvec_acpi_init(struct irq_domain *parent, =20 num_parents =3D HTVEC_MAX_PARENT_IRQ; =20 - domain_handle =3D irq_domain_alloc_fwnode(&acpi_htvec->address); + domain_handle =3D irq_domain_alloc_fwnode(&addr); if (!domain_handle) { pr_err("Unable to allocate domain handle\n"); return -ENOMEM; --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8B45C343D6F; Mon, 12 Jan 2026 08:45:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207536; cv=none; b=taSB10mvedn5LE8129Fzp9YZdkov9RCJGyG8L4Xi2uYStLsQQWUGc9aiByYP3ChUhBWMrnKBAVW+xgmff/VpC2gbou0mvJ0JRM23RE7tzTmKfLzptAESUJ3Y+imkSMlj9Gvg2zdibTLHpJGcAaIqEf/+5xy3bO4DqI01EMIYBw8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207536; c=relaxed/simple; bh=n0dxeLOCRes34IqYA6NMAtNQXEQIidRUp094thweXPE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uFCq8G1yjbEKFc7TOeiu7ph2GzOFKoGi5gYEsS5A6c2onphTjlDmYpUkuAALwziyGap+HeSYQOsqCyGIlFQwRdB0gz73C501IgwB1JHVgGALxyT+mbIryP5Ifq8NKQRULBQySHnsPAo42+uN3S8lzAVUqMcEuUV2yImcocVrG2I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51921C116D0; Mon, 12 Jan 2026 08:45:34 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 5/7] irqchip/loongson-pch-msi: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:18 +0800 Message-ID: <20260112084320.1982244-6-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type. Currently we pass acpi_pchmsi->msg_address to it. This can only work on 64BIT platform because its type is u64, so cast it to phys_addr_t and then the driver works on both 32BIT and 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-pch-msi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-msi.c b/drivers/irqchip/irq-l= oongson-pch-msi.c index 4aedc9b90ff7..8500662bdb33 100644 --- a/drivers/irqchip/irq-loongson-pch-msi.c +++ b/drivers/irqchip/irq-loongson-pch-msi.c @@ -263,11 +263,12 @@ struct fwnode_handle *get_pch_msi_handle(int pci_segm= ent) =20 int __init pch_msi_acpi_init(struct irq_domain *parent, struct acpi_madt_m= si_pic *acpi_pchmsi) { - int ret; + phys_addr_t msg_address =3D acpi_pchmsi->msg_address; struct fwnode_handle *domain_handle; + int ret; =20 - domain_handle =3D irq_domain_alloc_fwnode(&acpi_pchmsi->msg_address); - ret =3D pch_msi_init(acpi_pchmsi->msg_address, acpi_pchmsi->start, + domain_handle =3D irq_domain_alloc_fwnode(&msg_address); + ret =3D pch_msi_init(msg_address, acpi_pchmsi->start, acpi_pchmsi->count, parent, domain_handle); if (ret < 0) irq_domain_free_fwnode(domain_handle); --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EFEF833BBD1; Mon, 12 Jan 2026 08:46:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207570; cv=none; b=TwLkHvrrKmPgtk66FPPkZFOuxqHI9KUnpbKT7fnBpyOeWV5d0zcmDu6nJaBif+iyGIY63gAW8MTp7nDwg3KF2n4PS3evnd2jtFgc4tF1vE42CJfW34TvHK7i1pgMPDWSZLWzwyDIOiDvJCDVz18pjeboijQLpgPqVQSa+tLcZJo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207570; c=relaxed/simple; bh=sYoFKOzueta7oShUuE+v4VS+babWzv033PSihn5ipl4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BCs7qQOF9zPU2ZRgIxeRi8vtDW+S7LmKaLNHIntOv0LPEuR+Z+c0wrKQGan6znfHjLTW4XVtBIUBXUMVkfBDzZumy91ExD/jHXhFVGzk1OBeNDSSSRs3RfgMQ8IQCyufIzttt281V5BGA74k76JEnPaBeg1FkZsIT7pneTjMask= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C821BC116D0; Mon, 12 Jan 2026 08:46:07 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 6/7] irqchip/loongson-pch-pic: Adjust irqchip driver for 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:19 +0800 Message-ID: <20260112084320.1982244-7-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" irq_domain_alloc_fwnode() takes a parameter with the phys_addr_t type. Currently we pass acpi_pchpic->address to it. This can only work on 64BIT platform because its type is u64, so cast it to phys_addr_t and then the driver works on both 32BIT and 64BIT platform. BTW, use readl() to get vec_count because readq() is only available on 64BIT platform. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/irq-loongson-pch-pic.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-l= oongson-pch-pic.c index c6b369a974a7..2ac7e3245b72 100644 --- a/drivers/irqchip/irq-loongson-pch-pic.c +++ b/drivers/irqchip/irq-loongson-pch-pic.c @@ -343,7 +343,7 @@ static int pch_pic_init(phys_addr_t addr, unsigned long= size, int vec_base, priv->table[i] =3D PIC_UNDEF_VECTOR; =20 priv->ht_vec_base =3D vec_base; - priv->vec_count =3D ((readq(priv->base) >> 48) & 0xff) + 1; + priv->vec_count =3D ((readl(priv->base + 4) >> 16) & 0xff) + 1; priv->gsi_base =3D gsi_base; =20 priv->pic_domain =3D irq_domain_create_hierarchy(parent_domain, 0, @@ -449,13 +449,14 @@ static int __init acpi_cascade_irqdomain_init(void) int __init pch_pic_acpi_init(struct irq_domain *parent, struct acpi_madt_bio_pic *acpi_pchpic) { - int ret; + phys_addr_t addr =3D acpi_pchpic->address; struct fwnode_handle *domain_handle; + int ret; =20 if (find_pch_pic(acpi_pchpic->gsi_base) >=3D 0) return 0; =20 - domain_handle =3D irq_domain_alloc_fwnode(&acpi_pchpic->address); + domain_handle =3D irq_domain_alloc_fwnode(&addr); if (!domain_handle) { pr_err("Unable to allocate domain handle\n"); return -ENOMEM; --=20 2.47.3 From nobody Mon Feb 9 02:38:08 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 0445F343D6F; Mon, 12 Jan 2026 08:46:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207588; cv=none; b=RQXMvzVKWW0Dkd8LeXQH+Pus6xY7LsiyRJW9w+kWIHazoTHtcFaHbrO64t9IXi9iL+BY5yoF7jLhCKdVc5A1Ah735Nvm6rXpaZahK5EM6lSjvSIVWJzpP3Xn3o6RJFGo5SWK1kooq+q0USvMAeYmEXUs5sPRojFr9AD9PnZyri4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768207588; c=relaxed/simple; bh=JSiPb2RnLtMPL21l8Qk+GasrgfOQb4XXLrGb5p1UAdc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A63naO73JPe1xFimsULNaBDhJ0+P6/DtLMJDhIxS1tXMPa7PJrqPE5oA5e5TMxaaMXM3CCAkhAHLYUJkPkDtATqU4AfZLozaNxRrA5ar9YMpuIv0OmS3HOy40JLw9V+Qw4rhkBSx0M+IuY2YWdbGl1A/IwfQENRj7LWm3BhzAqc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBE04C116D0; Mon, 12 Jan 2026 08:46:25 +0000 (UTC) From: Huacai Chen To: Thomas Gleixner Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, Xuefeng Li , Huacai Chen , Jiaxun Yang , Huacai Chen Subject: [PATCH V2 7/7] irqchip: Allow LoongArch irqchip drivers on both 32BIT/64BIT Date: Mon, 12 Jan 2026 16:43:20 +0800 Message-ID: <20260112084320.1982244-8-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260112084320.1982244-1-chenhuacai@loongson.cn> References: <20260112084320.1982244-1-chenhuacai@loongson.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" All LoongArch irqchip drivers are adjusted, allow them be built on both 32BIT and 64BIT platforms. Co-developed-by: Jiaxun Yang Signed-off-by: Jiaxun Yang Signed-off-by: Huacai Chen --- drivers/irqchip/Kconfig | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index f334f49c9791..270f1c4783e3 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -698,7 +698,7 @@ config IRQ_LOONGARCH_CPU =20 config LOONGSON_LIOINTC bool "Loongson Local I/O Interrupt Controller" - depends on MACH_LOONGSON64 + depends on MACH_LOONGSON64 || LOONGARCH default y select IRQ_DOMAIN select GENERIC_IRQ_CHIP @@ -708,7 +708,6 @@ config LOONGSON_LIOINTC config LOONGSON_EIOINTC bool "Loongson Extend I/O Interrupt Controller" depends on LOONGARCH - depends on MACH_LOONGSON64 default MACH_LOONGSON64 select IRQ_DOMAIN_HIERARCHY select GENERIC_IRQ_CHIP @@ -726,7 +725,7 @@ config LOONGSON_HTPIC =20 config LOONGSON_HTVEC bool "Loongson HyperTransport Interrupt Vector Controller" - depends on MACH_LOONGSON64 + depends on MACH_LOONGSON64 || LOONGARCH default MACH_LOONGSON64 select IRQ_DOMAIN_HIERARCHY help @@ -734,7 +733,7 @@ config LOONGSON_HTVEC =20 config LOONGSON_PCH_PIC bool "Loongson PCH PIC Controller" - depends on MACH_LOONGSON64 + depends on MACH_LOONGSON64 || LOONGARCH default MACH_LOONGSON64 select IRQ_DOMAIN_HIERARCHY select IRQ_FASTEOI_HIERARCHY_HANDLERS @@ -743,7 +742,7 @@ config LOONGSON_PCH_PIC =20 config LOONGSON_PCH_MSI bool "Loongson PCH MSI Controller" - depends on MACH_LOONGSON64 + depends on MACH_LOONGSON64 || LOONGARCH depends on PCI default MACH_LOONGSON64 select IRQ_DOMAIN_HIERARCHY @@ -755,7 +754,7 @@ config LOONGSON_PCH_MSI config LOONGSON_PCH_LPC bool "Loongson PCH LPC Controller" depends on LOONGARCH - depends on MACH_LOONGSON64 + depends on MACH_LOONGSON64 || LOONGARCH default MACH_LOONGSON64 select IRQ_DOMAIN_HIERARCHY help --=20 2.47.3