* [PATCH v2] xen/arm: gic-v3: No need to sort the Redistributor regions
@ 2016-06-28 15:51 Julien Grall
2016-07-11 17:55 ` Stefano Stabellini
0 siblings, 1 reply; 2+ messages in thread
From: Julien Grall @ 2016-06-28 15:51 UTC (permalink / raw)
To: xen-devel; +Cc: Julien Grall, sstabellini, Shanker Donthineni
The sorting was required by the vGIC emulation until commit
9b9d51e98edb8c5c731e2d06dfad3633053d88a4 "xen/arm: vgic-v3:
Correctly retrieve the vCPU associated to a re-distributor".
Furthermore, the code is buggy because both local variables 'l' and 'r'
point to the same region.
So drop the code which sort the Redistributors array.
Reported-by: Shanker Donthineni <shankerd@codeaurora.org>
Signed-off-by: Julien Grall <julien.grall@arm.com>
---
Changes in v2:
- Fix compilation with ACPI
---
xen/arch/arm/gic-v3.c | 14 --------------
1 file changed, 14 deletions(-)
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index dfc62e8..b8a4bde 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1134,14 +1134,6 @@ static const hw_irq_controller gicv3_guest_irq_type = {
.set_affinity = gicv3_irq_set_affinity,
};
-static int __init cmp_rdist(const void *a, const void *b)
-{
- const struct rdist_region *l = a, *r = a;
-
- /* We assume that re-distributor regions can never overlap */
- return ( l->base < r->base) ? -1 : 0;
-}
-
static paddr_t __initdata dbase = INVALID_PADDR;
static paddr_t __initdata vbase = INVALID_PADDR, vsize = 0;
static paddr_t __initdata cbase = INVALID_PADDR, csize = 0;
@@ -1210,9 +1202,6 @@ static void __init gicv3_dt_init(void)
rdist_regs[i].size = rdist_size;
}
- /* The vGIC code requires the region to be sorted */
- sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);
-
if ( !dt_property_read_u32(node, "redistributor-stride", &gicv3.rdist_stride) )
gicv3.rdist_stride = 0;
@@ -1455,9 +1444,6 @@ static void __init gicv3_acpi_init(void)
rdist_regs[i].size = gic_rdist->length;
}
- /* The vGIC code requires the region to be sorted */
- sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);
-
gicv3.rdist_regions= rdist_regs;
/* Collect CPU base addresses */
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] xen/arm: gic-v3: No need to sort the Redistributor regions
2016-06-28 15:51 [PATCH v2] xen/arm: gic-v3: No need to sort the Redistributor regions Julien Grall
@ 2016-07-11 17:55 ` Stefano Stabellini
0 siblings, 0 replies; 2+ messages in thread
From: Stefano Stabellini @ 2016-07-11 17:55 UTC (permalink / raw)
To: Julien Grall; +Cc: sstabellini, Shanker Donthineni, xen-devel
On Tue, 28 Jun 2016, Julien Grall wrote:
> The sorting was required by the vGIC emulation until commit
> 9b9d51e98edb8c5c731e2d06dfad3633053d88a4 "xen/arm: vgic-v3:
> Correctly retrieve the vCPU associated to a re-distributor".
>
> Furthermore, the code is buggy because both local variables 'l' and 'r'
> point to the same region.
>
> So drop the code which sort the Redistributors array.
>
> Reported-by: Shanker Donthineni <shankerd@codeaurora.org>
> Signed-off-by: Julien Grall <julien.grall@arm.com>
Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> ---
> Changes in v2:
> - Fix compilation with ACPI
> ---
> xen/arch/arm/gic-v3.c | 14 --------------
> 1 file changed, 14 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index dfc62e8..b8a4bde 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1134,14 +1134,6 @@ static const hw_irq_controller gicv3_guest_irq_type = {
> .set_affinity = gicv3_irq_set_affinity,
> };
>
> -static int __init cmp_rdist(const void *a, const void *b)
> -{
> - const struct rdist_region *l = a, *r = a;
> -
> - /* We assume that re-distributor regions can never overlap */
> - return ( l->base < r->base) ? -1 : 0;
> -}
> -
> static paddr_t __initdata dbase = INVALID_PADDR;
> static paddr_t __initdata vbase = INVALID_PADDR, vsize = 0;
> static paddr_t __initdata cbase = INVALID_PADDR, csize = 0;
> @@ -1210,9 +1202,6 @@ static void __init gicv3_dt_init(void)
> rdist_regs[i].size = rdist_size;
> }
>
> - /* The vGIC code requires the region to be sorted */
> - sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);
> -
> if ( !dt_property_read_u32(node, "redistributor-stride", &gicv3.rdist_stride) )
> gicv3.rdist_stride = 0;
>
> @@ -1455,9 +1444,6 @@ static void __init gicv3_acpi_init(void)
> rdist_regs[i].size = gic_rdist->length;
> }
>
> - /* The vGIC code requires the region to be sorted */
> - sort(rdist_regs, gicv3.rdist_count, sizeof(*rdist_regs), cmp_rdist, NULL);
> -
> gicv3.rdist_regions= rdist_regs;
>
> /* Collect CPU base addresses */
> --
> 1.9.1
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-11 17:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-28 15:51 [PATCH v2] xen/arm: gic-v3: No need to sort the Redistributor regions Julien Grall
2016-07-11 17:55 ` Stefano Stabellini
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).