* [PATCH] irqchip/gic-v3: Pass GICV index to gic_of_setup_kvm_info()
@ 2024-06-28 12:23 Geert Uytterhoeven
2024-06-28 16:51 ` Marc Zyngier
0 siblings, 1 reply; 2+ messages in thread
From: Geert Uytterhoeven @ 2024-06-28 12:23 UTC (permalink / raw)
To: Marc Zyngier, Thomas Gleixner
Cc: linux-arm-kernel, linux-renesas-soc, linux-kernel,
Geert Uytterhoeven
The caller of gic_of_setup_kvm_info() already queried DT for the value
of the #redistributor-regions property. So just calculate and pass the
GICV index, instead of doing the DT look-up again in the callee.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
drivers/irqchip/irq-gic-v3.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 1f70262742f3b7c7..9c03b63277ba5b2b 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -2185,11 +2185,10 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
of_node_put(parts_node);
}
-static void __init gic_of_setup_kvm_info(struct device_node *node)
+static void __init gic_of_setup_kvm_info(struct device_node *node, u32 gicv_idx)
{
int ret;
struct resource r;
- u32 gicv_idx;
gic_v3_kvm_info.type = GIC_V3;
@@ -2197,11 +2196,6 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
if (!gic_v3_kvm_info.maint_irq)
return;
- if (of_property_read_u32(node, "#redistributor-regions",
- &gicv_idx))
- gicv_idx = 1;
-
- gicv_idx += 3; /* Also skip GICD, GICC, GICH */
ret = of_address_to_resource(node, gicv_idx, &r);
if (!ret)
gic_v3_kvm_info.vcpu = r;
@@ -2292,7 +2286,7 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
gic_populate_ppi_partitions(node);
if (static_branch_likely(&supports_deactivate_key))
- gic_of_setup_kvm_info(node);
+ gic_of_setup_kvm_info(node, nr_redist_regions + 3);
return 0;
out_unmap_rdist:
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] irqchip/gic-v3: Pass GICV index to gic_of_setup_kvm_info()
2024-06-28 12:23 [PATCH] irqchip/gic-v3: Pass GICV index to gic_of_setup_kvm_info() Geert Uytterhoeven
@ 2024-06-28 16:51 ` Marc Zyngier
0 siblings, 0 replies; 2+ messages in thread
From: Marc Zyngier @ 2024-06-28 16:51 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Thomas Gleixner, linux-arm-kernel, linux-renesas-soc,
linux-kernel
Hi Geert,
On Fri, 28 Jun 2024 13:23:29 +0100,
Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>
> The caller of gic_of_setup_kvm_info() already queried DT for the value
> of the #redistributor-regions property. So just calculate and pass the
> GICV index, instead of doing the DT look-up again in the callee.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> drivers/irqchip/irq-gic-v3.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
> index 1f70262742f3b7c7..9c03b63277ba5b2b 100644
> --- a/drivers/irqchip/irq-gic-v3.c
> +++ b/drivers/irqchip/irq-gic-v3.c
> @@ -2185,11 +2185,10 @@ static void __init gic_populate_ppi_partitions(struct device_node *gic_node)
> of_node_put(parts_node);
> }
>
> -static void __init gic_of_setup_kvm_info(struct device_node *node)
> +static void __init gic_of_setup_kvm_info(struct device_node *node, u32 gicv_idx)
> {
> int ret;
> struct resource r;
> - u32 gicv_idx;
>
> gic_v3_kvm_info.type = GIC_V3;
>
> @@ -2197,11 +2196,6 @@ static void __init gic_of_setup_kvm_info(struct device_node *node)
> if (!gic_v3_kvm_info.maint_irq)
> return;
>
> - if (of_property_read_u32(node, "#redistributor-regions",
> - &gicv_idx))
> - gicv_idx = 1;
> -
> - gicv_idx += 3; /* Also skip GICD, GICC, GICH */
Please keep the comment and/or make this '3' a #define so that we can
easily remember why we're adding some apparently random number.
> ret = of_address_to_resource(node, gicv_idx, &r);
> if (!ret)
> gic_v3_kvm_info.vcpu = r;
> @@ -2292,7 +2286,7 @@ static int __init gic_of_init(struct device_node *node, struct device_node *pare
> gic_populate_ppi_partitions(node);
>
> if (static_branch_likely(&supports_deactivate_key))
> - gic_of_setup_kvm_info(node);
> + gic_of_setup_kvm_info(node, nr_redist_regions + 3);
> return 0;
>
> out_unmap_rdist:
With that fixed,
Acked-by: Marc Zyngier <maz@kernel.org>
M.
--
Without deviation from the norm, progress is not possible.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-28 16:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-28 12:23 [PATCH] irqchip/gic-v3: Pass GICV index to gic_of_setup_kvm_info() Geert Uytterhoeven
2024-06-28 16:51 ` Marc Zyngier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).