[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wmkortqo.ffs@tglx>
Date: Sat, 10 Aug 2024 22:46:39 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Bibo Mao <maobibo@...ngson.cn>, Tianrui Zhao <zhaotianrui@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>
Cc: WANG Xuerui <kernel@...0n.name>, kvm@...r.kernel.org,
loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
virtualization@...ts.linux.dev, x86@...nel.org, Song Gao
<gaosong@...ngson.cn>
Subject: Re: [PATCH v5 3/3] irqchip/loongson-eiointc: Add extioi virt
extension support
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
Powered by blists - more mailing lists