[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v2 06/10] plat/*: Replace uk_printd() with uk_pr_*() equivalents



Replace all occurrences of uk_printk() with uk_pr_*() equivalents:
 uk_printd(DLVL_CRIT, ...)  --> uk_pr_crit(...)
 uk_printd(DLVL_ERROR, ...) --> uk_pr_err(...)
 uk_printd(DLVL_WARN, ...)  --> uk_pr_warn(...)
 uk_printd(DLVL_INFO, ...)  --> uk_pr_info(...)
 uk_printd(DLVL_EXTRA, ...) --> uk_pr_debug(...)

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/nolibc/getopt.c               |  2 +-
 lib/ukallocbbuddy/bbuddy.c        | 30 ++++++++--------
 lib/ukboot/boot.c                 | 74 +++++++++++++++++++--------------------
 lib/ukbus/bus.c                   |  8 ++---
 lib/ukbus/include/uk/bus.h        |  2 +-
 lib/uklock/include/uk/semaphore.h | 16 ++++-----
 lib/uklock/semaphore.c            |  4 +--
 lib/ukmpi/mbox.c                  |  8 ++---
 lib/uksched/sched.c               |  6 ++--
 lib/uksched/thread.c              |  4 +--
 lib/ukschedcoop/schedcoop.c       | 13 ++++---
 lib/ukswrand/mwc.c                |  2 +-
 lib/vfscore/file.c                | 10 +++---
 plat/common/arm/cpu_native.c      |  4 +--
 plat/common/arm/pl011.c           |  6 ++--
 plat/common/arm/time.c            |  3 +-
 plat/common/arm/traps.c           | 31 ++++++++--------
 plat/common/pci_bus.c             | 40 ++++++++++-----------
 plat/common/sw_ctx.c              |  2 +-
 plat/common/x86/traps.c           | 16 ++++-----
 plat/drivers/virtio/virtio_ring.c |  8 ++---
 plat/kvm/arm/setup.c              | 37 ++++++++++----------
 plat/kvm/irq.c                    |  2 +-
 plat/kvm/x86/setup.c              | 17 +++++----
 plat/kvm/x86/tscclock.c           |  5 ++-
 plat/linuxu/lcpu.c                |  2 +-
 plat/linuxu/setup.c               |  2 +-
 plat/linuxu/shutdown.c            |  2 +-
 plat/xen/arm/arch_events.c        |  2 +-
 plat/xen/arm/arch_time.c          |  8 ++---
 plat/xen/arm/setup.c              | 14 ++++----
 plat/xen/console.c                |  4 +--
 plat/xen/gnttab.c                 | 11 +++---
 plat/xen/x86/arch_time.c          |  2 +-
 plat/xen/x86/gnttab.c             |  4 +--
 plat/xen/x86/mm.c                 | 57 +++++++++++++++---------------
 plat/xen/x86/setup.c              | 12 +++----
 plat/xen/xenbus/client.c          |  2 +-
 plat/xen/xenbus/xenbus.c          | 25 ++++++-------
 plat/xen/xenbus/xs.c              |  3 +-
 plat/xen/xenbus/xs_comms.c        | 37 +++++++++-----------
 41 files changed, 258 insertions(+), 279 deletions(-)

diff --git a/lib/nolibc/getopt.c b/lib/nolibc/getopt.c
index 523ba19..435ddca 100644
--- a/lib/nolibc/getopt.c
+++ b/lib/nolibc/getopt.c
@@ -64,7 +64,7 @@
 
 /* error messages to debug output */
 #define warnx(fmt, ...)                                        \
-       uk_printd(DLVL_WARN, (fmt), __VA_ARGS__)
+       uk_pr_warn((fmt), __VA_ARGS__)
 
 #define GNU_COMPATIBLE         /* Be more compatible, configure's use us! */
 
diff --git a/lib/ukallocbbuddy/bbuddy.c b/lib/ukallocbbuddy/bbuddy.c
index f06bb06..13a7942 100644
--- a/lib/ukallocbbuddy/bbuddy.c
+++ b/lib/ukallocbbuddy/bbuddy.c
@@ -275,8 +275,8 @@ static void *bbuddy_palloc(struct uk_alloc *a, size_t order)
        return ((void *)alloc_ch);
 
 no_memory:
-       uk_printd(DLVL_WARN, "%"__PRIuptr": Cannot handle palloc request of 
order %"__PRIsz": Out of memory\n",
-                 (uintptr_t)a, order);
+       uk_pr_warn("%"__PRIuptr": Cannot handle palloc request of order 
%"__PRIsz": Out of memory\n",
+                  (uintptr_t)a, order);
        errno = ENOMEM;
        return NULL;
 }
@@ -358,10 +358,9 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, 
size_t len)
        min = round_pgup((uintptr_t)base);
        max = round_pgdown((uintptr_t)base + (uintptr_t)len);
        if (max < min) {
-               uk_printd(DLVL_ERR,
-                       "%"__PRIuptr": Failed to add memory region 
%"__PRIuptr"-%"__PRIuptr": Invalid range after applying page alignments\n",
-                       (uintptr_t) a, (uintptr_t) base,
-                       (uintptr_t) base + (uintptr_t) len);
+               uk_pr_err("%"__PRIuptr": Failed to add memory region 
%"__PRIuptr"-%"__PRIuptr": Invalid range after applying page alignments\n",
+                         (uintptr_t) a, (uintptr_t) base,
+                         (uintptr_t) base + (uintptr_t) len);
                return -EINVAL;
        }
 
@@ -372,10 +371,9 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, 
size_t len)
         */
        if (range < round_pgup(sizeof(*memr) + BYTES_PER_MAPWORD) +
                        __PAGE_SIZE) {
-               uk_printd(DLVL_ERR,
-                       "%"__PRIuptr": Failed to add memory region 
%"__PRIuptr"-%"__PRIuptr": Not enough space after applying page alignments\n",
-                       (uintptr_t) a, (uintptr_t) base,
-                       (uintptr_t) base + (uintptr_t) len);
+               uk_pr_err("%"__PRIuptr": Failed to add memory region 
%"__PRIuptr"-%"__PRIuptr": Not enough space after applying page alignments\n",
+                         (uintptr_t) a, (uintptr_t) base,
+                         (uintptr_t) base + (uintptr_t) len);
                return -EINVAL;
        }
 
@@ -425,9 +423,9 @@ static int bbuddy_addmem(struct uk_alloc *a, void *base, 
size_t len)
                        if (min & (1UL << i))
                                break;
 
-               uk_printd(DLVL_EXTRA, "%"__PRIuptr": Add allocate unit 
%"__PRIuptr" - %"__PRIuptr" (order %lu)\n",
-                         (uintptr_t)a, min, (uintptr_t)(min + (1UL << i)),
-                         (i - __PAGE_SHIFT));
+               uk_pr_debug("%"__PRIuptr": Add allocate unit %"__PRIuptr" - 
%"__PRIuptr" (order %lu)\n",
+                           (uintptr_t)a, min, (uintptr_t)(min + (1UL << i)),
+                           (i - __PAGE_SHIFT));
 
                ch = (chunk_head_t *)min;
                min += 1UL << i;
@@ -463,14 +461,14 @@ struct uk_alloc *uk_allocbbuddy_init(void *base, size_t 
len)
 
        /* enough space for allocator available? */
        if (min + metalen > max) {
-               uk_printd(DLVL_ERR, "Not enough space for allocator: %"__PRIsz" 
B required but only %"__PRIuptr" B usable\n",
+               uk_pr_err("Not enough space for allocator: %"__PRIsz" B 
required but only %"__PRIuptr" B usable\n",
                          metalen, (max - min));
                return NULL;
        }
 
        a = (struct uk_alloc *)min;
-       uk_printd(DLVL_INFO, "Initialize binary buddy allocator %"__PRIuptr"\n",
-                 (uintptr_t)a);
+       uk_pr_info("Initialize binary buddy allocator %"__PRIuptr"\n",
+                  (uintptr_t)a);
        min += metalen;
        memset(a, 0, metalen);
        b = (struct uk_bbpalloc *)&a->priv;
diff --git a/lib/ukboot/boot.c b/lib/ukboot/boot.c
index e778bd1..cdb1ea3 100644
--- a/lib/ukboot/boot.c
+++ b/lib/ukboot/boot.c
@@ -80,9 +80,9 @@ static void main_thread_func(void *arg)
        struct thread_main_arg *tma = arg;
 
 #ifdef CONFIG_LIBUKBUS
-       uk_printd(DLVL_INFO, "Initialize bus handlers...\n");
+       uk_pr_info("Initialize bus handlers...\n");
        uk_bus_init_all(uk_alloc_get_default());
-       uk_printd(DLVL_INFO, "Probe buses...\n");
+       uk_pr_info("Probe buses...\n");
        uk_bus_probe_all();
 #endif /* CONFIG_LIBUKBUS */
 
@@ -105,16 +105,16 @@ static void main_thread_func(void *arg)
               STRINGIFY(UK_CODENAME) " " STRINGIFY(UK_FULLVERSION));
 #endif
 
-       uk_printd(DLVL_INFO, "Calling main(%d, [", tma->argc);
+       uk_pr_info("Calling main(%d, [", tma->argc);
        for (i = 0; i < tma->argc; ++i) {
-               uk_printd(DLVL_INFO, "'%s'", tma->argv[i]);
+               uk_pr_info("'%s'", tma->argv[i]);
                if ((i + 1) < tma->argc)
-                       uk_printd(DLVL_INFO, ", ");
+                       uk_pr_info(", ");
        }
-       uk_printd(DLVL_INFO, "])\n");
+       uk_pr_info("])\n");
 
        ret = main(tma->argc, tma->argv);
-       uk_printd(DLVL_INFO, "main returned %d, halting system\n", ret);
+       uk_pr_info("main returned %d, halting system\n", ret);
        ret = (ret != 0) ? UKPLAT_CRASH : UKPLAT_HALT;
        ukplat_terminate(ret); /* does not return */
 }
@@ -154,24 +154,24 @@ void ukplat_entry(int argc, char *argv[])
        struct uk_thread *main_thread = NULL;
 #endif
 
-       uk_printd(DLVL_INFO, "Pre-init table at %p - %p\n",
-                 __preinit_array_start, &__preinit_array_end);
+       uk_pr_info("Pre-init table at %p - %p\n",
+                  __preinit_array_start, &__preinit_array_end);
        ukplat_ctor_foreach(__preinit_array_start, __preinit_array_end, i) {
                if (__preinit_array_start[i]) {
-                       uk_printd(DLVL_EXTRA, "Call pre-init constructor (entry 
%d (%p): %p())...\n",
-                                 i, &__preinit_array_start[i],
-                                 __preinit_array_start[i]);
+                       uk_pr_debug("Call pre-init constructor (entry %d (%p): 
%p())...\n",
+                                   i, &__preinit_array_start[i],
+                                   __preinit_array_start[i]);
                        __preinit_array_start[i]();
                }
        }
 
-       uk_printd(DLVL_INFO, "Constructor table at %p - %p\n",
-                 __init_array_start, &__init_array_end);
+       uk_pr_info("Constructor table at %p - %p\n",
+                  __init_array_start, &__init_array_end);
        ukplat_ctor_foreach(__init_array_start, __init_array_end, i) {
                if (__init_array_start[i]) {
-                       uk_printd(DLVL_EXTRA, "Call constructor (entry %d (%p): 
%p())...\n",
-                                 i, &__init_array_start[i],
-                                 __init_array_start[i]);
+                       uk_pr_debug("Call constructor (entry %d (%p): 
%p())...\n",
+                                   i, &__init_array_start[i],
+                                   __init_array_start[i]);
                        __init_array_start[i]();
                }
        }
@@ -181,7 +181,7 @@ void ukplat_entry(int argc, char *argv[])
         * FIXME: ukallocbbuddy is hard-coded for now
         */
        if (ukplat_memregion_count() > 0) {
-               uk_printd(DLVL_INFO, "Initialize memory allocator...\n");
+               uk_pr_info("Initialize memory allocator...\n");
                for (i = 0; i < ukplat_memregion_count(); ++i) {
                        /* Check if memory region is usable for allocators */
                        if (ukplat_memregion_get(i, &md) < 0)
@@ -190,29 +190,29 @@ void ukplat_entry(int argc, char *argv[])
                        if ((md.flags & UKPLAT_MEMRF_ALLOCATABLE)
                            != UKPLAT_MEMRF_ALLOCATABLE) {
 #if CONFIG_UKPLAT_MEMRNAME
-                               uk_printd(DLVL_EXTRA, "Skip memory region %d: 
%p - %p (flags: 0x%02x, name: %s)\n",
-                                         i, md.base, (void *)((size_t)md.base
-                                                              + md.len),
-                                         md.flags, md.name);
+                               uk_pr_debug("Skip memory region %d: %p - %p 
(flags: 0x%02x, name: %s)\n",
+                                           i, md.base, (void *)((size_t)md.base
+                                                                + md.len),
+                                           md.flags, md.name);
 #else
-                               uk_printd(DLVL_EXTRA, "Skip memory region %d: 
%p - %p (flags: 0x%02x)\n",
-                                         i, md.base, (void *)((size_t)md.base
-                                                              + md.len),
-                                         md.flags);
+                               uk_pr_debug("Skip memory region %d: %p - %p 
(flags: 0x%02x)\n",
+                                           i, md.base, (void *)((size_t)md.base
+                                                                + md.len),
+                                           md.flags);
 #endif
                                continue;
                        }
 
 #if CONFIG_UKPLAT_MEMRNAME
-                       uk_printd(DLVL_EXTRA, "Try  memory region %d: %p - %p 
(flags: 0x%02x, name: %s)...\n",
-                                 i, md.base, (void *)((size_t)md.base
-                                                      + md.len),
-                                 md.flags, md.name);
+                       uk_pr_debug("Try  memory region %d: %p - %p (flags: 
0x%02x, name: %s)...\n",
+                                   i, md.base, (void *)((size_t)md.base
+                                                        + md.len),
+                                   md.flags, md.name);
 #else
-                       uk_printd(DLVL_EXTRA, "Try  memory region %d: %p - %p 
(flags: 0x%02x)...\n",
-                                 i, md.base, (void *)((size_t)md.base
-                                                      + md.len),
-                                 md.flags);
+                       uk_pr_debug("Try  memory region %d: %p - %p (flags: 
0x%02x)...\n",
+                                   i, md.base, (void *)((size_t)md.base
+                                                        + md.len),
+                                   md.flags);
 #endif
                        /* try to use memory region to initialize allocator
                         * if it fails, we will try  again with the next region.
@@ -226,7 +226,7 @@ void ukplat_entry(int argc, char *argv[])
                }
        }
        if (unlikely(!a))
-               uk_printd(DLVL_WARN, "No suitable memory region for memory 
allocator. Continue without heap\n");
+               uk_pr_warn("No suitable memory region for memory allocator. 
Continue without heap\n");
        else {
                rc = ukplat_memallocator_set(a);
                if (unlikely(rc != 0))
@@ -235,14 +235,14 @@ void ukplat_entry(int argc, char *argv[])
 #endif
 
 #if CONFIG_LIBUKALLOC
-       uk_printd(DLVL_INFO, "Initialize IRQ subsystem...\n");
+       uk_pr_info("Initialize IRQ subsystem...\n");
        rc = ukplat_irq_init(a);
        if (unlikely(rc != 0))
                UK_CRASH("Could not initialize the platform IRQ subsystem.");
 #endif
 
        /* On most platforms the timer depend on an initialized IRQ subsystem */
-       uk_printd(DLVL_INFO, "Initialize platform time...\n");
+       uk_pr_info("Initialize platform time...\n");
        ukplat_time_init();
 
 #if CONFIG_LIBUKSCHED
diff --git a/lib/ukbus/bus.c b/lib/ukbus/bus.c
index 4d8f343..b8aaf22 100644
--- a/lib/ukbus/bus.c
+++ b/lib/ukbus/bus.c
@@ -47,7 +47,7 @@ void _uk_bus_register(struct uk_bus *b)
        if (bus_count == 0)
                UK_TAILQ_INIT(&uk_bus_list);
 
-       uk_printd(DLVL_EXTRA, "Register bus handler: %p\n", b);
+       uk_pr_debug("Register bus handler: %p\n", b);
        UK_TAILQ_INSERT_TAIL(&uk_bus_list, b, next);
        ++bus_count;
 }
@@ -57,7 +57,7 @@ void _uk_bus_unregister(struct uk_bus *b)
        UK_ASSERT(b != NULL);
        UK_ASSERT(bus_count > 0);
 
-       uk_printd(DLVL_EXTRA, "Unregister bus handler: %p\n", b);
+       uk_pr_debug("Unregister bus handler: %p\n", b);
        UK_TAILQ_REMOVE(&uk_bus_list, b, next);
        bus_count--;
 }
@@ -71,7 +71,7 @@ int uk_bus_init(struct uk_bus *b, struct uk_alloc *a)
 {
        UK_ASSERT(b != NULL);
 
-       uk_printd(DLVL_EXTRA, "Initialize bus handler %p...\n", b);
+       uk_pr_debug("Initialize bus handler %p...\n", b);
        if (!b->init)
                return 0;
        return b->init(a);
@@ -83,6 +83,6 @@ int uk_bus_probe(struct uk_bus *b)
        UK_ASSERT(b != NULL);
        UK_ASSERT(b->probe != NULL);
 
-       uk_printd(DLVL_EXTRA, "Probe bus %p...\n", b);
+       uk_pr_debug("Probe bus %p...\n", b);
        return b->probe();
 }
diff --git a/lib/ukbus/include/uk/bus.h b/lib/ukbus/include/uk/bus.h
index 57668e4..0da3433 100644
--- a/lib/ukbus/include/uk/bus.h
+++ b/lib/ukbus/include/uk/bus.h
@@ -91,7 +91,7 @@ static inline unsigned int uk_bus_init_all(struct uk_alloc *a)
                if ((status = uk_bus_init(b, a)) >= 0) {
                        ++ret;
                } else {
-                       uk_printd(DLVL_ERR, "Failed to initialize bus driver 
%p: %d\n",
+                       uk_pr_err("Failed to initialize bus driver %p: %d\n",
                                  b, status);
 
                        /* Remove the failed driver from the list */
diff --git a/lib/uklock/include/uk/semaphore.h 
b/lib/uklock/include/uk/semaphore.h
index fd181c8..dea9a72 100644
--- a/lib/uklock/include/uk/semaphore.h
+++ b/lib/uklock/include/uk/semaphore.h
@@ -65,7 +65,7 @@ static inline void uk_semaphore_down(struct uk_semaphore *s)
                ukplat_lcpu_restore_irqf(irqf);
        }
        --s->count;
-       uk_printd(DLVL_EXTRA, "Decreased semaphore %p to %ld\n", s, s->count);
+       uk_pr_debug("Decreased semaphore %p to %ld\n", s, s->count);
        ukplat_lcpu_restore_irqf(irqf);
 }
 
@@ -80,8 +80,8 @@ static inline int uk_semaphore_down_try(struct uk_semaphore 
*s)
        if (s->count > 0) {
                ret = 1;
                --s->count;
-               uk_printd(DLVL_EXTRA, "Decreased semaphore %p to %ld\n",
-                         s, s->count);
+               uk_pr_debug("Decreased semaphore %p to %ld\n",
+                           s, s->count);
        }
        ukplat_lcpu_restore_irqf(irqf);
        return ret;
@@ -112,14 +112,14 @@ static inline __nsec uk_semaphore_down_to(struct 
uk_semaphore *s,
        }
        if (s->count > 0) {
                s->count--;
-               uk_printd(DLVL_EXTRA, "Decreased semaphore %p to %ld\n",
-                         s, s->count);
+               uk_pr_debug("Decreased semaphore %p to %ld\n",
+                           s, s->count);
                ukplat_lcpu_restore_irqf(irqf);
                return ukplat_monotonic_clock() - then;
        }
 
        ukplat_lcpu_restore_irqf(irqf);
-       uk_printd(DLVL_EXTRA, "Timed out while waiting for semaphore %p\n", s);
+       uk_pr_debug("Timed out while waiting for semaphore %p\n", s);
        return __NSEC_MAX;
 }
 
@@ -131,8 +131,8 @@ static inline void uk_semaphore_up(struct uk_semaphore *s)
 
        irqf = ukplat_lcpu_save_irqf();
        ++s->count;
-       uk_printd(DLVL_EXTRA, "Increased semaphore %p to %ld\n",
-                 s, s->count);
+       uk_pr_debug("Increased semaphore %p to %ld\n",
+                   s, s->count);
        uk_waitq_wake_up(&s->wait);
        ukplat_lcpu_restore_irqf(irqf);
 }
diff --git a/lib/uklock/semaphore.c b/lib/uklock/semaphore.c
index 0801bf6..5ed5402 100644
--- a/lib/uklock/semaphore.c
+++ b/lib/uklock/semaphore.c
@@ -5,6 +5,6 @@ void uk_semaphore_init(struct uk_semaphore *s, long count)
        s->count = count;
        uk_waitq_init(&s->wait);
 
-       uk_printd(DLVL_INFO, "Initialized semaphore %p with %ld\n",
-                 s, s->count);
+       uk_pr_info("Initialized semaphore %p with %ld\n",
+                  s, s->count);
 }
diff --git a/lib/ukmpi/mbox.c b/lib/ukmpi/mbox.c
index e15e894..3a0354d 100644
--- a/lib/ukmpi/mbox.c
+++ b/lib/ukmpi/mbox.c
@@ -30,7 +30,7 @@ struct uk_mbox *uk_mbox_create(struct uk_alloc *a, size_t 
size)
        uk_semaphore_init(&m->writesem, (long) size);
        m->writepos = 0;
 
-       uk_printd(DLVL_EXTRA, "Created mailbox %p\n", m);
+       uk_pr_debug("Created mailbox %p\n", m);
        return m;
 }
 
@@ -40,7 +40,7 @@ struct uk_mbox *uk_mbox_create(struct uk_alloc *a, size_t 
size)
  */
 void uk_mbox_free(struct uk_alloc *a, struct uk_mbox *m)
 {
-       uk_printd(DLVL_EXTRA, "Release mailbox %p\n", m);
+       uk_pr_debug("Release mailbox %p\n", m);
 
        UK_ASSERT(a);
        UK_ASSERT(m);
@@ -67,7 +67,7 @@ static inline void _do_mbox_post(struct uk_mbox *m, void *msg)
        m->writepos = (m->writepos + 1) % m->len;
        UK_ASSERT(m->readpos != m->writepos);
        ukplat_lcpu_restore_irqf(irqf);
-       uk_printd(DLVL_EXTRA, "Posted message %p to mailbox %p\n", msg, m);
+       uk_pr_debug("Posted message %p to mailbox %p\n", msg, m);
 
        uk_semaphore_up(&m->readsem);
 }
@@ -115,7 +115,7 @@ static inline void *_do_mbox_recv(struct uk_mbox *m)
        unsigned long irqf;
        void *ret;
 
-       uk_printd(DLVL_EXTRA, "Receive message from mailbox %p\n", m);
+       uk_pr_debug("Receive message from mailbox %p\n", m);
        irqf = ukplat_lcpu_save_irqf();
        UK_ASSERT(m->readpos != m->writepos);
        ret = m->msgs[m->readpos];
diff --git a/lib/uksched/sched.c b/lib/uksched/sched.c
index 07e7aef..12780ec 100644
--- a/lib/uksched/sched.c
+++ b/lib/uksched/sched.c
@@ -121,7 +121,7 @@ static void *create_stack(struct uk_alloc *allocator)
 
        stack = uk_palloc(allocator, STACK_SIZE_PAGE_ORDER);
        if (stack == NULL) {
-               uk_printd(DLVL_WARN, "Error allocating thread stack.");
+               uk_pr_warn("Error allocating thread stack.");
                return NULL;
        }
 
@@ -160,7 +160,7 @@ struct uk_thread *uk_sched_thread_create(struct uk_sched 
*sched,
 
        thread = uk_malloc(sched->allocator, sizeof(struct uk_thread));
        if (thread == NULL) {
-               uk_printd(DLVL_WARN, "Error allocating memory for thread.");
+               uk_pr_warn("Error allocating memory for thread.");
                goto err;
        }
 
@@ -214,7 +214,7 @@ void uk_sched_thread_exit(void)
 
        thread = uk_thread_current();
 
-       uk_printd(DLVL_INFO, "Thread \"%s\" exited.\n", thread->name);
+       uk_pr_info("Thread \"%s\" exited.\n", thread->name);
 
        UK_ASSERT(thread->sched);
        uk_sched_thread_remove(thread->sched, thread);
diff --git a/lib/uksched/thread.c b/lib/uksched/thread.c
index 4b00b1a..1236b99 100644
--- a/lib/uksched/thread.c
+++ b/lib/uksched/thread.c
@@ -89,8 +89,8 @@ int uk_thread_init(struct uk_thread *thread,
        //TODO _REENT_INIT_PTR(&thread->reent);
 #endif
 
-       uk_printd(DLVL_INFO, "Thread \"%s\": pointer: %p, stack: %p\n",
-                       name, thread, thread->stack);
+       uk_pr_info("Thread \"%s\": pointer: %p, stack: %p\n",
+                  name, thread, thread->stack);
 
        return 0;
 }
diff --git a/lib/ukschedcoop/schedcoop.c b/lib/ukschedcoop/schedcoop.c
index dd22209..6f51ece 100644
--- a/lib/ukschedcoop/schedcoop.c
+++ b/lib/ukschedcoop/schedcoop.c
@@ -47,8 +47,8 @@ static void print_runqueue(struct uk_sched *s)
        struct uk_thread *th;
 
        UK_TAILQ_FOREACH(th, &prv->thread_list, thread_list) {
-               uk_printd(DLVL_EXTRA, "   Thread \"%s\", runnable=%d\n",
-                               th->name, is_runnable(th));
+               uk_pr_debug("   Thread \"%s\", runnable=%d\n",
+                           th->name, is_runnable(th));
        }
 }
 #endif
@@ -163,7 +163,7 @@ static void schedcoop_thread_remove(struct uk_sched *s, 
struct uk_thread *t)
        /* Schedule will free the resources */
        while (1) {
                schedcoop_schedule(s);
-               uk_printd(DLVL_WARN, "schedule() returned! Trying again\n");
+               uk_pr_warn("schedule() returned! Trying again\n");
        }
 }
 
@@ -192,11 +192,11 @@ struct uk_sched *uk_schedcoop_init(struct uk_alloc *a)
        struct schedcoop_private *prv = NULL;
        struct uk_sched *sched = NULL;
 
-       uk_printd(DLVL_INFO, "Initializing cooperative scheduler\n");
+       uk_pr_info("Initializing cooperative scheduler\n");
 
        sched = uk_malloc(a, sizeof(struct uk_sched));
        if (sched == NULL) {
-               uk_printd(DLVL_WARN, "Could not allocate memory for 
scheduler.");
+               uk_pr_warn("Could not allocate memory for scheduler.\n");
                goto out_err;
        }
 
@@ -206,8 +206,7 @@ struct uk_sched *uk_schedcoop_init(struct uk_alloc *a)
 
        prv = uk_malloc(a, sizeof(struct schedcoop_private));
        if (prv == NULL) {
-               uk_printd(DLVL_WARN,
-                               "Could not allocate memory for scheduler 
private data.");
+               uk_pr_warn("Could not allocate memory for scheduler private 
data.\n");
                goto out_err;
        }
 
diff --git a/lib/ukswrand/mwc.c b/lib/ukswrand/mwc.c
index e3f4669..127cbe3 100644
--- a/lib/ukswrand/mwc.c
+++ b/lib/ukswrand/mwc.c
@@ -92,6 +92,6 @@ __u32 uk_swrand_randr_r(struct uk_swrand *r)
 
 static void _uk_swrand_ctor(void)
 {
-       uk_printd(DLVL_INFO, "Initialize random number generator...\n");
+       uk_pr_info("Initialize random number generator...\n");
        uk_swrand_init_r(&uk_swrand_def, CONFIG_LIBUKSWRAND_INITIALSEED);
 }
diff --git a/lib/vfscore/file.c b/lib/vfscore/file.c
index 8cad9c4..e7adf1a 100644
--- a/lib/vfscore/file.c
+++ b/lib/vfscore/file.c
@@ -45,7 +45,7 @@ int close(int fd)
        struct vfscore_file *file = vfscore_get_file(fd);
 
        if (!file) {
-               uk_printd(DLVL_WARN, "no such file descriptor: %d\n", fd);
+               uk_pr_warn("no such file descriptor: %d\n", fd);
                errno = EBADF;
                return -1;
        }
@@ -63,13 +63,13 @@ ssize_t write(int fd, const void *buf, size_t count)
        struct vfscore_file *file = vfscore_get_file(fd);
 
        if (!file) {
-               uk_printd(DLVL_WARN, "no such file descriptor: %d\n", fd);
+               uk_pr_warn("no such file descriptor: %d\n", fd);
                errno = EBADF;
                return -1;
        }
 
        if (!file->fops->write) {
-               uk_printd(DLVL_WARN, "file does not have write op: %d\n", fd);
+               uk_pr_warn("file does not have write op: %d\n", fd);
                errno = EINVAL;
                return -1;
        }
@@ -82,13 +82,13 @@ ssize_t read(int fd, void *buf, size_t count)
        struct vfscore_file *file = vfscore_get_file(fd);
 
        if (!file) {
-               uk_printd(DLVL_WARN, "no such file descriptor: %d\n", fd);
+               uk_pr_warn("no such file descriptor: %d\n", fd);
                errno = EBADF;
                return -1;
        }
 
        if (!file->fops->read) {
-               uk_printd(DLVL_WARN, "file does not have read op: %d\n", fd);
+               uk_pr_warn("file does not have read op: %d\n", fd);
                errno = EINVAL;
                return -1;
        }
diff --git a/plat/common/arm/cpu_native.c b/plat/common/arm/cpu_native.c
index f041db6..898c437 100644
--- a/plat/common/arm/cpu_native.c
+++ b/plat/common/arm/cpu_native.c
@@ -53,7 +53,7 @@ void reset(void)
         * halt the CPU.
         */
        if (!smcc_psci_call) {
-               uk_printd(DLVL_CRIT, "Couldn't reset system, HALT!\n");
+               uk_pr_crit("Couldn't reset system, HALT!\n");
                __CPU_HALT();
        }
 
@@ -68,7 +68,7 @@ void system_off(void)
         * halt the CPU.
         */
        if (!smcc_psci_call) {
-               uk_printd(DLVL_CRIT, "Couldn't shutdown system, HALT!\n");
+               uk_pr_crit("Couldn't shutdown system, HALT!\n");
                __CPU_HALT();
        }
 
diff --git a/plat/common/arm/pl011.c b/plat/common/arm/pl011.c
index 8b62184..206c0bf 100644
--- a/plat/common/arm/pl011.c
+++ b/plat/common/arm/pl011.c
@@ -113,7 +113,7 @@ void _libkvmplat_init_console(void)
        const uint64_t *regs;
        uint64_t reg_uart_bas;
 
-       uk_printd(DLVL_INFO, "Serial initializing\n");
+       uk_pr_info("Serial initializing\n");
 
        offset = fdt_node_offset_by_compatible(_libkvmplat_dtb, \
                                        -1, "arm,pl011");
@@ -133,10 +133,10 @@ void _libkvmplat_init_console(void)
                UK_CRASH("Bad 'reg' property: %p %d\n", regs, len);
 
        reg_uart_bas = fdt64_to_cpu(regs[0]);
-       uk_printd(DLVL_INFO, "Found PL011 UART on: 0x%lx\n", reg_uart_bas);
+       uk_pr_info("Found PL011 UART on: 0x%lx\n", reg_uart_bas);
 
        init_pl011(reg_uart_bas);
-       uk_printd(DLVL_INFO, "PL011 UART initialized\n");
+       uk_pr_info("PL011 UART initialized\n");
 }
 
 int ukplat_coutd(const char *str, uint32_t len)
diff --git a/plat/common/arm/time.c b/plat/common/arm/time.c
index 9ef0417..949fa74 100644
--- a/plat/common/arm/time.c
+++ b/plat/common/arm/time.c
@@ -86,8 +86,7 @@ static uint32_t get_counter_frequency(void)
        fdt_freq = fdt_getprop(_libkvmplat_dtb,
                        fdt_archtimer, "clock-frequency", &len);
        if (!fdt_freq || (len <= 0)) {
-               uk_printd(DLVL_INFO,
-               "No clock-frequency found, reading from register directly.\n");
+               uk_pr_info("No clock-frequency found, reading from register 
directly.\n");
                goto endnofreq;
        }
 
diff --git a/plat/common/arm/traps.c b/plat/common/arm/traps.c
index d80be6c..43235be 100644
--- a/plat/common/arm/traps.c
+++ b/plat/common/arm/traps.c
@@ -35,36 +35,35 @@ static void dump_registers(struct __regs *regs, uint64_t 
far)
 {
        unsigned char idx;
 
-       uk_printd(DLVL_CRIT, "Unikraft: Dump registers:\n");
-       uk_printd(DLVL_CRIT, "\t SP       : 0x%016lx\n", regs->sp);
-       uk_printd(DLVL_CRIT, "\t ESR_EL1  : 0x%016lx\n", regs->esr_el1);
-       uk_printd(DLVL_CRIT, "\t ELR_EL1  : 0x%016lx\n", regs->elr_el1);
-       uk_printd(DLVL_CRIT, "\t LR (x30) : 0x%016lx\n", regs->lr);
-       uk_printd(DLVL_CRIT, "\t PSTATE   : 0x%016lx\n", regs->spsr_el1);
-       uk_printd(DLVL_CRIT, "\t FAR_EL1  : 0x%016lx\n", far);
+       uk_pr_crit("Unikraft: Dump registers:\n");
+       uk_pr_crit("\t SP       : 0x%016lx\n", regs->sp);
+       uk_pr_crit("\t ESR_EL1  : 0x%016lx\n", regs->esr_el1);
+       uk_pr_crit("\t ELR_EL1  : 0x%016lx\n", regs->elr_el1);
+       uk_pr_crit("\t LR (x30) : 0x%016lx\n", regs->lr);
+       uk_pr_crit("\t PSTATE   : 0x%016lx\n", regs->spsr_el1);
+       uk_pr_crit("\t FAR_EL1  : 0x%016lx\n", far);
 
        for (idx = 0; idx < 28; idx += 4)
-               uk_printd(DLVL_CRIT,
-                       "\t x%02d ~ x%02d: 0x%016lx 0x%016lx 0x%016lx 
0x%016lx\n",
-                       idx, idx + 3, regs->x[idx], regs->x[idx + 1],
-                       regs->x[idx + 2], regs->x[idx + 3]);
+               uk_pr_crit("\t x%02d ~ x%02d: 0x%016lx 0x%016lx 0x%016lx 
0x%016lx\n",
+                          idx, idx + 3, regs->x[idx], regs->x[idx + 1],
+                          regs->x[idx + 2], regs->x[idx + 3]);
 
-       uk_printd(DLVL_CRIT, "\t x28 ~ x29: 0x%016lx 0x%016lx\n",
-                               regs->x[28], regs->x[29]);
+       uk_pr_crit("\t x28 ~ x29: 0x%016lx 0x%016lx\n",
+                  regs->x[28], regs->x[29]);
 }
 
 void invalid_trap_handler(struct __regs *regs, uint32_t el,
                                uint32_t reason, uint64_t far)
 {
-       uk_printd(DLVL_CRIT, "Unikraft: EL%d invalid %s trap caught\n",
-                               el, exception_modes[reason]);
+       uk_pr_crit("Unikraft: EL%d invalid %s trap caught\n",
+                  el, exception_modes[reason]);
        dump_registers(regs, far);
        ukplat_crash();
 }
 
 void trap_el1_sync(struct __regs *regs, uint64_t far)
 {
-       uk_printd(DLVL_CRIT, "Unikraft: EL1 sync trap caught\n");
+       uk_pr_crit("Unikraft: EL1 sync trap caught\n");
 
        dump_registers(regs, far);
        ukplat_crash();
diff --git a/plat/common/pci_bus.c b/plat/common/pci_bus.c
index dbb8212..c653e81 100644
--- a/plat/common/pci_bus.c
+++ b/plat/common/pci_bus.c
@@ -175,11 +175,10 @@ static inline int pci_driver_add_device(struct pci_driver 
*drv,
 
        dev = (struct pci_device *) uk_calloc(ph.a, 1, sizeof(*dev));
        if (!dev) {
-               uk_printd(DLVL_ERR,
-                               "PCI %02x:%02x.%02x: Failed to initialize: Out 
of memory!\n",
-                               (int) addr->bus,
-                               (int) addr->devid,
-                               (int) addr->function);
+               uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize: Out of 
memory!\n",
+                         (int) addr->bus,
+                         (int) addr->devid,
+                         (int) addr->function);
                return -ENOMEM;
        }
 
@@ -195,11 +194,10 @@ static inline int pci_driver_add_device(struct pci_driver 
*drv,
 
        ret = drv->add_dev(dev);
        if (ret < 0) {
-               uk_printd(DLVL_ERR,
-                         "PCI %02x:%02x.%02x: Failed to initialize device 
driver\n",
-                       (int) addr->bus,
-                       (int) addr->devid,
-                       (int) addr->function);
+               uk_pr_err("PCI %02x:%02x.%02x: Failed to initialize device 
driver\n",
+                         (int) addr->bus,
+                         (int) addr->devid,
+                         (int) addr->function);
                uk_free(ph.a, dev);
        }
        return 0;
@@ -214,7 +212,7 @@ static int pci_probe(void)
        uint32_t bus;
        uint8_t dev;
 
-       uk_printd(DLVL_EXTRA, "Probe PCI\n");
+       uk_pr_debug("Probe PCI\n");
 
        for (bus = 0; bus < PCI_MAX_BUSES; ++bus) {
                for (dev = 0; dev < PCI_MAX_DEVICES; ++dev) {
@@ -247,19 +245,19 @@ static int pci_probe(void)
                        PCI_CONF_READ(uint16_t, &devid.subsystem_device_id,
                                        config_addr, SUBSYS_ID);
 
-                       uk_printd(DLVL_INFO, "PCI %02x:%02x.%02x (%04x 
%04x:%04x): ",
-                               (int) addr.bus,
-                               (int) addr.devid,
-                               (int) addr.function,
-                               (int) devid.class_id,
-                               (int) devid.vendor_id,
-                               (int) devid.device_id);
+                       uk_pr_info("PCI %02x:%02x.%02x (%04x %04x:%04x): ",
+                                  (int) addr.bus,
+                                  (int) addr.devid,
+                                  (int) addr.function,
+                                  (int) devid.class_id,
+                                  (int) devid.vendor_id,
+                                  (int) devid.device_id);
                        drv = pci_find_driver(&devid);
                        if (!drv) {
-                               uk_printd(DLVL_INFO, "<no driver>\n");
+                               uk_pr_info("<no driver>\n");
                                continue;
                        }
-                       uk_printd(DLVL_INFO, "driver %p\n", drv);
+                       uk_pr_info("driver %p\n", drv);
                        pci_driver_add_device(drv, &addr, &devid);
                }
        }
@@ -287,7 +285,7 @@ static int pci_init(struct uk_alloc *a)
                        ret = drv->init(a);
                        if (ret == 0)
                                continue;
-                       uk_printd(DLVL_ERR, "Failed to initialize driver %p: 
%d\n",
+                       uk_pr_err("Failed to initialize driver %p: %d\n",
                                  drv, ret);
                        UK_TAILQ_REMOVE(&ph.drv_list, drv, next);
                }
diff --git a/plat/common/sw_ctx.c b/plat/common/sw_ctx.c
index 5913769..a477753 100644
--- a/plat/common/sw_ctx.c
+++ b/plat/common/sw_ctx.c
@@ -57,7 +57,7 @@ static void *sw_ctx_create(struct uk_alloc *allocator, 
unsigned long sp)
 
        ctx = uk_malloc(allocator, sizeof(struct sw_ctx));
        if (ctx == NULL) {
-               uk_printd(DLVL_WARN, "Error allocating software context.");
+               uk_pr_warn("Error allocating software context.");
                return NULL;
        }
 
diff --git a/plat/common/x86/traps.c b/plat/common/x86/traps.c
index deeb729..c4c520b 100644
--- a/plat/common/x86/traps.c
+++ b/plat/common/x86/traps.c
@@ -61,8 +61,8 @@ DECLARE_TRAP   (simd_error,        "SIMD coprocessor error")
 void do_unhandled_trap(int trapnr, char *str, struct __regs *regs,
                unsigned long error_code)
 {
-       uk_printd(DLVL_CRIT, "Unhandled Trap %d (%s), error code=0x%lx\n",
-                       trapnr, str, error_code);
+       uk_pr_crit("Unhandled Trap %d (%s), error code=0x%lx\n",
+                  trapnr, str, error_code);
        uk_pr_info("Regs address %p\n", regs);
        /* TODO revisit when UK_CRASH will also dump the registers */
        dump_regs(regs);
@@ -79,7 +79,7 @@ static void fault_prologue(void)
         */
        if (handling_fault == 1) {
                UK_CRASH("Page fault in pagetable walk "
-                               "(access to invalid memory?).\n");
+                        "(access to invalid memory?).\n");
        }
        handling_fault++;
        barrier();
@@ -88,8 +88,8 @@ static void fault_prologue(void)
 void do_gp_fault(struct __regs *regs, long error_code)
 {
        fault_prologue();
-       uk_printd(DLVL_CRIT, "GPF rip: %lx, error_code=%lx\n",
-                       regs->rip, error_code);
+       uk_pr_crit("GPF rip: %lx, error_code=%lx\n",
+                  regs->rip, error_code);
        dump_regs(regs);
        stack_walk_for_frame(regs->rbp);
        dump_mem(regs->rsp);
@@ -103,9 +103,9 @@ void do_page_fault(struct __regs *regs, unsigned long 
error_code)
        unsigned long addr = read_cr2();
 
        fault_prologue();
-       uk_printd(DLVL_CRIT, "Page fault at linear address %lx, rip %lx, "
-                       "regs %p, sp %lx, our_sp %p, code %lx\n",
-                       addr, regs->rip, regs, regs->rsp, &addr, error_code);
+       uk_pr_crit("Page fault at linear address %lx, rip %lx, "
+                  "regs %p, sp %lx, our_sp %p, code %lx\n",
+                  addr, regs->rip, regs, regs->rsp, &addr, error_code);
 
        dump_regs(regs);
        stack_walk_for_frame(regs->rbp);
diff --git a/plat/drivers/virtio/virtio_ring.c 
b/plat/drivers/virtio/virtio_ring.c
index 790f0bb..0da4d97 100644
--- a/plat/drivers/virtio/virtio_ring.c
+++ b/plat/drivers/virtio/virtio_ring.c
@@ -55,8 +55,8 @@ int virtq_add_descriptor_chain(struct virtq *vq, __u16 head, 
__u16 num)
                return -EINVAL;
 
        if (vq->num_avail < num) {
-               uk_printd(DLVL_WARN, "virtq full! next_avail:%"__PRIu16" 
last_used:%"__PRIu16"\n",
-                               vq->next_avail, vq->last_used);
+               uk_pr_warn("virtq full! next_avail:%"__PRIu16" 
last_used:%"__PRIu16"\n",
+                          vq->next_avail, vq->last_used);
                return -ENOMEM;
        }
 
@@ -117,8 +117,8 @@ int virtq_rings_init(struct virtq *vq, __u16 pci_base,
        vq_num = inw(pci_base + VIRTIO_PCI_QUEUE_SIZE);
 
        if (vq_num == 0) {
-               uk_printd(DLVL_ERR, "No such queue: pci_base=%"__PRIx16" 
selector=%"__PRIx16"\n",
-                               pci_base, queue_select);
+               uk_pr_err("No such queue: pci_base=%"__PRIx16" 
selector=%"__PRIx16"\n",
+                         pci_base, queue_select);
                return -EINVAL;
        }
 
diff --git a/plat/kvm/arm/setup.c b/plat/kvm/arm/setup.c
index 7423e8b..09530bb 100644
--- a/plat/kvm/arm/setup.c
+++ b/plat/kvm/arm/setup.c
@@ -47,7 +47,7 @@ static void _init_dtb(void *dtb_pointer)
                UK_CRASH("Invalid DTB: %s\n", fdt_strerror(ret));
 
        _libkvmplat_dtb = dtb_pointer;
-       uk_printd(DLVL_INFO, "Found device tree on: %p\n", dtb_pointer);
+       uk_pr_info("Found device tree on: %p\n", dtb_pointer);
 }
 
 static void _dtb_get_psci_method(void)
@@ -65,13 +65,13 @@ static void _dtb_get_psci_method(void)
                fdtpsci = fdt_node_offset_by_compatible(_libkvmplat_dtb,
                                                        -1, "arm,psci-0.2");
        if (fdtpsci < 0) {
-               uk_printd(DLVL_INFO, "No PSCI conduit found in DTB\n");
+               uk_pr_info("No PSCI conduit found in DTB\n");
                goto enomethod;
        }
 
        fdtmethod = fdt_getprop(_libkvmplat_dtb, fdtpsci, "method", &len);
        if (!fdtmethod || (len <= 0)) {
-               uk_printd(DLVL_INFO, "No PSCI method found\n");
+               uk_pr_info("No PSCI method found\n");
                goto enomethod;
        }
 
@@ -80,16 +80,16 @@ static void _dtb_get_psci_method(void)
        else if (!strcmp(fdtmethod, "smc"))
                smcc_psci_call = smcc_psci_smc_call;
        else {
-               uk_printd(DLVL_INFO,
-               "Invalid PSCI conduit method: %s\n", fdtmethod);
+               uk_pr_info("Invalid PSCI conduit method: %s\n",
+                          fdtmethod);
                goto enomethod;
        }
 
-       uk_printd(DLVL_INFO, "PSCI method: %s\n", fdtmethod);
+       uk_pr_info("PSCI method: %s\n", fdtmethod);
        return;
 
 enomethod:
-       uk_printd(DLVL_INFO, "Support PSCI from PSCI-0.2\n");
+       uk_pr_info("Support PSCI from PSCI-0.2\n");
        smcc_psci_call = NULL;
 }
 
@@ -104,13 +104,13 @@ static void _init_dtb_mem(void)
 
        /* search for assigned VM memory in DTB */
        if (fdt_num_mem_rsv(_libkvmplat_dtb) != 0)
-               uk_printd(DLVL_WARN, "Reserved memory is not supported\n");
+               uk_pr_warn("Reserved memory is not supported\n");
 
        fdt_mem = fdt_node_offset_by_prop_value(_libkvmplat_dtb, -1,
                                                "device_type",
                                                "memory", sizeof("memory"));
        if (fdt_mem < 0) {
-               uk_printd(DLVL_WARN, "No memory found in DTB\n");
+               uk_pr_warn("No memory found in DTB\n");
                return;
        }
 
@@ -138,8 +138,7 @@ static void _init_dtb_mem(void)
 
        /* If we have more than one memory bank, give a warning messasge */
        if (prop_len > prop_min_len)
-               uk_printd(DLVL_WARN,
-                       "Currently, we support only one memory bank!\n");
+               uk_pr_warn("Currently, we support only one memory bank!\n");
 
        mem_base = fdt64_to_cpu(regs[0]);
        mem_size = fdt64_to_cpu(regs[1]);
@@ -173,11 +172,11 @@ static void _dtb_get_cmdline(char *cmdline, size_t maxlen)
        cmdline[((unsigned int) len - 1) <= (maxlen - 1) ?
                ((unsigned int) len - 1) : (maxlen - 1)] = '\0';
 
-       uk_printd(DLVL_INFO, "Command line: %s\n", cmdline);
+       uk_pr_info("Command line: %s\n", cmdline);
        return;
 
 enocmdl:
-       uk_printd(DLVL_INFO, "No command line found\n");
+       uk_pr_info("No command line found\n");
        strcpy(cmdline, CONFIG_UK_NAME);
 }
 
@@ -191,7 +190,7 @@ void _libkvmplat_start(void *dtb_pointer)
        _init_dtb(dtb_pointer);
        _libkvmplat_init_console();
 
-       uk_printd(DLVL_INFO, "Entering from KVM (arm64)...\n");
+       uk_pr_info("Entering from KVM (arm64)...\n");
 
        /* Get command line from DTB */
 
@@ -203,15 +202,15 @@ void _libkvmplat_start(void *dtb_pointer)
        /* Initialize memory from DTB */
        _init_dtb_mem();
 
-       uk_printd(DLVL_INFO, "pagetable start: %p\n", _libkvmplat_pagetable);
-       uk_printd(DLVL_INFO, "     heap start: %p\n", _libkvmplat_heap_start);
-       uk_printd(DLVL_INFO, "      stack top: %p\n", _libkvmplat_stack_top);
+       uk_pr_info("pagetable start: %p\n", _libkvmplat_pagetable);
+       uk_pr_info("     heap start: %p\n", _libkvmplat_heap_start);
+       uk_pr_info("      stack top: %p\n", _libkvmplat_stack_top);
 
        /*
         * Switch away from the bootstrap stack as early as possible.
         */
-       uk_printd(DLVL_INFO, "Switch from bootstrap stack to stack @%p\n",
-                               _libkvmplat_stack_top);
+       uk_pr_info("Switch from bootstrap stack to stack @%p\n",
+                  _libkvmplat_stack_top);
 
        _libkvmplat_newstack((uint64_t) _libkvmplat_stack_top,
                                _libkvmplat_entry2, NULL);
diff --git a/plat/kvm/irq.c b/plat/kvm/irq.c
index bad45e2..e708069 100644
--- a/plat/kvm/irq.c
+++ b/plat/kvm/irq.c
@@ -104,7 +104,7 @@ void _ukplat_irq_handle(unsigned long irq)
        }
 
        if (!handled)
-               uk_printd(DLVL_CRIT, "Unhandled irq=%lu\n", irq);
+               uk_pr_crit("Unhandled irq=%lu\n", irq);
        else
                intctrl_ack_irq(irq);
 }
diff --git a/plat/kvm/x86/setup.c b/plat/kvm/x86/setup.c
index d4348a4..e02886d 100644
--- a/plat/kvm/x86/setup.c
+++ b/plat/kvm/x86/setup.c
@@ -63,8 +63,7 @@ static inline void _mb_get_cmdline(struct multiboot_info *mi, 
char *cmdline,
 
                if (cmdline_len >= maxlen) {
                        cmdline_len = maxlen - 1;
-                       uk_printd(DLVL_INFO,
-                                 "Command line too long, truncated\n");
+                       uk_pr_info("Command line too long, truncated\n");
                }
                memcpy(cmdline, mi_cmdline, cmdline_len);
 
@@ -72,7 +71,7 @@ static inline void _mb_get_cmdline(struct multiboot_info *mi, 
char *cmdline,
                cmdline[cmdline_len <= (maxlen - 1) ? cmdline_len
                        : (maxlen - 1)] = '\0';
        } else {
-               uk_printd(DLVL_INFO, "No command line found\n");
+               uk_pr_info("No command line found\n");
                strcpy(cmdline, CONFIG_UK_NAME);
        }
 }
@@ -138,8 +137,8 @@ void _libkvmplat_entry(void *arg)
        traps_init();
        intctrl_init();
 
-       uk_printd(DLVL_INFO, "Entering from KVM (x86)...\n");
-       uk_printd(DLVL_INFO, "     multiboot: %p\n", mi);
+       uk_pr_info("Entering from KVM (x86)...\n");
+       uk_pr_info("     multiboot: %p\n", mi);
 
        /*
         * The multiboot structures may be anywhere in memory, so take a copy of
@@ -148,14 +147,14 @@ void _libkvmplat_entry(void *arg)
        _mb_get_cmdline(mi, cmdline, sizeof(cmdline));
        _mb_init_mem(mi);
 
-       uk_printd(DLVL_INFO, "    heap start: %p\n", _libkvmplat_heap_start);
-       uk_printd(DLVL_INFO, "     stack top: %p\n", _libkvmplat_stack_top);
+       uk_pr_info("    heap start: %p\n", _libkvmplat_heap_start);
+       uk_pr_info("     stack top: %p\n", _libkvmplat_stack_top);
 
        /*
         * Switch away from the bootstrap stack as early as possible.
         */
-       uk_printd(DLVL_INFO, "Switch from bootstrap stack to stack @%p\n",
-                               _libkvmplat_mem_end);
+       uk_pr_info("Switch from bootstrap stack to stack @%p\n",
+                  _libkvmplat_mem_end);
        _libkvmplat_newstack((__u64) _libkvmplat_mem_end,
                                _libkvmplat_entry2, 0);
 }
diff --git a/plat/kvm/x86/tscclock.c b/plat/kvm/x86/tscclock.c
index 8961659..4ef2179 100644
--- a/plat/kvm/x86/tscclock.c
+++ b/plat/kvm/x86/tscclock.c
@@ -232,9 +232,8 @@ int tscclock_init(void)
        tsc_base = rdtsc();
        i8254_delay(100000);
        tsc_freq = (rdtsc() - tsc_base) * 10;
-       uk_printd(DLVL_INFO,
-                 "Clock source: TSC, frequency estimate is %llu Hz\n",
-                 (unsigned long long) tsc_freq);
+       uk_pr_info("Clock source: TSC, frequency estimate is %llu Hz\n",
+                  (unsigned long long) tsc_freq);
 
        /*
         * Calculate TSC scaling multiplier.
diff --git a/plat/linuxu/lcpu.c b/plat/linuxu/lcpu.c
index 316351a..8b70920 100644
--- a/plat/linuxu/lcpu.c
+++ b/plat/linuxu/lcpu.c
@@ -50,7 +50,7 @@ static void do_pselect(struct k_timespec *timeout)
 
        ret = sys_pselect6(nfds, readfds, writefds, exceptfds, timeout, NULL);
        if (ret < 0 && ret != -EINTR)
-               uk_printd(DLVL_WARN, "Failed to halt LCPU: %d\n", ret);
+               uk_pr_warn("Failed to halt LCPU: %d\n", ret);
 }
 
 void halt(void)
diff --git a/plat/linuxu/setup.c b/plat/linuxu/setup.c
index bf797f5..5fbf54b 100644
--- a/plat/linuxu/setup.c
+++ b/plat/linuxu/setup.c
@@ -175,7 +175,7 @@ void _liblinuxuplat_entry(int argc, char *argv[])
        if (_liblinuxuplat_opts.heap.len > 0) {
                pret = sys_mapmem(NULL, _liblinuxuplat_opts.heap.len);
                if (PTRISERR(pret))
-                       uk_printd(DLVL_ERR, "Failed to allocate memory for 
heap: %d\n", PTR2ERR(pret));
+                       uk_pr_err("Failed to allocate memory for heap: %d\n", 
PTR2ERR(pret));
                else
                        _liblinuxuplat_opts.heap.base = pret;
        }
diff --git a/plat/linuxu/shutdown.c b/plat/linuxu/shutdown.c
index c1ee236..8eef53b 100644
--- a/plat/linuxu/shutdown.c
+++ b/plat/linuxu/shutdown.c
@@ -59,7 +59,7 @@ __noreturn void ukplat_terminate(enum ukplat_gstate request)
                break;
        }
 
-       uk_printd(DLVL_CRIT, "sys_exit() failed: %d\n", ret);
+       uk_pr_crit("sys_exit() failed: %d\n", ret);
        for (;;)
                ; /* syscall failed, loop forever */
 }
diff --git a/plat/xen/arm/arch_events.c b/plat/xen/arm/arch_events.c
index ae71301..91f0ecb 100644
--- a/plat/xen/arm/arch_events.c
+++ b/plat/xen/arm/arch_events.c
@@ -35,7 +35,7 @@ static void virq_debug(evtchn_port_t port __unused,
                       struct __regs *regs __unused,
                       void *params __unused)
 {
-       uk_printd(DLVL_EXTRA, "Received a virq_debug event\n");
+       uk_pr_debug("Received a virq_debug event\n");
 }
 
 static evtchn_port_t debug_port = -1;
diff --git a/plat/xen/arm/arch_time.c b/plat/xen/arm/arch_time.c
index 195ef44..c5d4551 100644
--- a/plat/xen/arm/arch_time.c
+++ b/plat/xen/arm/arch_time.c
@@ -107,7 +107,7 @@ void write_timer_ctl(uint32_t value)
 
 void set_vtimer_compare(uint64_t value)
 {
-       uk_printd(DLVL_EXTRA, "New CompareValue : %llx\n", value);
+       uk_pr_debug("New CompareValue : %llx\n", value);
 
        __asm__ __volatile__("mcrr p15, 3, %0, %H0, c14"
                             ::"r"(value));
@@ -142,12 +142,12 @@ void block_domain(__snsec until)
 
 void ukplat_time_init(void)
 {
-       uk_printd(DLVL_INFO, "Initialising timer interface\n");
+       uk_pr_info("Initialising timer interface\n");
 
        __asm__ __volatile__("mrc p15, 0, %0, c14, c0, 0":"=r"(counter_freq));
        cntvct_at_init = read_virtual_count();
-       uk_printd(DLVL_EXTRA, "Virtual Count register is %llx, freq = %d Hz\n",
-                       cntvct_at_init, counter_freq);
+       uk_pr_debug("Virtual Count register is %llx, freq = %d Hz\n",
+                   cntvct_at_init, counter_freq);
 }
 
 void ukplat_time_fini(void)
diff --git a/plat/xen/arm/setup.c b/plat/xen/arm/setup.c
index 5a055f3..4b9efe5 100644
--- a/plat/xen/arm/setup.c
+++ b/plat/xen/arm/setup.c
@@ -99,7 +99,7 @@ static inline void _dtb_get_cmdline(char *cmdline, size_t 
maxlen)
        return;
 
 enocmdl:
-       uk_printd(DLVL_INFO, "No command line found\n");
+       uk_pr_info("No command line found\n");
        strcpy(cmdline, CONFIG_UK_NAME);
 }
 
@@ -122,13 +122,13 @@ static inline void _dtb_init_mem(uint32_t physical_offset)
 
        /* search for assigned VM memory in DTB */
        if (fdt_num_mem_rsv(HYPERVISOR_dtb) != 0)
-               uk_printd(DLVL_WARN, "Reserved memory is not supported\n");
+               uk_pr_warn("Reserved memory is not supported\n");
 
        memory = fdt_node_offset_by_prop_value(HYPERVISOR_dtb, -1,
                                               "device_type",
                                               "memory", sizeof("memory"));
        if (memory < 0) {
-               uk_printd(DLVL_WARN, "No memory found in DTB\n");
+               uk_pr_warn("No memory found in DTB\n");
                return;
        }
 
@@ -151,8 +151,8 @@ static inline void _dtb_init_mem(uint32_t physical_offset)
        start_pfn_p = PFN_UP(to_phys(end));
        heap_len = mem_size - (PFN_PHYS(start_pfn_p) - mem_base);
        max_pfn_p = start_pfn_p + PFN_DOWN(heap_len);
-       uk_printd(DLVL_INFO, "    heap start: %p\n",
-                 to_virt(start_pfn_p << __PAGE_SHIFT));
+       uk_pr_info("    heap start: %p\n",
+                  to_virt(start_pfn_p << __PAGE_SHIFT));
 
        /* The device tree is probably in memory that we're about to hand over
         * to the page allocator, so move it to the end and reserve that space.
@@ -191,11 +191,11 @@ void _libxenplat_armentry(void *dtb_pointer,
 
 void _libxenplat_armentry(void *dtb_pointer, uint32_t physical_offset)
 {
-       uk_printd(DLVL_INFO, "Entering from Xen (arm)...\n");
+       uk_pr_info("Entering from Xen (arm)...\n");
 
        _init_dtb(dtb_pointer);
        _dtb_init_mem(physical_offset); /* relocates dtb */
-       uk_printd(DLVL_INFO, "           dtb: %p\n", HYPERVISOR_dtb);
+       uk_pr_info("           dtb: %p\n", HYPERVISOR_dtb);
 
        /* Set up events. */
        //init_events();
diff --git a/plat/xen/console.c b/plat/xen/console.c
index 2c3ce5a..c0b35c7 100644
--- a/plat/xen/console.c
+++ b/plat/xen/console.c
@@ -210,8 +210,8 @@ void _libxenplat_init_console(void)
 
        UK_ASSERT(console_ring != NULL);
 
-       uk_printd(DLVL_EXTRA, "hvconsole @ %p (evtchn: %"PRIu32")\n",
-                 console_ring, console_evtchn);
+       uk_pr_debug("hvconsole @ %p (evtchn: %"PRIu32")\n",
+                   console_ring, console_evtchn);
 
        err = bind_evtchn(console_evtchn, hvconsole_input, NULL);
        if (err <= 0)
diff --git a/plat/xen/gnttab.c b/plat/xen/gnttab.c
index 72fc075..ddfff99 100644
--- a/plat/xen/gnttab.c
+++ b/plat/xen/gnttab.c
@@ -125,8 +125,8 @@ int gnttab_end_access(grant_ref_t gref)
        nflags = *pflags;
        do {
                if ((flags = nflags) & (GTF_reading | GTF_writing)) {
-                       uk_printd(DLVL_WARN,
-                               "gref=%u still in use! (0x%x)\n", gref, flags);
+                       uk_pr_warn("gref=%u still in use! (0x%x)\n",
+                                  gref, flags);
                        return 0;
                }
        } while ((nflags = ukarch_compare_exchange_sync(pflags, flags, 0)) != 
flags);
@@ -148,8 +148,7 @@ unsigned long gnttab_end_transfer(grant_ref_t gref)
        pflags = &gnttab.table[gref].flags;
        while (!((flags = *pflags) & GTF_transfer_committed)) {
                if (ukarch_compare_exchange_sync(pflags, flags, 0) == flags) {
-                       uk_printd(DLVL_INFO,
-                               "Release unused transfer grant.\n");
+                       uk_pr_info("Release unused transfer grant.\n");
                        put_free_entry(gref);
                        return 0;
                }
@@ -218,7 +217,7 @@ void gnttab_init(void)
        if (gnttab.table == NULL)
                UK_CRASH("Failed to initialize grant table\n");
 
-       uk_printd(DLVL_INFO, "Grant table mapped at %p.\n", gnttab.table);
+       uk_pr_info("Grant table mapped at %p.\n", gnttab.table);
 
        gnttab.initialized = 1;
 }
@@ -233,7 +232,7 @@ void gnttab_fini(void)
 
        rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
        if (rc) {
-               uk_printd(DLVL_ERR, "Hypercall error: %d\n", rc);
+               uk_pr_err("Hypercall error: %d\n", rc);
                return;
        }
 
diff --git a/plat/xen/x86/arch_time.c b/plat/xen/x86/arch_time.c
index f96426f..95d7b10 100644
--- a/plat/xen/x86/arch_time.c
+++ b/plat/xen/x86/arch_time.c
@@ -243,7 +243,7 @@ static void timer_handler(evtchn_port_t ev __unused,
 static evtchn_port_t port;
 void ukplat_time_init(void)
 {
-       uk_printd(DLVL_EXTRA, "Initializing timer interface\n");
+       uk_pr_debug("Initializing timer interface\n");
        port = bind_virq(VIRQ_TIMER, &timer_handler, NULL);
        unmask_evtchn(port);
 }
diff --git a/plat/xen/x86/gnttab.c b/plat/xen/x86/gnttab.c
index add3444..b09d52b 100644
--- a/plat/xen/x86/gnttab.c
+++ b/plat/xen/x86/gnttab.c
@@ -44,11 +44,11 @@ grant_entry_v1_t *gnttab_arch_init(int grant_frames_num)
 
        rc = HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup, 1);
        if (rc) {
-               uk_printd(DLVL_ERR, "Hypercall error: %d\n", rc);
+               uk_pr_err("Hypercall error: %d\n", rc);
                goto out;
        }
        if (setup.status != GNTST_okay) {
-               uk_printd(DLVL_ERR, "Hypercall status: %d\n", setup.status);
+               uk_pr_err("Hypercall status: %d\n", setup.status);
                goto out;
        }
 
diff --git a/plat/xen/x86/mm.c b/plat/xen/x86/mm.c
index 3a95ad0..b7b080e 100644
--- a/plat/xen/x86/mm.c
+++ b/plat/xen/x86/mm.c
@@ -74,9 +74,9 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long 
prev_l_mfn,
     int rc;
 #endif
 
-    uk_printd(DLVL_EXTRA, "Allocating new L%lu pt frame for pfn=%lx, "
-             "prev_l_mfn=%lx, offset=%lx\n",
-             level, *pt_pfn, prev_l_mfn, offset);
+    uk_pr_debug("Allocating new L%lu pt frame for pfn=%lx, "
+               "prev_l_mfn=%lx, offset=%lx\n",
+               level, *pt_pfn, prev_l_mfn, offset);
 
     /* We need to clear the page, otherwise we might fail to map it
        as a page table page */
@@ -139,14 +139,14 @@ void _init_mem_build_pagetable(unsigned long *start_pfn, 
unsigned long *max_pfn)
 #ifdef CONFIG_PARAVIRT
     if ( *max_pfn >= virt_to_pfn(HYPERVISOR_VIRT_START) )
     {
-           uk_printd(DLVL_WARN, "Trying to use Xen virtual space. "
-                     "Truncating memory from %luMB to ",
-                     ((unsigned long)pfn_to_virt(*max_pfn) -
-                      (unsigned long)&_text)>>20);
+           uk_pr_warn("Trying to use Xen virtual space. "
+                      "Truncating memory from %luMB to ",
+                      ((unsigned long)pfn_to_virt(*max_pfn) -
+                       (unsigned long)&_text)>>20);
            *max_pfn = virt_to_pfn(HYPERVISOR_VIRT_START - PAGE_SIZE);
-           uk_printd(DLVL_WARN, "%luMB\n",
-                     ((unsigned long)pfn_to_virt(*max_pfn) - 
-                      (unsigned long)&_text)>>20);
+           uk_pr_warn("%luMB\n",
+                      ((unsigned long)pfn_to_virt(*max_pfn) -
+                       (unsigned long)&_text)>>20);
     }
 #else
     /* Round up to next 2MB boundary as we are using 2MB pages on HVMlite. */
@@ -158,8 +158,8 @@ void _init_mem_build_pagetable(unsigned long *start_pfn, 
unsigned long *max_pfn)
     end_address = (unsigned long)pfn_to_virt(*max_pfn);
 
     /* We worked out the virtual memory range to map, now mapping loop */
-    uk_printd(DLVL_INFO, "Mapping memory range 0x%lx - 0x%lx\n",
-             start_address, end_address);
+    uk_pr_info("Mapping memory range 0x%lx - 0x%lx\n",
+              start_address, end_address);
 
     while ( start_address < end_address )
     {
@@ -350,13 +350,12 @@ int do_map_frames(unsigned long va,
        unsigned long mapped = 0;
 
        if (!mfns) {
-               uk_printd(DLVL_WARN, "do_map_frames: no mfns supplied\n");
+               uk_pr_warn("do_map_frames: no mfns supplied\n");
                return -EINVAL;
        }
 
-       uk_printd(DLVL_EXTRA,
-               "Mapping va=%p n=%lu, mfns[0]=0x%lx stride=%lu incr=%lu 
prot=0x%lx\n",
-               (void *) va, n, mfns[0], stride, incr, prot);
+       uk_pr_debug("Mapping va=%p n=%lu, mfns[0]=0x%lx stride=%lu incr=%lu 
prot=0x%lx\n",
+                   (void *) va, n, mfns[0], stride, incr, prot);
 
        if (err)
                memset(err, 0, n * sizeof(int));
@@ -452,7 +451,7 @@ unsigned long allocate_ondemand(unsigned long n, unsigned 
long align)
        }
 
        if (contig != n) {
-               uk_printd(DLVL_ERR, "Failed to find %ld frames!\n", n);
+               uk_pr_err("Failed to find %ld frames!\n", n);
                return 0;
        }
 
@@ -513,8 +512,8 @@ int unmap_frames(unsigned long va, unsigned long num_frames)
 
        UK_ASSERT(!((unsigned long) va & ~PAGE_MASK));
 
-       uk_printd(DLVL_EXTRA,
-               "Unmapping va=%p, num=%lu\n", (void *) va, num_frames);
+       uk_pr_debug("Unmapping va=%p, num=%lu\n",
+                   (void *) va, num_frames);
 
        while (num_frames) {
 #ifdef CONFIG_PARAVIRT
@@ -540,15 +539,15 @@ int unmap_frames(unsigned long va, unsigned long 
num_frames)
 
                ret = HYPERVISOR_multicall(call, n);
                if (ret) {
-                       uk_printd(DLVL_ERR,
-                               "update_va_mapping hypercall failed with 
rc=%d.\n", ret);
+                       uk_pr_err("update_va_mapping hypercall failed with 
rc=%d.\n",
+                                 ret);
                        return -ret;
                }
 
                for (i = 0; i < n; i++) {
                        if (call[i].result) {
-                               uk_printd(DLVL_ERR,
-                                       "update_va_mapping failed for with 
rc=%d.\n", ret);
+                               uk_pr_err("update_va_mapping failed for with 
rc=%d.\n",
+                                         ret);
                                return -(call[i].result);
                        }
                }
@@ -586,7 +585,7 @@ void _init_mem_set_readonly(void *text, void *etext)
     int rc;
 #endif
 
-    uk_printd(DLVL_EXTRA, "Set %p-%p readonly\n", text, etext);
+    uk_pr_debug("Set %p-%p readonly\n", text, etext);
     mfn = pfn_to_mfn(virt_to_pfn(pt_base));
 
     while ( start_address + page_size <= end_address )
@@ -625,7 +624,7 @@ void _init_mem_set_readonly(void *text, void *etext)
             tab[offset] &= ~_PAGE_RW;
 #endif
         } else {
-            uk_printd(DLVL_EXTRA, "skipped %lx\n", start_address);
+            uk_pr_debug("skipped %lx\n", start_address);
        }
 
         start_address += page_size;
@@ -670,14 +669,14 @@ void _init_mem_clear_bootstrap(void)
     pgentry_t *pgt;
 #endif
 
-    uk_printd(DLVL_EXTRA, "Clear bootstrapping memory: %p\n", &_text);
+    uk_pr_debug("Clear bootstrapping memory: %p\n", &_text);
 
     /* Use first page as the CoW zero page */
     memset(&_text, 0, PAGE_SIZE);
     mfn_zero = virt_to_mfn((unsigned long) &_text);
 #ifdef CONFIG_PARAVIRT
     if ( (rc = HYPERVISOR_update_va_mapping(0, nullpte, UVMF_INVLPG)) )
-           uk_printd(DLVL_ERR, "Unable to unmap NULL page. rc=%d\n", rc);
+           uk_pr_err("Unable to unmap NULL page. rc=%d\n", rc);
 #else
     pgt = get_pgt((unsigned long)&_text);
     *pgt = 0;
@@ -706,6 +705,6 @@ void _init_mem_demand_area(unsigned long start, unsigned 
long page_num)
        demand_map_area_start = start;
        demand_map_area_end = demand_map_area_start + page_num * PAGE_SIZE;
 
-       uk_printd(DLVL_INFO, "Demand map pfns at %lx-%lx.\n",
-               demand_map_area_start, demand_map_area_end);
+       uk_pr_info("Demand map pfns at %lx-%lx.\n",
+                  demand_map_area_start, demand_map_area_end);
 }
diff --git a/plat/xen/x86/setup.c b/plat/xen/x86/setup.c
index 31d3a90..35fdd35 100644
--- a/plat/xen/x86/setup.c
+++ b/plat/xen/x86/setup.c
@@ -149,8 +149,8 @@ static inline void _init_mem(void)
        if (max_pfn >= MAX_MEM_SIZE / __PAGE_SIZE)
                max_pfn = MAX_MEM_SIZE / __PAGE_SIZE - 1;
 
-       uk_printd(DLVL_INFO, "     start_pfn: %lx\n", start_pfn);
-       uk_printd(DLVL_INFO, "       max_pfn: %lx\n", max_pfn);
+       uk_pr_info("     start_pfn: %lx\n", start_pfn);
+       uk_pr_info("       max_pfn: %lx\n", max_pfn);
 
        _init_mem_build_pagetable(&start_pfn, &max_pfn);
        _init_mem_clear_bootstrap();
@@ -188,7 +188,7 @@ void _libxenplat_x86entry(void *start_info)
        HYPERVISOR_start_info = (start_info_t *)start_info;
        _libxenplat_prepare_console(); /* enables buffering for console */
 
-       uk_printd(DLVL_INFO, "Entering from Xen (x86, PV)...\n");
+       uk_pr_info("Entering from Xen (x86, PV)...\n");
 
        _init_shared_info(); /* remaps shared info */
 
@@ -198,9 +198,9 @@ void _libxenplat_x86entry(void *start_info)
        /* Set up events. */
        init_events();
 
-       uk_printd(DLVL_INFO, "    start_info: %p\n", HYPERVISOR_start_info);
-       uk_printd(DLVL_INFO, "   shared_info: %p\n", HYPERVISOR_shared_info);
-       uk_printd(DLVL_INFO, "hypercall_page: %p\n", hypercall_page);
+       uk_pr_info("    start_info: %p\n", HYPERVISOR_start_info);
+       uk_pr_info("   shared_info: %p\n", HYPERVISOR_shared_info);
+       uk_pr_info("hypercall_page: %p\n", hypercall_page);
 
        _init_mem();
 
diff --git a/plat/xen/xenbus/client.c b/plat/xen/xenbus/client.c
index 86725e3..bd06063 100644
--- a/plat/xen/xenbus/client.c
+++ b/plat/xen/xenbus/client.c
@@ -191,7 +191,7 @@ exit:
        } while (err == -EAGAIN);
 
        if (err)
-               uk_printd(DLVL_ERR, "Error switching state to %s: %d\n",
+               uk_pr_err("Error switching state to %s: %d\n",
                        xenbus_state_to_str(state), err);
 
        return err;
diff --git a/plat/xen/xenbus/xenbus.c b/plat/xen/xenbus/xenbus.c
index 28f0cfd..f693f80 100644
--- a/plat/xen/xenbus/xenbus.c
+++ b/plat/xen/xenbus/xenbus.c
@@ -106,11 +106,11 @@ static int xenbus_probe_device(struct xenbus_driver *drv,
        if (state != XenbusStateInitialising)
                return 0;
 
-       uk_printd(DLVL_INFO, "Xenbus device: %s\n", nodename);
+       uk_pr_info("Xenbus device: %s\n", nodename);
 
        dev = uk_xb_calloc(1, sizeof(*dev) + strlen(nodename) + 1);
        if (!dev) {
-               uk_printd(DLVL_ERR, "Failed to initialize: Out of memory!\n");
+               uk_pr_err("Failed to initialize: Out of memory!\n");
                err = -ENOMEM;
                goto out;
        }
@@ -122,7 +122,7 @@ static int xenbus_probe_device(struct xenbus_driver *drv,
 
        err = drv->add_dev(dev);
        if (err) {
-               uk_printd(DLVL_ERR, "Failed to add device.\n");
+               uk_pr_err("Failed to add device.\n");
                uk_xb_free(dev);
        }
 
@@ -143,15 +143,13 @@ static int xenbus_probe_device_type(const char 
*devtype_str)
 
        devtype = xenbus_str_to_devtype(devtype_str);
        if (!devtype) {
-               uk_printd(DLVL_WARN,
-                       "Unsupported device type: %s\n", devtype_str);
+               uk_pr_warn("Unsupported device type: %s\n", devtype_str);
                goto out;
        }
 
        drv = xenbus_find_driver(devtype);
        if (!drv) {
-               uk_printd(DLVL_WARN,
-                       "No driver for device type: %s\n", devtype_str);
+               uk_pr_warn("No driver for device type: %s\n", devtype_str);
                goto out;
        }
 
@@ -161,8 +159,7 @@ static int xenbus_probe_device_type(const char *devtype_str)
        devices = xs_ls(XBT_NIL, dirname);
        if (PTRISERR(devices)) {
                err = PTR2ERR(devices);
-               uk_printd(DLVL_ERR,
-                       "Error reading %s devices: %d\n", devtype_str, err);
+               uk_pr_err("Error reading %s devices: %d\n", devtype_str, err);
                goto out;
        }
 
@@ -184,13 +181,13 @@ static int xenbus_probe(void)
        char **devtypes;
        int err = 0;
 
-       uk_printd(DLVL_INFO, "Probe Xenbus\n");
+       uk_pr_info("Probe Xenbus\n");
 
        /* Get device types list */
        devtypes = xs_ls(XBT_NIL, XS_DEV_PATH);
        if (PTRISERR(devtypes)) {
                err = PTR2ERR(devtypes);
-               uk_printd(DLVL_ERR, "Error reading device types: %d\n", err);
+               uk_pr_err("Error reading device types: %d\n", err);
                goto out;
        }
 
@@ -218,8 +215,7 @@ static int xenbus_init(struct uk_alloc *a)
 
        ret = xs_comms_init();
        if (ret) {
-               uk_printd(DLVL_ERR,
-                       "Error initializing Xenstore communication.");
+               uk_pr_err("Error initializing Xenstore communication.");
                return ret;
        }
 
@@ -228,8 +224,7 @@ static int xenbus_init(struct uk_alloc *a)
                        ret = drv->init(a);
                        if (ret == 0)
                                continue;
-                       uk_printd(DLVL_ERR,
-                               "Failed to initialize driver %p: %d\n",
+                       uk_pr_err("Failed to initialize driver %p: %d\n",
                                drv, ret);
                        UK_TAILQ_REMOVE(&xbh.drv_list, drv, next);
                }
diff --git a/plat/xen/xenbus/xs.c b/plat/xen/xenbus/xs.c
index 5f50de2..f81e9a6 100644
--- a/plat/xen/xenbus/xs.c
+++ b/plat/xen/xenbus/xs.c
@@ -639,8 +639,7 @@ int xs_debug_msg(const char *msg)
        if (err)
                goto out;
 
-       uk_printd(DLVL_EXTRA,
-               "Got a debug reply %s\n", (char *) rep.data);
+       uk_pr_debug("Got a debug reply %s\n", (char *) rep.data);
        free(rep.data);
 
 out:
diff --git a/plat/xen/xenbus/xs_comms.c b/plat/xen/xenbus/xs_comms.c
index 3fd6a07..c8201a5 100644
--- a/plat/xen/xenbus/xs_comms.c
+++ b/plat/xen/xenbus/xs_comms.c
@@ -318,7 +318,7 @@ static int xs_msg_write(struct xsd_sockmsg *xsd_req,
                }
        }
 
-       uk_printd(DLVL_EXTRA, "Complete main loop of %s.\n", __func__);
+       uk_pr_debug("Complete main loop of %s.\n", __func__);
        UK_ASSERT(buf_off == 0);
        UK_ASSERT(req_off == req_size);
        UK_ASSERT(prod <= xsh.buf->req_cons + XENSTORE_RING_SIZE);
@@ -388,8 +388,8 @@ void xs_send(void)
                err = xs_msg_write(&xs_req->hdr, xs_req->payload_iovecs);
                if (err) {
                        if (err != -ENOSPC)
-                               uk_printd(DLVL_WARN,
-                                       "Error sending message err=%d\n", err);
+                               uk_pr_warn("Error sending message err=%d\n",
+                                          err);
                        break;
                }
 
@@ -415,7 +415,7 @@ static int reply_to_errno(const char *reply)
                }
        }
 
-       uk_printd(DLVL_WARN, "Unknown Xenstore error: %s\n", reply);
+       uk_pr_warn("Unknown Xenstore error: %s\n", reply);
        err = EINVAL;
 
 out:
@@ -428,7 +428,7 @@ static void process_reply(struct xsd_sockmsg *hdr, char 
*payload)
        struct xs_request *xs_req;
 
        if (!ukarch_test_bit(hdr->req_id, xs_req_pool.entries_bm)) {
-               uk_printd(DLVL_WARN, "Invalid reply id=%d\n", hdr->req_id);
+               uk_pr_warn("Invalid reply id=%d\n", hdr->req_id);
                free(payload);
                return;
        }
@@ -440,8 +440,7 @@ static void process_reply(struct xsd_sockmsg *hdr, char 
*payload)
                free(payload);
 
        } else if (hdr->type != xs_req->hdr.type) {
-               uk_printd(DLVL_WARN,
-                       "Mismatching message type: %d\n", hdr->type);
+               uk_pr_warn("Mismatching message type: %d\n", hdr->type);
                free(payload);
                return;
 
@@ -473,7 +472,7 @@ static void process_watch_event(char *watch_msg)
        if (watch)
                xenbus_watch_notify_event(&watch->base);
        else
-               uk_printd(DLVL_ERR, "Invalid watch event.");
+               uk_pr_err("Invalid watch event.");
 }
 
 static void memcpy_from_ring(const char *ring, char *dest, int off, int len)
@@ -495,8 +494,7 @@ static void xs_msg_read(struct xsd_sockmsg *hdr)
 
        payload = malloc(hdr->len + 1);
        if (payload == NULL) {
-               uk_printd(DLVL_WARN,
-                       "No memory available for saving Xenstore message!\n");
+               uk_pr_warn("No memory available for saving Xenstore 
message!\n");
                return;
        }
 
@@ -529,8 +527,8 @@ static void xs_recv(void)
        struct xsd_sockmsg msg;
 
        while (1) {
-               uk_printd(DLVL_EXTRA, "Rsp_cons %d, rsp_prod %d.\n",
-                       xsh.buf->rsp_cons, xsh.buf->rsp_prod);
+               uk_pr_debug("Rsp_cons %d, rsp_prod %d.\n",
+                           xsh.buf->rsp_cons, xsh.buf->rsp_prod);
 
                if (!xs_avail_space_for_read(sizeof(msg)))
                        break;
@@ -546,10 +544,10 @@ static void xs_recv(void)
                        sizeof(msg)
                );
 
-               uk_printd(DLVL_EXTRA, "Msg len %lu, %u avail, id %u.\n",
-                       msg.len + sizeof(msg),
-                       xsh.buf->rsp_prod - xsh.buf->rsp_cons,
-                       msg.req_id);
+               uk_pr_debug("Msg len %lu, %u avail, id %u.\n",
+                           msg.len + sizeof(msg),
+                           xsh.buf->rsp_prod - xsh.buf->rsp_cons,
+                           msg.req_id);
 
                if (!xs_avail_space_for_read(sizeof(msg) + msg.len))
                        break;
@@ -557,7 +555,7 @@ static void xs_recv(void)
                /* Make sure data is read after reading the indexes */
                rmb();
 
-               uk_printd(DLVL_EXTRA, "Message is good.\n");
+               uk_pr_debug("Message is good.\n");
                xs_msg_read(&msg);
        }
 }
@@ -604,9 +602,8 @@ int xs_comms_init(void)
        UK_ASSERT(port == xsh.evtchn);
        unmask_evtchn(xsh.evtchn);
 
-       uk_printd(DLVL_INFO,
-               "Xenstore connection initialised on port %d, buf %p (mfn 
%#lx)\n",
-               port, xsh.buf, HYPERVISOR_start_info->store_mfn);
+       uk_pr_info("Xenstore connection initialised on port %d, buf %p (mfn 
%#lx)\n",
+                  port, xsh.buf, HYPERVISOR_start_info->store_mfn);
 
        return 0;
 }
-- 
2.7.4


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.