Message ID | 20230706022849.1272591-2-maobibo@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2278774vqx; Wed, 5 Jul 2023 20:07:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlECVemttQsamBFs/ZyuB0fN7SXVJNRgISdPwB4070mnCV767IXTo7ACa7HYO5+o+AqRivaL X-Received: by 2002:a54:4482:0:b0:3a3:7b77:bb2d with SMTP id v2-20020a544482000000b003a37b77bb2dmr446423oiv.13.1688612864020; Wed, 05 Jul 2023 20:07:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688612863; cv=none; d=google.com; s=arc-20160816; b=vQnQNukzPP+olIBHGLFbPHjonVU66ZUs+hbkNAQyzrASNhktc6yQzpEx+aM6fW5cjb 5i2Gt/trCLrHTW1red2+FJzqxoU/3AA9yphGKDC/nalRbjAi+ZkaEdMI6BOgVqMYuPnh NTJnxRQmOBJwxSpbFDXzMaJAyn8YYvYtPlxPsDIRGlK1I8mJB88FH3JiRVvh1IHrcsbk WRotETO6kpx4pjC59Rm5oxQeeBJsn6QN4e4O9jOGveK3ClDThvxxJZBpbLkwkR76WNaO 1TaTfl83gRLVzlvdWJEFxn1rPTQuJnuUA2mk86d2zPTp3Q51dEmyaKi1G3rbuH0X1qCq +LDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=sBBmKEUAHQ6JNdCozbam94sBO6Ar8JItZRMgx2zfvHw=; fh=WrELnb4ZUhcKoy8qr+86JwLN9Krfq2ED1i0xcLj9B70=; b=sO91Lw5HENHHX3iRNaRznkSY6IfGVdg0/g08z53R4iXQXyWM/cZxy+a4+oKsUZbUKL y/thQOEGz59niih11iTscmb3NdV5vMyQkn40r+MPvY8Pker+VseAcW8DtaXrgiW3QdUb q1oBDfYQmutzkQgGMYOrSKBw1T24ALJHIZcZ4REBh06MU3Vgc3SOwys5vjZ0VtZub04d xlbIf+fVYFdo3RTa7jLb355sxXcxnIkaMYF40J1FjZ2ytTdz5h24ecIqvo5tUwp3EFDJ 5OrSKHod5TyRCI9y4XjAZgAjQH4QG+KHGmw1aOYuSLpXEECEWlMXhXuTRQB3B1maVOjA IqYw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k28-20020aa79d1c000000b006687255a465si493618pfp.298.2023.07.05.20.07.28; Wed, 05 Jul 2023 20:07:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233327AbjGFC24 (ORCPT <rfc822;tebrre53rla2o@gmail.com> + 99 others); Wed, 5 Jul 2023 22:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229793AbjGFC2w (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Jul 2023 22:28:52 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7D7561995; Wed, 5 Jul 2023 19:28:51 -0700 (PDT) Received: from loongson.cn (unknown [10.2.9.158]) by gateway (Coremail) with SMTP id _____8AxCPLiJqZkGbQAAA--.3114S3; Thu, 06 Jul 2023 10:28:50 +0800 (CST) Received: from kvm-1-158.loongson.cn (unknown [10.2.9.158]) by localhost.localdomain (Coremail) with SMTP id AQAAf8AxjiPhJqZktK8dAA--.49030S3; Thu, 06 Jul 2023 10:28:49 +0800 (CST) From: Bibo Mao <maobibo@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Marc Zyngier <maz@kernel.org> Cc: linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Jianmin Lv <lvjianmin@loongson.cn>, loongson-kernel@lists.loongnix.cn Subject: [PATCH v2 1/2] irqchip/loongson-eiointc: Fix return value checking of eiointc_index Date: Thu, 6 Jul 2023 10:28:48 +0800 Message-Id: <20230706022849.1272591-2-maobibo@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20230706022849.1272591-1-maobibo@loongson.cn> References: <20230706022849.1272591-1-maobibo@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQAAf8AxjiPhJqZktK8dAA--.49030S3 X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ X-Coremail-Antispam: 1Uk129KBj93XoW7tFW3Zr4DCFyfZF1fZr4kZrc_yoW8JFyUpF W3AFZFvr15Wa4xCrZrKF48JryYyws3t3y7tayxJay7XFs8J34DJr4rA3Z0yr10krW3uFy2 gF4rXFWUC3Z8AwcCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9jb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_JFI_Gr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8JVWxJwA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ Gr0_Gr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07AIYI kI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUAVWU twAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v26r1Y 6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7 AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE 2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcV C2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2Kfnx nUUI43ZEXa7IU8q2NtUUUUU== X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770638922032164929?= X-GMAIL-MSGID: =?utf-8?q?1770638922032164929?= |
Series |
irqchip/loongson-eiointc: Add simple irq routing method
|
|
Commit Message
maobibo
July 6, 2023, 2:28 a.m. UTC
return value of function eiointc_index is int, however it is
converted uint32_t when used. This causes logic problem when
checking return value. There is eioi initial problem on qemu
virt-machine where there is only one eioi node and more than 4
vcpus, external device intr can only be routed to vcpu 0-3.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
---
drivers/irqchip/irq-loongson-eiointc.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
Comments
On Thu, Jul 6, 2023 at 10:28 AM Bibo Mao <maobibo@loongson.cn> wrote: > > return value of function eiointc_index is int, however it is 'return' -> 'Return'. > converted uint32_t when used. This causes logic problem when > checking return value. There is eioi initial problem on qemu 'eioi' -> 'eiointc'. Huacai > virt-machine where there is only one eioi node and more than 4 > vcpus, external device intr can only be routed to vcpu 0-3. > > Signed-off-by: Bibo Mao <maobibo@loongson.cn> > --- > 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(); > -- > 2.27.0 >
Huacai, Thanks for reviewing my patch. I reply inline. 在 2023/7/11 09:59, Huacai Chen 写道: > On Thu, Jul 6, 2023 at 10:28 AM Bibo Mao <maobibo@loongson.cn> wrote: >> >> return value of function eiointc_index is int, however it is > 'return' -> 'Return'. Will do. > >> converted uint32_t when used. This causes logic problem when >> checking return value. There is eioi initial problem on qemu > 'eioi' -> 'eiointc'. Will do in next version. Regards Bibo Mao > > Huacai > >> virt-machine where there is only one eioi node and more than 4 >> vcpus, external device intr can only be routed to vcpu 0-3. > >> >> Signed-off-by: Bibo Mao <maobibo@loongson.cn> >> --- >> 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(); >> -- >> 2.27.0 >>
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();