From: Baodong Chen <chenbaodong@mxnavi.com>
To: <xen-devel@lists.xenproject.org>
Cc: Baodong Chen <chenbaodong@mxnavi.com>,
Julien Grall <julien.grall@arm.com>,
Stefano Stabellini <sstabellini@kernel.org>
Subject: [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler()
Date: Wed, 12 Jun 2019 13:42:34 +0800 [thread overview]
Message-ID: <1560318154-19095-1-git-send-email-chenbaodong@mxnavi.com> (raw)
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 <chenbaodong@mxnavi.com>
---
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;
}
+static void swap_mmio_handler(void *a, void *b, int size)
+{
+ struct mmio_handler *handler0 = a;
+ struct mmio_handler *handler1 = b;
+ struct mmio_handler tmp;
+
+ tmp = *handler0;
+ *handler0 = *handler1;
+ *handler1 = 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,
/* 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);
write_unlock(&vmmio->lock);
}
--
2.7.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2019-06-12 5:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-12 5:42 Baodong Chen [this message]
2019-06-12 9:08 ` [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler() Julien Grall
2019-06-12 10:08 ` chenbaodong
2019-06-12 12:21 ` Julien Grall
2019-06-13 0:31 ` chenbaodong
2019-06-24 18:18 ` Stefano Stabellini
2019-06-24 18:27 ` Stefano Stabellini
2019-06-24 19:27 ` Julien Grall
2019-06-24 20:17 ` Stefano Stabellini
2019-06-24 21:18 ` Julien Grall
2019-06-24 23:59 ` Stefano Stabellini
2019-06-25 8:46 ` Julien Grall
2019-06-27 23:30 ` chenbaodong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1560318154-19095-1-git-send-email-chenbaodong@mxnavi.com \
--to=chenbaodong@mxnavi.com \
--cc=julien.grall@arm.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).