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

[PATCH v2] xen/arm64: Move print_reg macro to asm/arm64/macros.h


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 29 Nov 2023 10:06:45 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gGUKd9Al4IUUb1ICrxBp73pRFL1/0iuKpdeLmfFpWNw=; b=CNbkHFi9oTJMBIbEWOVq1biKBUkuN7u9jX1nAib/67Ho0AIhL3FvwcebpILa6c45ZNt6VJ2xg460Nv8LzyhCEA+WrpW/iibt/AocvqquRJmn4vG1LJ5ydkWJ4adhRDlVQnScmUbyu10WSGpufsMBDRM++vYUd23cnyUARfqkAnuBohlo9fY0uuA+sBD4pcg1VLvF5gaKklMqTnOwIrOwwz4Bsrglc1AvEWs8Jq4SfF7J9v4iStRbPaUgJGpO2ynfAs5dANx7Yf5aonvpmNXAH+hLvxYJiXcQ4e+x6/uzSZx3T+yclQA+IB5BcyvkfI29/x1WnhA91e4xUBnslDFLGQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ARPk8CvJ45kBQANhdUcHImMW/IxIBeZ8vAkmj7b5k/T3QIIo1+GEzCTJbVEimINIx4iglx6D0SPdfWNqgulNJWXDP85VANWmg3ALBTcnVnGLf2cjTkezjeWzw4E3ILOPxjdXp4c6trUt3CMW76J6YemSPnt1+d+P16bX2ohhfbHkvxBPPK64vI7cFpu20296ZySX8DAmdOK2NkeAwV1SX/LBmdFJ9VnGumdf0J2gr+99ORzVNYr/TNwUA/6OosA4ZLdUGzNyEj3IgdSytVKeYN+B348OP9GH3yjnDsHxtzIAhECtMwybAzOOm48F0Co35rMPxGVlMZ+aLdkIvHxrPg==
  • Cc: Michal Orzel <michal.orzel@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Luca Fancellu <luca.fancellu@xxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>
  • Delivery-date: Wed, 29 Nov 2023 09:07:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Macro print_reg is used to print a value of a register passed as an
argument. While today it is only used from within the common head.S,
in the future we might want to make use of it from other files, just
like PRINT(). It also serves as a great aid when debugging.

Expose print_reg macro by moving it to asm/arm64/macros.h and:
 - rename putn to asm_putn to denote the usage from assembly only,
 - use ENTRY() for asm_putn to make it globally visible.

This way the behavior will be consistent with what we already do on arm32.

Take the opportunity to get rid of unneeded stubs for early_puts,
init_uart and putn since the calls to them are already protected by
respective #ifdef CONFIG_EARLY_PRINTK.

Signed-off-by: Michal Orzel <michal.orzel@xxxxxxx>
Reviewed-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>
Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
Changes in v2:
 - re-sentence the stubs removal in commit msg
 - patch split out from series (others dropped)
---
 xen/arch/arm/arm64/head.S               | 32 ++++---------------------
 xen/arch/arm/include/asm/arm64/macros.h | 15 ++++++++++++
 2 files changed, 19 insertions(+), 28 deletions(-)

diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 8dbd3300d89f..9d7d83a5ed2b 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -74,25 +74,6 @@
  *  x30 - lr
  */
 
- #ifdef CONFIG_EARLY_PRINTK
-/*
- * Macro to print the value of register \xb
- *
- * Clobbers x0 - x4
- */
-.macro print_reg xb
-        mov   x0, \xb
-        mov   x4, lr
-        bl    putn
-        mov   lr, x4
-.endm
-
-#else /* CONFIG_EARLY_PRINTK */
-.macro print_reg xb
-.endm
-
-#endif /* !CONFIG_EARLY_PRINTK */
-
 .section .text.header, "ax", %progbits
 /*.aarch64*/
 
@@ -493,11 +474,12 @@ ENDPROC(asm_puts)
 
 /*
  * Print a 64-bit number in hex.
+ * Note: This function must be called from assembly.
  * x0: Number to print.
  * x23: Early UART base address
  * Clobbers x0-x3
  */
-putn:
+ENTRY(asm_putn)
         adr   x1, hex
         mov   x3, #16
 1:
@@ -510,18 +492,12 @@ putn:
         subs  x3, x3, #1
         b.ne  1b
         ret
-ENDPROC(putn)
+ENDPROC(asm_putn)
 
 hex:    .ascii "0123456789abcdef"
         .align 2
 
-#else  /* CONFIG_EARLY_PRINTK */
-
-ENTRY(early_puts)
-init_uart:
-putn:   ret
-
-#endif /* !CONFIG_EARLY_PRINTK */
+#endif /* CONFIG_EARLY_PRINTK */
 
 /* This provides a C-API version of __lookup_processor_type
  * TODO: For now, the implementation return NULL every time
diff --git a/xen/arch/arm/include/asm/arm64/macros.h 
b/xen/arch/arm/include/asm/arm64/macros.h
index fb9a0602494d..d108dc3a3a71 100644
--- a/xen/arch/arm/include/asm/arm64/macros.h
+++ b/xen/arch/arm/include/asm/arm64/macros.h
@@ -45,9 +45,24 @@
         mov   lr, x3 ;     \
         RODATA_STR(98, _s)
 
+/*
+ * Macro to print the value of register \xb
+ *
+ * Clobbers x0 - x4
+ */
+.macro print_reg xb
+        mov   x0, \xb
+        mov   x4, lr
+        bl    asm_putn
+        mov   lr, x4
+.endm
+
 #else /* CONFIG_EARLY_PRINTK */
 #define PRINT(s)
 
+.macro print_reg xb
+.endm
+
 #endif /* !CONFIG_EARLY_PRINTK */
 
 /*
-- 
2.25.1




 


Rackspace

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