Skip to contentSkip to conversation

xen/arm: Fix printk specifiers and arguments in iomem_remove_cb()

PATCH In review Michal Orzel 3 participants 3 messages Sep 6, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Fix printk specifiers and arguments in iomem_remove_cb()

When building Xen for arm32 with CONFIG_DTB_OVERLAY, the following error is printed:

common/dt-overlay.c: In function ‘iomem_remove_cb’:
././include/xen/config.h:55:24: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]

Function parameters s and e (denoting MMIO region) are of type unsigned long and indicate frame numbers and not addresses. This also means that the arguments passed to printk() are incorrect (using PAGE_ALIGN() or PAGE_MASK ANDed with a frame number results in unwanted output). Fix it.

Take the opportunity to switch to %pd specifier to print domain id in a consolidated way.

Fixes 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal functionalities")

---
After this patch (and the one for xl), we are left with one issue breaking CI:
https://gitlab.com/xen-project/patchew/xen/-/jobs/5026938514

---
 xen/common/dt-overlay.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
xen/common/dt-overlay.c +2 -4
index b07a6128dc99..5663a049e90a 100644
@@ -251,10 +251,8 @@ static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
     rc = iomem_deny_access(d, s, e);
     if ( rc )
     {
-        printk(XENLOG_ERR "Unable to remove dom%d access to"
-               " 0x%"PRIx64" - 0x%"PRIx64"\n",
-               d->domain_id,
-               s & PAGE_MASK, PAGE_ALIGN(e) - 1);
+        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
+               d, s, e);
     }
     else
         *c += e - s + 1;
Signature · 1 line
2.25.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Michal Orzel

When building Xen for arm32 with CONFIG_DTB_OVERLAY, the following error is printed:

common/dt-overlay.c: In function ‘iomem_remove_cb’:
././include/xen/config.h:55:24: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]

Function parameters s and e (denoting MMIO region) are of type unsigned long and indicate frame numbers and not addresses. This also means that the arguments passed to printk() are incorrect (using PAGE_ALIGN() or PAGE_MASK ANDed with a frame number results in unwanted output). Fix it.

Quoted 5 lines

Take the opportunity to switch to %pd specifier to print domain id in a consolidated way.

Fixes 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal functionalities")
Quoted 27 lines

---
After this patch (and the one for xl), we are left with one issue breaking CI:
https://gitlab.com/xen-project/patchew/xen/-/jobs/5026938514

---
 xen/common/dt-overlay.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
xen/common/dt-overlay.c +2 -4
index b07a6128dc99..5663a049e90a 100644
@@ -251,10 +251,8 @@ static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
     rc = iomem_deny_access(d, s, e);
     if ( rc )
     {
-        printk(XENLOG_ERR "Unable to remove dom%d access to"
-               " 0x%"PRIx64" - 0x%"PRIx64"\n",
-               d->domain_id,
-               s & PAGE_MASK, PAGE_ALIGN(e) - 1);
+        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
+               d, s, e);
     }
     else
         *c += e - s + 1;
Signature · 1 line
2.25.1
#2 lore raw
Quoted 12 lines · Vikram Garhwal
Quoted 11 lines · Michal Orzel

When building Xen for arm32 with CONFIG_DTB_OVERLAY, the following error is printed:

common/dt-overlay.c: In function ‘iomem_remove_cb’:
././include/xen/config.h:55:24: error: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘long unsigned int’ [-Werror=format=]

Function parameters s and e (denoting MMIO region) are of type unsigned long and indicate frame numbers and not addresses. This also means that the arguments passed to printk() are incorrect (using PAGE_ALIGN() or PAGE_MASK ANDed with a frame number results in unwanted output). Fix it.

Quoted 6 lines
Quoted 5 lines

Take the opportunity to switch to %pd specifier to print domain id in a consolidated way.

Fixes 7e5c4a8b86f1 ("xen/arm: Implement device tree node removal functionalities")
Quoted 28 lines
Quoted 27 lines

---
After this patch (and the one for xl), we are left with one issue breaking CI:
https://gitlab.com/xen-project/patchew/xen/-/jobs/5026938514

---
 xen/common/dt-overlay.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
xen/common/dt-overlay.c +2 -4
index b07a6128dc99..5663a049e90a 100644
@@ -251,10 +251,8 @@ static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
     rc = iomem_deny_access(d, s, e);
     if ( rc )
     {
-        printk(XENLOG_ERR "Unable to remove dom%d access to"
-               " 0x%"PRIx64" - 0x%"PRIx64"\n",
-               d->domain_id,
-               s & PAGE_MASK, PAGE_ALIGN(e) - 1);
+        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
+               d, s, e);
     }
     else
         *c += e - s + 1;
Signature · 1 line
2.25.1