public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Bibo Mao <maobibo@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jianmin Lv <lvjianmin@loongson.cn>,
	loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v3 1/2] irqchip/loongson-eiointc: Fix return value checking of eiointc_index
Date: Wed, 12 Jul 2023 09:56:09 +0100	[thread overview]
Message-ID: <865y6pwlsm.wl-maz@kernel.org> (raw)
In-Reply-To: <20230711120807.1805186-2-maobibo@loongson.cn>

On Tue, 11 Jul 2023 13:08:06 +0100,
Bibo Mao <maobibo@loongson.cn> 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 <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();

This sort of thing really needs a Fixes: tag.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

  parent reply	other threads:[~2023-07-12  8:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-11 12:08 [PATCH v3 0/2] irqchip/loongson-eiointc: Add simple irq routing method Bibo Mao
2023-07-11 12:08 ` [PATCH v3 1/2] irqchip/loongson-eiointc: Fix return value checking of eiointc_index Bibo Mao
2023-07-11 13:18   ` Philippe Mathieu-Daudé
2023-07-11 15:06   ` Huacai Chen
2023-07-12  1:03     ` bibo mao
2023-07-12  8:56   ` Marc Zyngier [this message]
2023-07-12  9:14     ` bibo mao
2023-07-11 12:08 ` [PATCH v3 2/2] irqchip/loongson-eiointc: Simplify irq routing on some platforms Bibo Mao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865y6pwlsm.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=chenhuacai@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=lvjianmin@loongson.cn \
    --cc=maobibo@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox