Skip to contentSkip to conversation

xen/arm: Black list everything with a PPI

PATCH In review Amit Singh Tomar 2 participants 2 messages Jun 2, 2019 – Jun 15, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen/arm: Black list everything with a PPI

XEN should not forward PPIs to Dom0 as it only support SPIs. One of solution to this problem is to skip any device that uses PPI source completely while building domain itself.

This patch goes through all the interrupt sources of device and skip it if one of interrupt source is PPI. It fixes XEN boot on i.MX8MQ by skipping PMU node.

---
Changes since v1:
* Added comment for PPIs range.

---
 xen/arch/arm/domain_build.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +16 -1
index d983677..5035758 100644
@@ -1353,7 +1353,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         { /* sentinel */ },
     };
     struct dt_device_node *child;
-    int res;
+    int res, i, nirq, irq_id;
     const char *name;
     const char *path;
 
@@ -1399,6 +1399,21 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         return 0;
     }
 
+    /* Skip the node, using PPI source */
+    nirq = dt_number_of_irq(node);
+
+    for ( i = 0 ; i < nirq ; i++ )
+    {
+        irq_id = platform_get_irq(node, i);
+
+        /* PPIs ranges from ID 16 to 31 */
+        if ( irq_id >= 16 && irq_id < 32 )
+        {
+            dt_dprintk(" Skip node with (PPI source)\n");
+            return 0;
+        }
+    }
+
     /*
      * Xen is using some path for its own purpose. Warn if a node
      * already exists with the same path.
Signature · 7 lines
2.7.4


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

Hi Amit,

Sorry for the late answer.

Title: "xen/arm: domain_build: Black list devices using PPIs"

Quoted 1 line · Amit Singh Tomar

XEN should not forward PPIs to Dom0 as it only support SPIs.

Reading this sentence, it leads to think that Xen does not support PPIs at all. However, we are supporting PPIs in Xen but not able to forward them directly to a guest.

So how about:

"Currently, the vGIC is not able to cope with hardware PPIs routed to guests."

Quoted 1 line

One of solution to this problem is to skip any device that

s/of solution/of the solutions/

Quoted 1 line

uses PPI source completely while building domain itself.

s/building domain/building the domain/

Quoted 2 lines

This patch goes through all the interrupt sources of device and skip it

s/of device/of a device/

Quoted 1 line

if one of interrupt source is PPI. It fixes XEN boot on i.MX8MQ by

"if one of the interrupts sources is a PPI".

Quoted 1 line

skipping PMU node.

s/PMU/the PMU/

Quoted 24 lines

---
Changes since v1:
* Added comment for PPIs range.

---
  xen/arch/arm/domain_build.c | 17 ++++++++++++++++-
  1 file changed, 16 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +1 -1
index d983677..5035758 100644
@@ -1353,7 +1353,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
          { /* sentinel */ },
      };
      struct dt_device_node *child;
-    int res;
+    int res, i, nirq, irq_id;
      const char *name;
      const char *path;
 

xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1402

Quoted 4 lines
xen/arch/arm/domain_build.c +1 -0
@@ -1399,6 +1399,21 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
          return 0;
      }
 
+    /* Skip the node, using PPI source */

I would add a word explaining why they are skipped:

"The vGIC does not support routing hardware PPIs to guest. So we need to skip any nodes using PPIs".

xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1412

Quoted 10 lines
xen/arch/arm/domain_build.c +10 -0
+    nirq = dt_number_of_irq(node);
+
+    for ( i = 0 ; i < nirq ; i++ )
+    {
+        irq_id = platform_get_irq(node, i);
+
+        /* PPIs ranges from ID 16 to 31 */
+        if ( irq_id >= 16 && irq_id < 32 )
+        {
+            dt_dprintk(" Skip node with (PPI source)\n");

The () looks a bit odd here. If you want to follow the other printk, then it should be: " Skip it (using PPIs)\n"

Cheers,

Signature · 6 lines
Julien Grall

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