From patchwork Tue Jun 28 15:51:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71098 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1664589qgy; Tue, 28 Jun 2016 08:54:05 -0700 (PDT) X-Received: by 10.36.89.83 with SMTP id p80mr15464021itb.7.1467129245682; Tue, 28 Jun 2016 08:54:05 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id a68si24765397iog.152.2016.06.28.08.54.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 08:54:05 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHvIx-00050r-S0; Tue, 28 Jun 2016 15:52:03 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHvIw-00050j-Ju for xen-devel@lists.xen.org; Tue, 28 Jun 2016 15:52:02 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 0F/AE-26908-12D92775; Tue, 28 Jun 2016 15:52:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRWlGSWpSXmKPExsVysyfVTVdxblG 4wcbtkhZLPi5mcWD0OLr7N1MAYxRrZl5SfkUCa8axLUfYCvbyV3R+3cDewHiFp4uRk0NIYBOj xMd/Hl2MXED2aUaJmdP+MIMk2AQ0Je58/sQEYosISEtc+3yZEcRmFsiX6Lw+HcwWFvCTmNe1l w3EZhFQlVhyqB3M5hVwllh9ewlYr4SAnMTJY5NZJzByLmBkWMWoUZxaVJZapGtkrJdUlJmeUZ KbmJmja2hgqpebWlycmJ6ak5hUrJecn7uJEeivegYGxh2MO9r9DjFKcjApifJ+6y0KF+JLyk+ pzEgszogvKs1JLT7EKMPBoSTB+3Y2UE6wKDU9tSItMwcYODBpCQ4eJRFejTlAad7igsTc4sx0 iNQpRkUpcV4FkIQASCKjNA+uDRaslxhlpYR5GRkYGIR4ClKLcjNLUOVfMYpzMCoJ824H2c6Tm VcCN/0V0GImoMWs1fkgi0sSEVJSDYwyd0/sXvbs+rpQwZ+r7376oSVXejsz3uScRv7n+buu/p tQ8vdTbv6K3B5d/W9zAlolPTdd8XTSOaXIu6Zu0gZBNycem938Uf37NoqFL5wp57v/1plTiz3 6pn8PVlV2r1K0Cixgm5VzV/2BbPeFV8Lsz7cs3Wb4LFM3bXXzg/zpU9/tXXBOfM15JZbijERD Leai4kQA9z7LXVECAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-5.tower-206.messagelabs.com!1467129120!47405212!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 48206 invoked from network); 28 Jun 2016 15:52:01 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-5.tower-206.messagelabs.com with SMTP; 28 Jun 2016 15:52:01 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 52CAE226; Tue, 28 Jun 2016 08:52:52 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.215.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 523283F21A; Tue, 28 Jun 2016 08:51:59 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 28 Jun 2016 16:51:54 +0100 Message-Id: <1467129114-8210-1-git-send-email-julien.grall@arm.com> X-Mailer: git-send-email 1.9.1 Cc: Julien Grall , sstabellini@kernel.org, Shanker Donthineni Subject: [Xen-devel] [PATCH v2] xen/arm: gic-v3: No need to sort the Redistributor regions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" 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 Signed-off-by: Julien Grall --- 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 */