From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E77FCEB64DA for ; Wed, 12 Jul 2023 08:57:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233134AbjGLI5h (ORCPT ); Wed, 12 Jul 2023 04:57:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233122AbjGLI4v (ORCPT ); Wed, 12 Jul 2023 04:56:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F4142686; Wed, 12 Jul 2023 01:56:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 97E9C6136E; Wed, 12 Jul 2023 08:56:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFD85C433C8; Wed, 12 Jul 2023 08:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689152172; bh=1S3dMGABiFsR9l5YuP3w/ZECP/KUVB6wS+iLKTWqt4o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=O9+nGKQ05wfZ3u6p537INfCjp/6X1gI7f+a26cT35SPHzzEa7Zne+o8CK4cTpcS9f dWxJ6nG5MUVwXDl+wpqan6g5Sma2BkwiGKW3qKvoFxFrpYG2gkKK7VP4l41QiFjZze YnFRCOKMvRU94wxqJ3Qd3RyORpkgod0KPRWQYtV6wTgUo3uYx9cT6ApTse/buE8EY+ PFefeGlnV7jz2bc2gxJqy9p/iKndS4lXFEJzctT2YI8RqG1gULCluSejELvqbpsqhl UJ38TCNZV5bL33EpwVL7uHCAmxcCgqQZtmM5Uti6b9Hq+liZqQ3afXNi8Xo1zb1NkL n1I9Ck617T7dQ== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.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 1qJVdp-00CNxH-Lq; Wed, 12 Jul 2023 09:56:09 +0100 Date: Wed, 12 Jul 2023 09:56:09 +0100 Message-ID: <865y6pwlsm.wl-maz@kernel.org> From: Marc Zyngier To: Bibo Mao Cc: Huacai Chen , Jiaxun Yang , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jianmin Lv , loongson-kernel@lists.loongnix.cn Subject: Re: [PATCH v3 1/2] irqchip/loongson-eiointc: Fix return value checking of eiointc_index In-Reply-To: <20230711120807.1805186-2-maobibo@loongson.cn> References: <20230711120807.1805186-1-maobibo@loongson.cn> <20230711120807.1805186-2-maobibo@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/28.2 (aarch64-unknown-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.219.108.64 X-SA-Exim-Rcpt-To: maobibo@loongson.cn, chenhuacai@kernel.org, jiaxun.yang@flygoat.com, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, lvjianmin@loongson.cn, loongson-kernel@lists.loongnix.cn X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 11 Jul 2023 13:08:06 +0100, Bibo Mao wrote: > > Return value of function eiointc_index is int, however it is converted > into uint32_t and then compared smaller than zero. This causes logic > problem. There is eioint initialization problem on qemu virt-machine > where there is only one eioint node and more than 4 vcpus. Nodemap of > eioint is 1, and external device intr can only be routed to vcpu 0-3, the > other vcpus can not response any external device interrupts and only local > processor interrupts like ipi/timer can work. > > Signed-off-by: Bibo Mao > --- > drivers/irqchip/irq-loongson-eiointc.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c > index 92d8aa28bdf5..1c5a5b59f199 100644 > --- a/drivers/irqchip/irq-loongson-eiointc.c > +++ b/drivers/irqchip/irq-loongson-eiointc.c > @@ -144,12 +144,14 @@ static int eiointc_router_init(unsigned int cpu) > int i, bit; > uint32_t data; > uint32_t node = cpu_to_eio_node(cpu); > - uint32_t index = eiointc_index(node); > + int index = eiointc_index(node); > > - if (index < 0) { > - pr_err("Error: invalid nodemap!\n"); > - return -1; > - } > + /* > + * qemu virt-machine has only one eio intc and more than four cpus > + * irq from eio can only be routed to cpu 0-3 on virt machine > + */ > + if (index < 0) > + return 0; > > if ((cpu_logical_map(cpu) % CORES_PER_EIO_NODE) == 0) { > eiointc_enable(); This sort of thing really needs a Fixes: tag. Thanks, M. -- Without deviation from the norm, progress is not possible.