All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: Fix printk specifiers and arguments in iomem_remove_cb()
@ 2023-09-06 10:30 Michal Orzel
  2023-09-06 19:45 ` Vikram Garhwal
  0 siblings, 1 reply; 3+ messages in thread
From: Michal Orzel @ 2023-09-06 10:30 UTC (permalink / raw)
  To: xen-devel; +Cc: Michal Orzel, Stefano Stabellini, Julien Grall, vikram.garhwal

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")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
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(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index b07a6128dc99..5663a049e90a 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -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;
-- 
2.25.1



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

* Re: [PATCH] xen/arm: Fix printk specifiers and arguments in iomem_remove_cb()
  2023-09-06 10:30 [PATCH] xen/arm: Fix printk specifiers and arguments in iomem_remove_cb() Michal Orzel
@ 2023-09-06 19:45 ` Vikram Garhwal
  2023-09-06 20:26   ` Stefano Stabellini
  0 siblings, 1 reply; 3+ messages in thread
From: Vikram Garhwal @ 2023-09-06 19:45 UTC (permalink / raw)
  To: Michal Orzel; +Cc: xen-devel, Stefano Stabellini, Julien Grall

On Wed, Sep 06, 2023 at 12:30:14PM +0200, Michal Orzel wrote:
> 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")
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Vikram Garhwal <vikram.garhwal@amd.com>
> ---
> 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(-)
> 
> diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
> index b07a6128dc99..5663a049e90a 100644
> --- a/xen/common/dt-overlay.c
> +++ b/xen/common/dt-overlay.c
> @@ -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;
> -- 
> 2.25.1
> 


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

* Re: [PATCH] xen/arm: Fix printk specifiers and arguments in iomem_remove_cb()
  2023-09-06 19:45 ` Vikram Garhwal
@ 2023-09-06 20:26   ` Stefano Stabellini
  0 siblings, 0 replies; 3+ messages in thread
From: Stefano Stabellini @ 2023-09-06 20:26 UTC (permalink / raw)
  To: Vikram Garhwal; +Cc: Michal Orzel, xen-devel, Stefano Stabellini, Julien Grall

[-- Attachment #1: Type: text/plain, Size: 2124 bytes --]

On Wed, 6 Sep 2023, Vikram Garhwal wrote:
> On Wed, Sep 06, 2023 at 12:30:14PM +0200, Michal Orzel wrote:
> > 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")
> > Signed-off-by: Michal Orzel <michal.orzel@amd.com>
> Reviewed-by: Vikram Garhwal <vikram.garhwal@amd.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> > ---
> > 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(-)
> > 
> > diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
> > index b07a6128dc99..5663a049e90a 100644
> > --- a/xen/common/dt-overlay.c
> > +++ b/xen/common/dt-overlay.c
> > @@ -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;
> > -- 
> > 2.25.1
> > 
> 

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

end of thread, other threads:[~2023-09-06 20:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-06 10:30 [PATCH] xen/arm: Fix printk specifiers and arguments in iomem_remove_cb() Michal Orzel
2023-09-06 19:45 ` Vikram Garhwal
2023-09-06 20:26   ` Stefano Stabellini

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.