Skip to contentSkip to conversation

xen/arm: domain_build: map_{dt_}irq_to_domain() fixes

PATCH In review Michal Orzel 5 participants 11 messages May 11, 2023 – May 15, 2023

lore
Share & tools
lore
#0 lore raw

v2 cover xen/arm: domain_build: map_{dt_}irq_to_domain() fixes

Propagate return code correctly + fix the format specifiers.

Michal Orzel (2):
xen/arm: domain_build: Propagate return code of map_irq_to_domain() xen/arm: domain_build: Fix format specifiers in

    map_{dt_}irq_to_domain()
 xen/arch/arm/domain_build.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/2 xen/arm: domain_build: Propagate return code of map_irq_to_domain()

From map_dt_irq_to_domain() we are assigning a return code of map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")

---
Changes in v2:
- split the patch so that a fix alone can be backported

---
 xen/arch/arm/domain_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index f80fdd1af206..9dee1bb8f21c 100644
@@ -2320,7 +2320,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
     res = map_irq_to_domain(d, irq, !mr_data->skip_mapping, dt_node_name(dev));
 
-    return 0;
+    return res;
 }
 
 int __init map_range_to_domain(const struct dt_device_node *dev,
Signature · 1 line
2.25.1
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] xen/arm: domain_build: Propagate return code of map_irq_to_domain()

Quoted 7 lines · Michal Orzel

From map_dt_irq_to_domain() we are assigning a return code of
map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")
Quoted 20 lines

---
Changes in v2:
- split the patch so that a fix alone can be backported

---
  xen/arch/arm/domain_build.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index f80fdd1af206..9dee1bb8f21c 100644
@@ -2320,7 +2320,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
      res = map_irq_to_domain(d, irq, !mr_data->skip_mapping, dt_node_name(dev));
 
-    return 0;
+    return res;
  }
 
  int __init map_range_to_domain(const struct dt_device_node *dev,
Reviewed-by on v2 1/2
#3 lore raw

RE: [PATCH v2 1/2] xen/arm: domain_build: Propagate return code of map_irq_to_domain()

In reply to Michal Orzel

Hi Michal,

Quoted 11 lines

-----Original Message-----
Subject: [PATCH v2 1/2] xen/arm: domain_build: Propagate return code of map_irq_to_domain()

From map_dt_irq_to_domain() we are assigning a return code of map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")

Kind regards,
Henry

Reviewed-by on v2 1/2
#4 lore raw

Re: [PATCH v2 1/2] xen/arm: domain_build: Propagate return code of map_irq_to_domain()

In reply to Michal Orzel

Hi Michal,

Quoted 7 lines · Michal Orzel

From map_dt_irq_to_domain() we are assigning a return code of
map_irq_to_domain() to a variable without checking it for an error. Fix it by propagating the return code directly since this is the last call.

Fixes 467e5cbb2ffc ("xen: arm: consolidate mmio and irq mapping to dom0")

Cheers,

Quoted 20 lines

---
Changes in v2:
- split the patch so that a fix alone can be backported

---
  xen/arch/arm/domain_build.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index f80fdd1af206..9dee1bb8f21c 100644
@@ -2320,7 +2320,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
      res = map_irq_to_domain(d, irq, !mr_data->skip_mapping, dt_node_name(dev));
 
-    return 0;
+    return res;
  }
 
  int __init map_range_to_domain(const struct dt_device_node *dev,
Signature · 1 line
Julien Grall
#5 lore raw

PATCH v2 2/2 xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

In reply to Michal Orzel

IRQ is of unsigned type so %u should be used. When printing domain id, %pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

---
Changes in v2:
- split the v1 patch so that the format specifiers are handled separately
- also fix map_irq_to_domain()

---
 xen/arch/arm/domain_build.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +5 -9
index 9dee1bb8f21c..71f307a572e9 100644
@@ -2265,8 +2265,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
     res = irq_permit_access(d, irq);
     if ( res )
     {
-        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
-               d->domain_id, irq);
+        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
         return res;
     }
 
@@ -2282,8 +2281,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
         res = route_irq_to_guest(d, irq, irq, devname);
         if ( res < 0 )
         {
-            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
-                   irq, d->domain_id);
+            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
             return res;
         }
     }
@@ -2303,8 +2301,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
     if ( irq < NR_LOCAL_IRQS )
     {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
-               dt_node_name(dev), irq);
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
         return -EINVAL;
     }
 
@@ -2312,9 +2309,8 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
     res = irq_set_spi_type(irq, dt_irq->type);
     if ( res )
     {
-        printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
-               dt_node_name(dev), irq, d->domain_id);
+        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
+               dt_node_name(dev), irq, d);
         return res;
     }
 
Signature · 1 line
2.25.1
#6 lore raw

Re: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

Quoted 4 lines · Michal Orzel

IRQ is of unsigned type so %u should be used. When printing domain id, %pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

Very minor grammar note.  Just "split" here.

~Andrew

Reviewed-by on v2 2/2
#7 lore raw

Re: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

In reply to Michal Orzel
Quoted 6 lines · Michal Orzel

IRQ is of unsigned type so %u should be used. When printing domain id, %pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

Quoted 54 lines

---
Changes in v2:
- split the v1 patch so that the format specifiers are handled separately
- also fix map_irq_to_domain()

---
  xen/arch/arm/domain_build.c | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +5 -9
index 9dee1bb8f21c..71f307a572e9 100644
@@ -2265,8 +2265,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
      res = irq_permit_access(d, irq);
      if ( res )
      {
-        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
-               d->domain_id, irq);
+        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
          return res;
      }
 
@@ -2282,8 +2281,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
          res = route_irq_to_guest(d, irq, irq, devname);
          if ( res < 0 )
          {
-            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
-                   irq, d->domain_id);
+            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
              return res;
          }
      }
@@ -2303,8 +2301,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
      if ( irq < NR_LOCAL_IRQS )
      {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
-               dt_node_name(dev), irq);
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
          return -EINVAL;
      }
 
@@ -2312,9 +2309,8 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
      res = irq_set_spi_type(irq, dt_irq->type);
      if ( res )
      {
-        printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
-               dt_node_name(dev), irq, d->domain_id);
+        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
+               dt_node_name(dev), irq, d);
          return res;
      }
 
Reviewed-by on v2 2/2
#8 lore raw

RE: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

In reply to Michal Orzel

Hi Michal,

Quoted 10 lines

-----Original Message-----
Subject: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

IRQ is of unsigned type so %u should be used. When printing domain id, %pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

Kind regards,
Henry

Reviewed-by on v2 2/2
#9 lore raw

Re: [PATCH v2 2/2] xen/arm: domain_build: Fix format specifiers in map_{dt_}irq_to_domain()

In reply to Michal Orzel

Hi Michal,

Quoted 4 lines · Michal Orzel

IRQ is of unsigned type so %u should be used. When printing domain id, %pd should be the correct format to maintain the consistency.

Also, wherever possible, reduce the number of splitted lines for printk().

I will fix the typo pointed out by Andrew whilst committing the series.

Cheers,

Quoted 56 lines

---
Changes in v2:
- split the v1 patch so that the format specifiers are handled separately
- also fix map_irq_to_domain()

---
  xen/arch/arm/domain_build.c | 14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +5 -9
index 9dee1bb8f21c..71f307a572e9 100644
@@ -2265,8 +2265,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
      res = irq_permit_access(d, irq);
      if ( res )
      {
-        printk(XENLOG_ERR "Unable to permit to dom%u access to IRQ %u\n",
-               d->domain_id, irq);
+        printk(XENLOG_ERR "Unable to permit to %pd access to IRQ %u\n", d, irq);
          return res;
      }
 
@@ -2282,8 +2281,7 @@ int __init map_irq_to_domain(struct domain *d, unsigned int irq,
          res = route_irq_to_guest(d, irq, irq, devname);
          if ( res < 0 )
          {
-            printk(XENLOG_ERR "Unable to map IRQ%"PRId32" to dom%d\n",
-                   irq, d->domain_id);
+            printk(XENLOG_ERR "Unable to map IRQ%u to %pd\n", irq, d);
              return res;
          }
      }
@@ -2303,8 +2301,7 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
 
      if ( irq < NR_LOCAL_IRQS )
      {
-        printk(XENLOG_ERR "%s: IRQ%"PRId32" is not a SPI\n",
-               dt_node_name(dev), irq);
+        printk(XENLOG_ERR "%s: IRQ%u is not a SPI\n", dt_node_name(dev), irq);
          return -EINVAL;
      }
 
@@ -2312,9 +2309,8 @@ static int __init map_dt_irq_to_domain(const struct dt_device_node *dev,
      res = irq_set_spi_type(irq, dt_irq->type);
      if ( res )
      {
-        printk(XENLOG_ERR
-               "%s: Unable to setup IRQ%"PRId32" to dom%d\n",
-               dt_node_name(dev), irq, d->domain_id);
+        printk(XENLOG_ERR "%s: Unable to setup IRQ%u to %pd\n",
+               dt_node_name(dev), irq, d);
          return res;
      }
 
Signature · 1 line
Julien Grall
#10 lore raw
In reply to Michal Orzel

Hi Michal,

Quoted 6 lines · Michal Orzel

Propagate return code correctly + fix the format specifiers.

Michal Orzel (2):
xen/arm: domain_build: Propagate return code of map_irq_to_domain() xen/arm: domain_build: Fix format specifiers in

     map_{dt_}irq_to_domain()

I have committed the series.

Cheers,

Signature · 1 line
Julien Grall