From patchwork Tue Jun 28 11:31:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 71071 Delivered-To: patch@linaro.org Received: by 10.140.28.4 with SMTP id 4csp1533941qgy; Tue, 28 Jun 2016 04:34:15 -0700 (PDT) X-Received: by 10.159.37.193 with SMTP id 59mr199714uaf.117.1467113655120; Tue, 28 Jun 2016 04:34:15 -0700 (PDT) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id y9si5092688vke.38.2016.06.28.04.34.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jun 2016 04:34:14 -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 1bHrFA-0003uo-Lr; Tue, 28 Jun 2016 11:31:52 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHrF9-0003ui-84 for xen-devel@lists.xen.org; Tue, 28 Jun 2016 11:31:51 +0000 Received: from [193.109.254.147] by server-7.bemta-14.messagelabs.com id 0C/AB-09881-62062775; Tue, 28 Jun 2016 11:31:50 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrHLMWRWlGSWpSXmKPExsVysyfVTVc1oSj coLHf0mLJx8UsDoweR3f/ZgpgjGLNzEvKr0hgzZi3/jhTwWqeii2nFrI2MC7k6mLk4hAS2Mgo 0bVzFzuEc5pR4vWdsyxdjJwcbAKaEnc+f2ICsUUEpCWufb7MCGIzC+RLdF6fDmYLC3hLPNk8k w3EZhFQlZh+/wI7iM0r4Czxct1zZhBbQkBO4uSxyawTGDkXMDKsYlQvTi0qSy3StdRLKspMzy jJTczM0TU0NNHLTS0uTkxPzUlMKtZLzs/dxAj0FwMQ7GDsn+J8iFGSg0lJlHcBQ1G4EF9Sfkp lRmJxRnxRaU5q8SFGGQ4OJQnew3FAOcGi1PTUirTMHGDgwKQlOHiURHgfgqR5iwsSc4sz0yFS pxgVpcR5M0ASAiCJjNI8uDZYsF5ilJUS5mUEOkSIpyC1KDezBFX+FaM4B6OSMO8FkCk8mXklc NNfAS1mAlrMWp0PsrgkESEl1cC49Nu1aq3QNet6IoVFRSwXHJ7qZ7mx8OjKdZMmvGKwW+Y39X frzSN2u12n2D9pdDnrvkq45PL7R7lbZtwSz/9hvyA8/cbcbW9asmvW8OfKFa4PZv2x+cv0w0W 5UtwXHuRl/VAQ2GJpM3NGWOA9r9XdRoGb19W7zeu8k6gQphddEGuxc0NUXWmTEktxRqKhFnNR cSIAYJrE21ECAAA= X-Env-Sender: julien.grall@arm.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1467113509!50547370!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 50095 invoked from network); 28 Jun 2016 11:31:49 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-27.messagelabs.com with SMTP; 28 Jun 2016 11:31:49 -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 A79922F; Tue, 28 Jun 2016 04:32:40 -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 CBD033F21A; Tue, 28 Jun 2016 04:31:47 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Tue, 28 Jun 2016 12:31:41 +0100 Message-Id: <1467113501-7352-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] 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 --- xen/arch/arm/gic-v3.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index dfc62e8..3b02a8c 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;