All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler()
@ 2019-06-12  5:42 Baodong Chen
  2019-06-12  9:08 ` Julien Grall
  0 siblings, 1 reply; 13+ messages in thread
From: Baodong Chen @ 2019-06-12  5:42 UTC (permalink / raw)
  To: xen-devel; +Cc: Baodong Chen, Julien Grall, Stefano Stabellini

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

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-06-27 23:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-12  5:42 [Xen-devel] [PATCH] xen/arm: io: add function swap_mmio_handler() Baodong Chen
2019-06-12  9:08 ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.