Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38052905rwd; Wed, 12 Jul 2023 02:14:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlFu5GcCTfdBOalYofgTXiiyjyjxSsw0ae2FpNlYMnGLiiLE0WoTvi07DQAoXYOILxfVjLqE X-Received: by 2002:a05:6808:1289:b0:3a4:ccf:53e8 with SMTP id a9-20020a056808128900b003a40ccf53e8mr10094207oiw.29.1689153265936; Wed, 12 Jul 2023 02:14:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689153265; cv=none; d=google.com; s=arc-20160816; b=GWkAv9yvog3dznak1X3nVrGhb/XGOZ0WSKUD0UeN1iZUQJuCtHgogDf4oSfI9kiR14 80xyVQPxEVGiaXFl2yG0r5lkyaak0sHuQXVQQPy4ktW8fR5kl5t1fJi8oNb5NY+2/Dnm qmrOkYyuSPb5O9VepnhmuIjwWlUO83MORxdC+5hxPZhgqYN87tdoNoPk/iRp9nkYb3W+ WHK4eEOHzVNOtkFizYbQBMdU6WOPgYf91P6zBZHyYQowqJJ7upJE8hxehycsxUuzoA4Q V1c3myegKDXsCNU+euiou7Iw69ZLOLYYNKRqKKk5HqFlygHZ0+bzZpwdepoisdrC1huT x86Q== 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=G+z42j6zBLHeERZZ+n1vUuQ5SqXg/P0nhfKmDYut/m4=; fh=6oGG+0PgC6FFIud4/NpSOCPZIRucDGxm+QaVRFVPqM8=; b=zy4y5Mub/aKZOdrKJU1DAQRXr8LGfSxxLRmO2gRtlv4H+ceOf75invr+dq2c9T48HS unPvhptcAqfbpe8nbyCX9pbIIMTf9Ip0Rwnz05hkckkmsfK8Io0Zq1Neec/db9qFdxlh c7sq4Z+Gk5jtdrEsg9ZCLNvHyGERjksTU66VSharN7Lv6jGB+I2htfYRmtxCbEWbFvrs u4HM75/FQRFUEEEQ2ElvIbivGQth+y9FfL42WhRVaaFccrB0uk1iGs+x/1Ax+OEGFMiQ uFyynsH4ALQGyILSXdq9VpNUyJONOg9r1ztevqge/RoHBENGX+JEmss0WKKABOHjpI2n q5Vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=O9+nGKQ0; 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 ck13-20020a056a00328d00b0067f69d10241si2941854pfb.176.2023.07.12.02.14.14; Wed, 12 Jul 2023 02:14:25 -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=O9+nGKQ0; 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 S233133AbjGLI5f (ORCPT + 99 others); Wed, 12 Jul 2023 04:57:35 -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 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 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.