Re: [Xen-devel] [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0

2015-11-30 Thread Julien Grall
On 27/11/15 15:04, Stefano Stabellini wrote:
>> +vgic_reserve_virq(d, i);
>> +irq_set_type(i, ACPI_IRQ_TYPE_NONE);
> 
> I don't know if there is any point in setting the type to NONE. It's the
> default, isn't it?

No, the default is *_IRQ_TYPE_INVALID.

Regards,

-- 
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0

2015-11-27 Thread Stefano Stabellini
On Tue, 17 Nov 2015, shannon.z...@linaro.org wrote:

> From: Shannon Zhao 
> 
> Route all SPIs to Dom0 except the interrupts that Xen uses. Since Xen
> already uses the uart interrupt, the desc->action will not be NULL, so
> it will skip it.
> 
> Signed-off-by: Shannon Zhao 
> ---
>  xen/arch/arm/domain_build.c | 33 +
>  1 file changed, 33 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 6d8536b..6945f89 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1360,6 +1360,35 @@ static int prepare_dtb(struct domain *d, struct 
> kernel_info *kinfo)
>  #define XEN_HYPERVISOR_ID 0x58656E564D4D  /* "XenVMM" */
>  #define ACPI_DOM0_FDT_MIN_SIZE 4096
>  
> +static int acpi_route_spi(struct domain *d)
> +{
> +int i, res;
> +struct irq_desc *desc;
> +
> +/* Don't route Xen used interrupt to Dom0. Since Xen already uses the 
> uart
> + * interrupt, the desc->action will not be NULL, so it will skip it.
> + */
> +for( i = NR_LOCAL_IRQS; i < vgic_num_irqs(d); i++ )
> +{
> +/* Don't route uart interrupt to Dom0 */
> +desc = irq_to_desc(i);
> +if( desc->action != NULL)
> +continue;

Don't you need to call irq_permit_access too?


> +vgic_reserve_virq(d, i);
> +irq_set_type(i, ACPI_IRQ_TYPE_NONE);

I don't know if there is any point in setting the type to NONE. It's the
default, isn't it?


> +res = route_irq_to_guest(d, i, i, NULL);
> +if ( res )
> +{
> +printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n",
> +   i, d->domain_id);
> +continue;
> +}
> +}
> +
> +return 0;
> +}
> +
>  static int make_chosen_node(const struct kernel_info *kinfo,
>  struct membank tbl_add[])
>  {
> @@ -1897,6 +1926,10 @@ static int prepare_acpi(struct domain *d, struct 
> kernel_info *kinfo)
>  if ( rc != 0 )
>  return rc;
>  
> +rc = acpi_route_spi(d);
> +if ( rc != 0 )
> +return rc;
> +
>  return 0;
>  }
>  #else
> -- 
> 2.1.0
> 

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


Re: [Xen-devel] [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0

2015-11-17 Thread Julien Grall
Hi Shannon,

On 17/11/15 09:40, shannon.z...@linaro.org wrote:
> From: Shannon Zhao 
> 
> Route all SPIs to Dom0 except the interrupts that Xen uses. Since Xen
> already uses the uart interrupt, the desc->action will not be NULL, so
> it will skip it.
> 
> Signed-off-by: Shannon Zhao 
> ---
>  xen/arch/arm/domain_build.c | 33 +
>  1 file changed, 33 insertions(+)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 6d8536b..6945f89 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -1360,6 +1360,35 @@ static int prepare_dtb(struct domain *d, struct 
> kernel_info *kinfo)
>  #define XEN_HYPERVISOR_ID 0x58656E564D4D  /* "XenVMM" */
>  #define ACPI_DOM0_FDT_MIN_SIZE 4096
>  
> +static int acpi_route_spi(struct domain *d)
> +{
> +int i, res;
> +struct irq_desc *desc;
> +
> +/* Don't route Xen used interrupt to Dom0. Since Xen already uses the 
> uart
> + * interrupt, the desc->action will not be NULL, so it will skip it.
> + */
> +for( i = NR_LOCAL_IRQS; i < vgic_num_irqs(d); i++ )
> +{
> +/* Don't route uart interrupt to Dom0 */

Your comments are wrong. desc->action != NULL means Xen is using the
interrupt. It could be for the SMMU, the UART...

> +desc = irq_to_desc(i);
> +if( desc->action != NULL)

Coding style.

> +continue;
> +
> +vgic_reserve_virq(d, i);
> +irq_set_type(i, ACPI_IRQ_TYPE_NONE);
> +res = route_irq_to_guest(d, i, i, NULL);
> +if ( res )
> +{
> +printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n",
> +   i, d->domain_id);
> +continue;
> +}
> +}
> +
> +return 0;
> +}
> +

Regards,

-- 
Julien Grall

___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel


[Xen-devel] [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0

2015-11-17 Thread shannon . zhao
From: Shannon Zhao 

Route all SPIs to Dom0 except the interrupts that Xen uses. Since Xen
already uses the uart interrupt, the desc->action will not be NULL, so
it will skip it.

Signed-off-by: Shannon Zhao 
---
 xen/arch/arm/domain_build.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 6d8536b..6945f89 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1360,6 +1360,35 @@ static int prepare_dtb(struct domain *d, struct 
kernel_info *kinfo)
 #define XEN_HYPERVISOR_ID 0x58656E564D4D  /* "XenVMM" */
 #define ACPI_DOM0_FDT_MIN_SIZE 4096
 
+static int acpi_route_spi(struct domain *d)
+{
+int i, res;
+struct irq_desc *desc;
+
+/* Don't route Xen used interrupt to Dom0. Since Xen already uses the uart
+ * interrupt, the desc->action will not be NULL, so it will skip it.
+ */
+for( i = NR_LOCAL_IRQS; i < vgic_num_irqs(d); i++ )
+{
+/* Don't route uart interrupt to Dom0 */
+desc = irq_to_desc(i);
+if( desc->action != NULL)
+continue;
+
+vgic_reserve_virq(d, i);
+irq_set_type(i, ACPI_IRQ_TYPE_NONE);
+res = route_irq_to_guest(d, i, i, NULL);
+if ( res )
+{
+printk(XENLOG_ERR "Unable to route IRQ %u to domain %u\n",
+   i, d->domain_id);
+continue;
+}
+}
+
+return 0;
+}
+
 static int make_chosen_node(const struct kernel_info *kinfo,
 struct membank tbl_add[])
 {
@@ -1897,6 +1926,10 @@ static int prepare_acpi(struct domain *d, struct 
kernel_info *kinfo)
 if ( rc != 0 )
 return rc;
 
+rc = acpi_route_spi(d);
+if ( rc != 0 )
+return rc;
+
 return 0;
 }
 #else
-- 
2.1.0


___
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel