public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Bibo Mao <maobibo@loongson.cn>,
	Tianrui Zhao <zhaotianrui@loongson.cn>,
	Huacai Chen <chenhuacai@kernel.org>
Cc: WANG Xuerui <kernel@xen0n.name>,
	kvm@vger.kernel.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
	x86@kernel.org, Song Gao <gaosong@loongson.cn>
Subject: Re: [PATCH v5 3/3] irqchip/loongson-eiointc: Add extioi virt extension support
Date: Sat, 10 Aug 2024 22:46:39 +0200	[thread overview]
Message-ID: <87wmkortqo.ffs@tglx> (raw)
In-Reply-To: <20240805073546.668475-4-maobibo@loongson.cn>

On Mon, Aug 05 2024 at 15:35, Bibo Mao wrote:

> Interrupts can be routed to maximal four virtual CPUs with one external
> hardware interrupt. Add the extioi virt extension support so that
> Interrupts can be routed to 256 vcpus on hypervisor mode.

interrupts .... 256 vCPUs in hypervisor mode.

>  static int cpu_to_eio_node(int cpu)
>  {
> -	return cpu_logical_map(cpu) / CORES_PER_EIO_NODE;
> +	int cores;
> +
> +	if (kvm_para_available() && kvm_para_has_feature(KVM_FEATURE_VIRT_EXTIOI))

Why isn't that kvm_para_available() check inside of
kvm_para_has_feature() instead of inflicting it on every usage site?
That's just error prone.

> +		cores = CORES_PER_VEIO_NODE;
> +	else
> +		cores = CORES_PER_EIO_NODE;
> +	return cpu_logical_map(cpu) / cores;
>  }

> @@ -105,18 +144,24 @@ static int eiointc_set_irq_affinity(struct irq_data *d, const struct cpumask *af
> @@ -140,17 +185,23 @@ static int eiointc_index(int node)
>  
>  static int eiointc_router_init(unsigned int cpu)
>  {
> -	int i, bit;
> -	uint32_t data;
> -	uint32_t node = cpu_to_eio_node(cpu);
> -	int index = eiointc_index(node);
> +	uint32_t data, node;
> +	int i, bit, cores, index;

Is it so hard to follow:

  https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations

?

Thanks,

        tglx

  reply	other threads:[~2024-08-10 20:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-05  7:35 [PATCH v5 0/3] Add extioi virt extension support Bibo Mao
2024-08-05  7:35 ` [PATCH v5 1/3] LoongArch: KVM: Enable paravirt feature control from VMM Bibo Mao
2024-08-05  7:35 ` [PATCH v5 2/3] LoongArch: KVM: Implement function kvm_para_has_feature Bibo Mao
2024-08-05  7:35 ` [PATCH v5 3/3] irqchip/loongson-eiointc: Add extioi virt extension support Bibo Mao
2024-08-10 20:46   ` Thomas Gleixner [this message]
2024-08-12  1:10     ` maobibo

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=87wmkortqo.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=chenhuacai@kernel.org \
    --cc=gaosong@loongson.cn \
    --cc=kernel@xen0n.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=maobibo@loongson.cn \
    --cc=virtualization@lists.linux.dev \
    --cc=x86@kernel.org \
    --cc=zhaotianrui@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