xen/arm: Black list everything with a PPI
PATCH 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.
---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/
--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
xen/arch/arm/domain_build.c +15 -1
@@ -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,20 @@ 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); + +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
On 03.05.19 20:02, Amit Singh Tomar wrote:
Hi, Amit
Quoted 31 lines
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.
Suggested-by Julien Grall <[email protected]>Signed-off-by Amit Singh Tomar <[email protected]>---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +1
-1@@ -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 1407
Quoted 9 lines
xen/arch/arm/domain_build.c +6
-0@@ -1399,6 +1399,20 @@ 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);
Do we need to do something here if platform_get_irq() returns -1?
xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1418
Quoted 11 lines
xen/arch/arm/domain_build.c +8
-0+ +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.
Patch looks good. Although R-Car H3 seems to not use PPIs for PMU, I have tested your patch just to be sure it wouldn't skip anything by a mistake)
Signature · 9 lines
Regards, Oleksandr Tyshchenko _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hello,
Thanks for having a look at it.
Quoted 40 lines · Oleksandr
On 03.05.19 20:02, Amit Singh Tomar wrote:
Hi, Amit
Quoted 34 lines
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.
Suggested-by Julien Grall <[email protected]>Signed-off-by Amit Singh Tomar <[email protected]>---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +1
-1@@ -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,20 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,return 0 ; }
Quoted 8 lines
xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1407
Quoted 6 lines
xen/arch/arm/domain_build.c +6
-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);Do we need to do something here if
platform_get_irq()returns -1?
Yeah, I should have done it. some think like following:
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/domain_build.c;h=d9836779d17c90e84b94ba32e4a20f028189fc5b;hb=HEAD#l1284
Quoted 7 lines
Quoted 7 lines
xen/arch/arm/domain_build.c +7
-0+ +if ( irq_id >=16 && irq_id <32 ) + { +dt_dprintk (" Skip node with (PPI source)\n" ); +return 0 ; + } + }
Quoted 8 lines
xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1418
Quoted 4 lines
xen/arch/arm/domain_build.c +1
-0+/* * Xen is using some path for its own purpose. Warn if a node * already exists with the same path. Patch looks good. Although R-Car H3 seems to not use PPIs for PMU, I have tested your patch just to be sure it wouldn't skip anything by a mistake)
Ok, Thanks for testing it. I would resend it with error condition check.
-Thanks
Amit.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
On Thu, 16 May 2019 17:15:36 +0530
Amit Tomer <[email protected]> wrote:
Hi,
Quoted 52 lines
Thanks for having a look at it.
Quoted 40 lines · Oleksandr
On 03.05.19 20:02, Amit Singh Tomar wrote:
Hi, Amit
Quoted 34 lines
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.
Suggested-by Julien Grall <[email protected]>Signed-off-by Amit Singh Tomar <[email protected]>---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +1
-1@@ -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,20 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,return 0 ; }Quoted 8 lines
xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1407
Quoted 6 lines
xen/arch/arm/domain_build.c +6
-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);Do we need to do something here if
platform_get_irq()returns -1?
Quoted 2 lines
Yeah, I should have done it. some think like following:
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/domain_build.c;h=d9836779d17c90e84b94ba32e4a20f028189fc5b;hb=HEAD#l1284
Why would that (or any actual check against -1) be necessary?
If irq_id is < 0, then it would surely not match the condition below and *nothing* would happen. So I'd say: Keep it like it is, no action necessary.
Quoted 2 lines
Quoted 2 lines
xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1409
Quoted 2 lines
xen/arch/arm/domain_build.c +2
-0+ +if ( irq_id >=16 && irq_id <32 )
Any chance you can put names there? Or at least add a comment that PPIs range from 16 to 31?
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
xen/arch/arm/domain_build.c +6
-0+ { +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.
Quoted 5 lines
Quoted 3 lines
Patch looks good. Although R-Car H3 seems to not use PPIs for PMU, I have tested your patch just to be sure it wouldn't skip anything by a mistake)
Ok, Thanks for testing it. I would resend it with error condition check.
Please don't ;-)
Cheers,
Andre
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 39 lines · Andre Przywara
Quoted 37 lines · On Thu, 16 May 2019 17:15:36 +0530 Amit Tomer <[email protected]> wrote:
Quoted 35 lines · Oleksandr
Quoted 23 lines · Amit Singh Tomar
Suggested-by Julien Grall <[email protected]>Signed-off-by Amit Singh Tomar <[email protected]>---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +1
-1@@ -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 1407
Quoted 9 lines
xen/arch/arm/domain_build.c +6
-0@@ -1399,6 +1399,20 @@ 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);Do we need to do something here if
platform_get_irq()returns -1?
Quoted 6 lines
Quoted 2 lines
Yeah, I should have done it. some think like following:
https://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=xen/arch/arm/domain_build.c;h=d9836779d17c90e84b94ba32e4a20f028189fc5b;hb=HEAD#l1284Why would that (or any actual check against -1) be necessary?
Ifirq_idis < 0, then it would surely not match the condition below and *nothing* would happen. So I'd say: Keep it like it is, no action necessary.
Worst, depending on the action done with check, you could actively break support for platform with multiple interrupt controllers. That's why in handle_device(), the interrupt controller is checked before calling platform_get_irq().
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi Amit,
Just a quick follow-up. Is there any plan to send a new version of this patch?
Cheers,
Quoted 52 lines · Amit Singh Tomar
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.
Suggested-by Julien Grall <[email protected]>Signed-off-by Amit Singh Tomar <[email protected]>---
* This replaces following patch.
https://patchwork.kernel.org/patch/10899881/--- xen/arch/arm/domain_build.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)xen/arch/arm/domain_build.c +15
-1@@ -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,20 @@ 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); + +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 · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Hi,
Quoted 5 lines · Julien Grall
Hi Amit,
Just a quick follow-up. Is there any plan to send a new version of this patch?
Sorry for late on this, I would be able to send it(with a comment for PPI's range) on coming weekend.
Thanks,
-Amit
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel