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: 9202997 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E81D6075F for ; Tue, 28 Jun 2016 11:34:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F5D1283E4 for ; Tue, 28 Jun 2016 11:34:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 53BBF285C7; Tue, 28 Jun 2016 11:34:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D45DD283E4 for ; Tue, 28 Jun 2016 11:34:10 +0000 (UTC) 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" X-Virus-Scanned: ClamAV using ClamSMTP 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;