Skip to contentSkip to conversation

xen/arm: domain_builder: irq sanity check logic fix

PATCH In review Stewart Hildebrand 2 participants 3 messages Nov 28, 2017 – Nov 29, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: domain_builder: irq sanity check logic fix

It's not possible for an irq to be both below 16 and greater/equal than 32. Also fix the reference to linux documentation while we're at it.

---
 xen/arch/arm/domain_build.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/domain_build.c +3 -2
index c74f4dd..f50f8b9 100644
@@ -501,9 +501,10 @@ static void set_interrupt_ppi(gic_interrupt_t interrupt, unsigned int irq,
 {
     __be32 *cells = interrupt;
 
-    BUG_ON(irq < 16 && irq >= 32);
+    BUG_ON(irq < 16);
+    BUG_ON(irq >= 32);
 
-    /* See linux Documentation/devictree/bindings/arm/gic.txt */
+    /* See linux Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt */
     dt_set_cell(&cells, 1, 1); /* is a PPI */
     dt_set_cell(&cells, 1, irq - 16); /* PPIs start at 16 */
     dt_set_cell(&cells, 1, (cpumask << 8) | level);
Signature · 6 lines
2.7.4

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw

Hi Stewart,

Quoted 4 lines · Stewart Hildebrand

It's not possible for an irq to be both below 16 and greater/equal than 32. Also fix the reference to linux documentation while we're at it.

Whoops. Well spotted!

Also, I think it would be good to get the patch merge in Xen 4.10. It is boot code and low risk. So:

Cheers,

Quoted 12 lines
---
  xen/arch/arm/domain_build.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
xen/arch/arm/domain_build.c +0 -0
index c74f4dd..f50f8b9 100644
@@ -501,9 +501,10 @@ static void set_interrupt_ppi(gic_interrupt_t interrupt, unsigned int irq,
  {
      __be32 *cells = interrupt;

xen/arch/arm/domain_build.c static void set_interrupt_ppi(gic_interrupt_t interrupt, unsigned int irq, · line 510

Quoted 10 lines
xen/arch/arm/domain_build.c +3 -2
 
-    BUG_ON(irq < 16 && irq >= 32);
+    BUG_ON(irq < 16);
+    BUG_ON(irq >= 32);
 
-    /* See linux Documentation/devictree/bindings/arm/gic.txt */
+    /* See linux Documentation/devicetree/bindings/interrupt-controller/arm,gic.txt */
      dt_set_cell(&cells, 1, 1); /* is a PPI */
      dt_set_cell(&cells, 1, irq - 16); /* PPIs start at 16 */
      dt_set_cell(&cells, 1, (cpumask << 8) | level);

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 1 line · Julien Grall

Hi Stewart,

Hi,

Quoted 11 lines · Stewart Hildebrand
Quoted 4 lines

It's not possible for an irq to be both below 16 and greater/equal than 32. Also fix the reference to linux documentation while we're at it.

Whoops. Well spotted!

Also, I think it would be good to get the patch merge in Xen 4.10. It is boot code and low risk. So:

Sadly this patch break boot on all ARM platform. Looking at the code, there is one caller which use ~0 for the IRQ.

This is to create a placeholder property for the event channel IRQ. The property is then replaced inplace. I think it would be possible to defer the creation of the property until we find the event channel IRQ. This would avoid the placeholder.

I will try to send a patch soon, though it will target Xen 4.11. So even if the patch was valid, I asked to revert it. Sorry for that.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel