From nobody Thu Apr 25 20:25:02 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1560318286; cv=none; d=zoho.com; s=zohoarc; b=TeZuaba4xFXcHckh3IdbsgM1NtjOZ2iHFivUfDXg2dFUULlBImo9eG7oeK6XQWhUwHePbysLAZ8B4/DsXCVsAsuIibFDOoQZXwLaImosPowfs+uF1bF18S22bNyB2+CVWF7ZYwZARHobfH+IUM/PXOj/jvzcsTCaAeMoLaLchoU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560318286; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=JFZdCDvxt8P9CH64UYifAIlXNC0JYUrEw2f8p4YFTRw=; b=LdKqhHft1Gb6ekxUVnjizeMZhjKJBvhqb5SLRaDkBgi/LzFMyhKnEA7rGh2yRdVuXSuh0ZSe2pqWnci7u4Zd0hXvL2f2u85HvXRxqCYDupiJh5imy57LfwcZDDK2R/6/GMGcVq8xPp0DPx14GYqZHPb1Xa36V6RAk2lqZ+lG9IM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 156031828642237.903270493952505; Tue, 11 Jun 2019 22:44:46 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haw2N-0001Xw-Am; Wed, 12 Jun 2019 05:43:07 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1haw2M-0001Xr-KV for xen-devel@lists.xenproject.org; Wed, 12 Jun 2019 05:43:06 +0000 Received: from mxnavi-mail.mxnavi.com (unknown [116.90.87.199]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id ecab2262-8cd4-11e9-b3c1-aba32656215d; Wed, 12 Jun 2019 05:42:56 +0000 (UTC) Received: from localhost.localdomain (61.161.186.150) by mxnavi-mail.mxnavi.com (116.90.87.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Wed, 12 Jun 2019 13:39:44 +0800 X-Inumbo-ID: ecab2262-8cd4-11e9-b3c1-aba32656215d From: Baodong Chen To: Date: Wed, 12 Jun 2019 13:42:34 +0800 Message-ID: <1560318154-19095-1-git-send-email-chenbaodong@mxnavi.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [61.161.186.150] X-ClientProxiedBy: mxnavi-mail.mxnavi.com (116.90.87.199) To mxnavi-mail.mxnavi.com (116.90.87.199) Subject: [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Baodong Chen , Julien Grall , Stefano Stabellini Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Swap function can be used when calling sort(). or else, the default swap function generic_swap() is used, which is a little inefficient. Signed-off-by: Baodong Chen --- xen/arch/arm/io.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c index ae7ef96..5ce7dc4 100644 --- a/xen/arch/arm/io.c +++ b/xen/arch/arm/io.c @@ -92,6 +92,17 @@ static int cmp_mmio_handler(const void *key, const void = *elem) return 0; } =20 +static void swap_mmio_handler(void *a, void *b, int size) +{ + struct mmio_handler *handler0 =3D a; + struct mmio_handler *handler1 =3D b; + struct mmio_handler tmp; + + tmp =3D *handler0; + *handler0 =3D *handler1; + *handler1 =3D tmp; +} + static const struct mmio_handler *find_mmio_handler(struct domain *d, paddr_t gpa) { @@ -174,7 +185,7 @@ void register_mmio_handler(struct domain *d, =20 /* Sort mmio handlers in ascending order based on base address */ sort(vmmio->handlers, vmmio->num_entries, sizeof(struct mmio_handler), - cmp_mmio_handler, NULL); + cmp_mmio_handler, swap_mmio_handler); =20 write_unlock(&vmmio->lock); } --=20 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel