All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shawn Anastasio <sanastasio@raptorengineering.com>
To: xen-devel@lists.xenproject.org
Cc: tpearson@raptorengineering.com, Jan Beulich <jbeulich@suse.com>,
	Shawn Anastasio <sanastasio@raptorengineering.com>
Subject: [PATCH v3 8/9] xen/ppc: mm-radix: Replace debug printing code with printk
Date: Thu, 14 Mar 2024 17:15:46 -0500	[thread overview]
Message-ID: <c96e022413f73a531d078db5540a90113e138241.1710443965.git.sanastasio@raptorengineering.com> (raw)
In-Reply-To: <cover.1710443965.git.sanastasio@raptorengineering.com>

Now that we have common code building, there's no need to keep the old
itoa64+debug print function in mm-radix.c

Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
Changes in v2:
  - Use CONFIG_DEBUG instead of NDEBUG

 xen/arch/ppc/mm-radix.c | 58 +++++++++--------------------------------
 1 file changed, 12 insertions(+), 46 deletions(-)

diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c
index daa411a6fa..ab5a10695c 100644
--- a/xen/arch/ppc/mm-radix.c
+++ b/xen/arch/ppc/mm-radix.c
@@ -15,6 +15,12 @@

 void enable_mmu(void);

+#ifdef CONFIG_DEBUG
+#define radix_dprintk(msg, ...) printk(XENLOG_DEBUG msg, ## __VA_ARGS__)
+#else
+#define radix_dprintk(...)
+#endif
+
 #define INITIAL_LVL1_PD_COUNT      1
 #define INITIAL_LVL2_LVL3_PD_COUNT 2
 #define INITIAL_LVL4_PT_COUNT      256
@@ -80,45 +86,6 @@ static __init struct lvl4_pt *lvl4_pt_pool_alloc(void)
     return &initial_lvl4_pt_pool[initial_lvl4_pt_pool_used++];
 }

-#ifndef NDEBUG
-/* TODO: Remove once we get common/ building */
-static char *__init itoa64_hex(uint64_t val, char *out_buf, size_t buf_len)
-{
-    uint64_t cur;
-    size_t i = buf_len - 1;
-
-    /* Null terminate buffer */
-    out_buf[i] = '\0';
-
-    /* Add digits in reverse */
-    cur = val;
-    while ( cur && i > 0 )
-    {
-        out_buf[--i] = "0123456789ABCDEF"[cur % 16];
-        cur /= 16;
-    }
-
-    /* Pad to 16 digits */
-    while ( i > 0 )
-        out_buf[--i] = '0';
-
-    return out_buf + i;
-}
-#endif
-
-static void __init radix_dprint(uint64_t addr, const char *msg)
-{
-#ifndef NDEBUG
-    char buf[sizeof("DEADBEEFCAFEBABA")];
-    char *addr_s = itoa64_hex(addr, buf, sizeof(buf));
-
-    early_printk("(0x");
-    early_printk(addr_s);
-    early_printk(") ");
-    early_printk(msg);
-#endif
-}
-
 static void __init setup_initial_mapping(struct lvl1_pd *lvl1,
                                          vaddr_t map_start,
                                          vaddr_t map_end,
@@ -186,27 +153,26 @@ static void __init setup_initial_mapping(struct lvl1_pd *lvl1,
             unsigned long paddr = (page_addr - map_start) + phys_base;
             unsigned long flags;

-            radix_dprint(paddr, "being mapped to ");
-            radix_dprint(page_addr, "!\n");
+            radix_dprintk("%016lx being mapped to %016lx\n", paddr, page_addr);
             if ( is_kernel_text(page_addr) || is_kernel_inittext(page_addr) )
             {
-                radix_dprint(page_addr, "being marked as TEXT (RX)\n");
+                radix_dprintk("%016lx being marked as TEXT (RX)\n", page_addr);
                 flags = PTE_XEN_RX;
             }
             else if ( is_kernel_rodata(page_addr) )
             {
-                radix_dprint(page_addr, "being marked as RODATA (RO)\n");
+                radix_dprintk("%016lx being marked as RODATA (RO)\n", page_addr);
                 flags = PTE_XEN_RO;
             }
             else
             {
-                radix_dprint(page_addr, "being marked as DEFAULT (RW)\n");
+                radix_dprintk("%016lx being marked as DEFAULT (RW)\n", page_addr);
                 flags = PTE_XEN_RW;
             }

             *pte = paddr_to_pte(paddr, flags);
-            radix_dprint(paddr_to_pte(paddr, flags).pte,
-                             "is result of PTE map!\n");
+            radix_dprintk("%016lx is the result of PTE map\n",
+                paddr_to_pte(paddr, flags).pte);
         }
         else
         {
--
2.30.2



  parent reply	other threads:[~2024-03-14 22:16 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14 22:15 [PATCH v3 0/9] Early Boot Allocation on Power Shawn Anastasio
2024-03-14 22:15 ` [PATCH v3 1/9] EFI: Introduce inline stub for efi_enabled on !X86 && !ARM Shawn Anastasio
2024-03-21 17:30   ` Julien Grall
2024-03-22  8:01   ` Jan Beulich
2024-03-22 13:14     ` Julien Grall
2024-03-14 22:15 ` [PATCH v3 2/9] xen/asm-generic: Introduce generic acpi.h Shawn Anastasio
2024-03-25 15:19   ` Jan Beulich
2024-04-04 22:11     ` Shawn Anastasio
2024-03-14 22:15 ` [PATCH v3 3/9] xen/ppc: Introduce stub asm/static-shmem.h Shawn Anastasio
2024-03-25 15:24   ` Jan Beulich
2024-04-09 23:35     ` Shawn Anastasio
2024-04-17 13:03       ` Jan Beulich
2024-03-14 22:15 ` [PATCH v3 4/9] xen/ppc: Update setup.h with required definitions for bootfdt Shawn Anastasio
2024-03-15  8:59   ` Luca Fancellu
2024-03-21 17:37   ` Julien Grall
2024-03-22  8:04   ` Jan Beulich
2024-03-14 22:15 ` [PATCH v3 5/9] xen/device-tree: Move Arm's setup.c bootinfo functions to common Shawn Anastasio
2024-03-15  9:16   ` Jan Beulich
2024-03-20 18:07     ` Shawn Anastasio
2024-03-21  7:42       ` Jan Beulich
2024-03-21 17:39         ` Julien Grall
2024-03-21 17:47   ` Julien Grall
2024-03-22  7:55     ` Jan Beulich
2024-03-22 13:14       ` Julien Grall
2024-04-12  2:43     ` Shawn Anastasio
2024-03-21 17:53   ` Julien Grall
2024-04-12  2:54     ` Shawn Anastasio
2024-03-14 22:15 ` [PATCH v3 6/9] xen/common: Move Arm's bootfdt.c " Shawn Anastasio
2024-03-21 17:50   ` Julien Grall
2024-04-12  2:53     ` Shawn Anastasio
2024-04-17 17:24       ` Julien Grall
2024-03-14 22:15 ` [PATCH v3 7/9] xen/ppc: Enable bootfdt and boot allocator Shawn Anastasio
2024-03-21 18:03   ` Julien Grall
2024-03-14 22:15 ` Shawn Anastasio [this message]
2024-03-25 15:29   ` [PATCH v3 8/9] xen/ppc: mm-radix: Replace debug printing code with printk Jan Beulich
2024-04-12  2:47     ` Shawn Anastasio
2024-03-14 22:15 ` [PATCH v3 9/9] xen/ppc: mm-radix: Allocate all paging structures at runtime Shawn Anastasio
2024-03-20 18:03   ` Shawn Anastasio
2024-03-25 15:39   ` Jan Beulich
2024-04-12  3:19     ` Shawn Anastasio
2024-04-17 13:19       ` Jan Beulich

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=c96e022413f73a531d078db5540a90113e138241.1710443965.git.sanastasio@raptorengineering.com \
    --to=sanastasio@raptorengineering.com \
    --cc=jbeulich@suse.com \
    --cc=tpearson@raptorengineering.com \
    --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 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.