Skip to contentSkip to conversation

xen/arm: Blacklist PMU with "arm, cortex-a53-pmu"

PATCH In review Amit Singh Tomar 3 participants 10 messages Apr 14, 2019 – Apr 29, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Blacklist PMU with "arm, cortex-a53-pmu"

At the moment, we hide PMU's from domain 0 and XEN boot fails on platform[1] where DTS contains "arm,cortex-a53-pmu" as compatible string for PMU node.

This patch simply adds "arm,cortex-a53-pmu" to list of blacklisted PMUs.

[1]: https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/freescale/imx8mq.dtsi#L124

---
 xen/arch/arm/domain_build.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/arm/domain_build.c +1 -0
index d983677..b54592a 100644
@@ -1334,6 +1334,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
         DT_MATCH_COMPATIBLE("arm,cortex-a15-pmu"),
         DT_MATCH_COMPATIBLE("arm,cortex-a53-edac"),
         DT_MATCH_COMPATIBLE("arm,armv8-pmuv3"),
+        DT_MATCH_COMPATIBLE("arm,cortex-a53-pmu"),
         DT_MATCH_PATH("/cpus"),
         DT_MATCH_TYPE("memory"),
         /* The memory mapped timer is not supported by Xen. */
Signature · 7 lines
2.7.4


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

Hi,

Quoted 2 lines · Amit Singh Tomar

At the moment, we hide PMU's from domain 0 and XEN boot fails on platform[1] where DTS contains "arm,cortex-a53-pmu" as compatible string for PMU node.

"Domain 0 and Xen boot fails" is pretty vague. How does it fail?

In general, a commit message should give enough to the reviewer to understand what is the issue and be able to decide whether your patch is the correct fix.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw
Quoted 9 lines · Julien Grall

Hi,

Quoted 4 lines · Amit Singh Tomar

At the moment, we hide PMU's from domain 0 and XEN boot fails on platform[1]
where DTS contains "arm,cortex-a53-pmu" as compatible string for PMU node.

"Domain 0 and Xen boot fails" is pretty vague. How does it fail?

After talking via IRC, the problem is PPIs, that this platform uses for PMU interrupts. When Xen tries to setup the IRQ forwarding for Dom0 for this device, it fails because it only supports forwarding SPIs. So interestingly we erroneously forwarded A53 PMUs (those that are described by that particular compatible string only) to Dom0 for quite a while, but nobody noticed (or cared).

Amit, please adjust the commit message accordingly.

Cheers,
Andre.

Quoted 7 lines

In general, a commit message should give enough to the reviewer to understand what is the issue and be able to decide whether your patch is the correct fix.

Cheers,

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

author
#3 lore raw

Hello,

Quoted 9 lines

After talking via IRC, the problem is PPIs, that this platform uses for PMU interrupts. When Xen tries to setup the IRQ forwarding for Dom0 for this device, it fails because it only supports forwarding SPIs. So interestingly we erroneously forwarded A53 PMUs (those that are described by that particular compatible string only) to Dom0 for quite a while, but nobody noticed (or cared).

Amit, please adjust the commit message accordingly.

Ok but original commit "d45e9b7c53428a2aa4d067927e7ef5e30783fb8b" that blacklist PMU's clearly states that issue is due to PPI and that can not be routed to guest.

I thought, This patch is just continuation of same.

Thanks
-Amit

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

#4 lore raw
Quoted 9 lines · On Mon, 15 Apr 2019 13:41:41 +0530 Amit Tomer <[email protected]> wrote:

Hello,

Quoted 7 lines

After talking via IRC, the problem is PPIs, that this platform uses for PMU interrupts. When Xen tries to setup the IRQ forwarding for Dom0 for this device, it fails because it only supports forwarding SPIs. So interestingly we erroneously forwarded A53 PMUs (those that are described by that particular compatible string only) to Dom0 for quite a while, but nobody noticed (or cared).

Quoted 7 lines
Quoted 2 lines

Amit, please adjust the commit message accordingly.

Ok but original commit "d45e9b7c53428a2aa4d067927e7ef5e30783fb8b" that blacklist PMU's clearly states that issue is due to PPI and that can not be routed to guest.

I thought, This patch is just continuation of same.

Sure, but Julien was asking for a reason for this patch in the commit message. There are quite some platforms which use this compatible string already, and none of them failed so far. This is because they use SPIs, but as the original commit message mentions there are more issues than just the IRQs.

All this should be in the commit message. As you have seen yourself in Ian's commit, it's quite helpful later on.

So you should mention:
a) the problem you encountered: PPI forwarding denied on iMX8
b) the reason for the problem: A53 PMU not blacklisted
c) the fix: adding the A53 compatible string to the blacklist

Cheers,
Andre.

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

#5 lore raw

Hi,

Quoted 26 lines · Andre Przywara
Quoted 9 lines · On Mon, 15 Apr 2019 13:41:41 +0530 Amit Tomer <[email protected]> wrote:

Hello,

Quoted 7 lines

After talking via IRC, the problem is PPIs, that this platform uses for PMU interrupts. When Xen tries to setup the IRQ forwarding for Dom0 for this device, it fails because it only supports forwarding SPIs. So interestingly we erroneously forwarded A53 PMUs (those that are described by that particular compatible string only) to Dom0 for quite a while, but nobody noticed (or cared).

Quoted 7 lines
Quoted 2 lines

Amit, please adjust the commit message accordingly.

Ok but original commit "d45e9b7c53428a2aa4d067927e7ef5e30783fb8b" that blacklist PMU's clearly states that issue is due to PPI and that can not be routed to guest.

I thought, This patch is just continuation of same.

Sure, but Julien was asking for a reason for this patch in the commit message. There are quite some platforms which use this compatible string already, and none of them failed so far. This is because they use SPIs, but as the original commit message mentions there are more issues than just the IRQs.

Quoted 7 lines

All this should be in the commit message. As you have seen yourself in Ian's commit, it's quite helpful later on.

So you should mention:
a) the problem you encountered: PPI forwarding denied on iMX8
b) the reason for the problem: A53 PMU not blacklisted
c) the fix: adding the A53 compatible string to the blacklist

There are ~25 compatible string for the PMUs and I would rather not want to see all of them added in Xen.

From the test on Juno (it is using arm,cortex-a53-pmu with SPIs), Linux will happily give up because we craft the PMU registers to expose nothing.

Could we instead try to automatically blacklist any device using PPI?

Cheers,

Signature · 6 lines
Julien Grall

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

Hello,

Quoted 1 line

Could we instead try to automatically blacklist any device using PPI?

Just tested following change:

xen/arch/arm/domain_build.c +0 -0
index d983677..0c82976 100644
@@ -1289,6 +1289,10 @@ static int __init handle_device(struct domain

*d, struct dt_device_node *dev,

             return res;
         }

+ /* Don't process device using PPI source */
+ if ( res > 16 && res < 32)
+ return 0;
+

         res = map_irq_to_domain(d, res, need_mapping, dt_node_name(dev));
         if ( res )
             return res;

Would it be Ok ?

Thanks,
-Amit

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

#7 lore raw
Quoted 1 line · Amit Tomer

Hello,

Hi,

Quoted 22 lines
Quoted 2 lines

Could we instead try to automatically blacklist any device using PPI?

Just tested following change:

xen/arch/arm/domain_build.c +4 -0
index d983677..0c82976 100644
@@ -1289,6 +1289,10 @@ static int __init handle_device(struct domain
 *d, struct dt_device_node *dev,
              return res;
          }
 
+        /* Don't process device using PPI source */
+        if ( res > 16 && res < 32)
+            return 0;
+
          res = map_irq_to_domain(d, res, need_mapping, dt_node_name(dev));
          if ( res )
              return res;
Quoted 1 line

Would it be Ok ?

Well, this does not work properly. The DT node will still be written in the domain because handle_device() return 0. However, the device will be half mapped resulting to crash later on.

The proper way is to detect PPI before hand and completely skip the node if any.

Cheers,

Signature · 6 lines
Julien Grall

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

Hello,

Quoted 2 lines

The proper way is to detect PPI before hand and completely skip the node if any.

I tried the following change:

xen/arch/arm/domain_build.c +0 -0
index d983677..a9ecfed 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, irq_id;
     const char *name;
     const char *path;

@@ -1399,6 +1399,16 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,

         return 0;
     }

+ /*Skip the node, using PPI source */
+ irq_id = platform_get_irq(node, 0);
+
+ if ( irq_id > 16 && irq_id < 32 )
+ {
+ dt_dprintk(" Skip node with (PPI source)\n");
+ return 0;
+ }
+
+

After booting dom0, don't see PMU node is getting generated(its skipped completely now).

Thanks,
-Amit.

Quoted 1 line

Julien Grall

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

#9 lore raw
Quoted 1 line · Amit Tomer

Hello,

Hi,

Quoted 20 lines
Quoted 2 lines

The proper way is to detect PPI before hand and completely skip the node if any.

I tried the following change:

xen/arch/arm/domain_build.c +1 -1
index d983677..a9ecfed 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, irq_id;
      const char *name;
      const char *path;

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

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

That's only cover the first interrupt of a device. What if the first interrupt is an SPI but all the other are actually PPIs?

In order to black all devices using PPI, we need to go through *all* the interrupts of the device. Otherwise you will miss some.

Cheers,

Signature · 6 lines
Julien Grall

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