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 via email to