diff mbox

[v4,5/5] ARM: ITS: Expose ITS in the MADT table

Message ID 1505999845-12577-6-git-send-email-mjaggi@caviumnetworks.com (mailing list archive)
State New, archived
Headers show

Commit Message

Manish Jaggi Sept. 21, 2017, 1:17 p.m. UTC
From: Manish Jaggi <mjaggi@cavium.com>

Add gicv3_its_make_hwdom_madt to update hwdom MADT ITS information.

Signed-off-by: Manish Jaggi <mjaggi@cavium.com>
---
 xen/arch/arm/gic-v3-its.c        | 19 +++++++++++++++++++
 xen/arch/arm/gic-v3.c            |  1 +
 xen/include/asm-arm/gic_v3_its.h |  8 ++++++++
 3 files changed, 28 insertions(+)

Comments

Julien Grall Oct. 3, 2017, 2:33 p.m. UTC | #1
Hi Manish,

On 21/09/17 14:17, mjaggi@caviumnetworks.com wrote:
> From: Manish Jaggi <mjaggi@cavium.com>
> 
> Add gicv3_its_make_hwdom_madt to update hwdom MADT ITS information.
> 
> Signed-off-by: Manish Jaggi <mjaggi@cavium.com>
> ---
>   xen/arch/arm/gic-v3-its.c        | 19 +++++++++++++++++++
>   xen/arch/arm/gic-v3.c            |  1 +
>   xen/include/asm-arm/gic_v3_its.h |  8 ++++++++
>   3 files changed, 28 insertions(+)
> 
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 8697e5b..e3e7e92 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -1062,6 +1062,25 @@ void gicv3_its_acpi_init(void)
>       acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
>                               gicv3_its_acpi_probe, 0);
>   }
> +
> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr)
> +{
> +    unsigned long i = 0;
> +    void *fw_its;
> +    struct acpi_madt_generic_translator *hwdom_its;
> +
> +    hwdom_its = base_ptr;
> +
> +    for ( i = 0; i < vgic_v3_its_count(d); i++ )
> +    {
> +        fw_its = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
> +                                           i);
> +        memcpy(hwdom_its, fw_its, sizeof(struct acpi_madt_generic_translator));
> +        hwdom_its++;
> +    }
> +
> +    return sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d);
> +}
>   #endif
>   
>   /*
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 6e8d580..d29eea6 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1403,6 +1403,7 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
>           table_len += size;
>       }
>   
> +    table_len += gicv3_its_make_hwdom_madt(d, base_ptr + table_len);

Newline here please.

I will leave Andre to comment on this patch as he suggested the rework.

Cheers,

>       return table_len;
>   }
>   
> diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h
> index 31fca66..fc37776 100644
> --- a/xen/include/asm-arm/gic_v3_its.h
> +++ b/xen/include/asm-arm/gic_v3_its.h
> @@ -138,6 +138,8 @@ void gicv3_its_dt_init(const struct dt_device_node *node);
>   
>   #ifdef CONFIG_ACPI
>   void gicv3_its_acpi_init(void);
> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
> +                                        void *base_ptr);
>   #endif
>   
>   /* Deny iomem access for its */
> @@ -208,6 +210,12 @@ static inline void gicv3_its_dt_init(const struct dt_device_node *node)
>   static inline void gicv3_its_acpi_init(void)
>   {
>   }
> +
> +static inline unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
> +                                                      void *base_ptr)
> +{
> +    return 0;
> +}
>   #endif
>   
>   static inline int gicv3_its_deny_access(const struct domain *d)
>
Manish Jaggi Oct. 5, 2017, 6:52 a.m. UTC | #2
Hi Andre,

On 10/3/2017 8:03 PM, Julien Grall wrote:
> Hi Manish,
>
> On 21/09/17 14:17, mjaggi@caviumnetworks.com wrote:
>> From: Manish Jaggi <mjaggi@cavium.com>
>>
>> Add gicv3_its_make_hwdom_madt to update hwdom MADT ITS information.
>>
>> Signed-off-by: Manish Jaggi <mjaggi@cavium.com>
>> ---
>>   xen/arch/arm/gic-v3-its.c        | 19 +++++++++++++++++++
>>   xen/arch/arm/gic-v3.c            |  1 +
>>   xen/include/asm-arm/gic_v3_its.h |  8 ++++++++
>>   3 files changed, 28 insertions(+)
>>
>> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
>> index 8697e5b..e3e7e92 100644
>> --- a/xen/arch/arm/gic-v3-its.c
>> +++ b/xen/arch/arm/gic-v3-its.c
>> @@ -1062,6 +1062,25 @@ void gicv3_its_acpi_init(void)
>>       acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
>>                               gicv3_its_acpi_probe, 0);
>>   }
>> +
>> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void 
>> *base_ptr)
>> +{
>> +    unsigned long i = 0;
>> +    void *fw_its;
>> +    struct acpi_madt_generic_translator *hwdom_its;
>> +
>> +    hwdom_its = base_ptr;
>> +
>> +    for ( i = 0; i < vgic_v3_its_count(d); i++ )
>> +    {
>> +        fw_its = 
>> acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
>> +                                           i);
>> +        memcpy(hwdom_its, fw_its, sizeof(struct 
>> acpi_madt_generic_translator));
>> +        hwdom_its++;
>> +    }
>> +
>> +    return sizeof(struct acpi_madt_generic_translator) * 
>> vgic_v3_its_count(d);
>> +}
>>   #endif
>>     /*
>> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
>> index 6e8d580..d29eea6 100644
>> --- a/xen/arch/arm/gic-v3.c
>> +++ b/xen/arch/arm/gic-v3.c
>> @@ -1403,6 +1403,7 @@ static int gicv3_make_hwdom_madt(const struct 
>> domain *d, u32 offset)
>>           table_len += size;
>>       }
>>   +    table_len += gicv3_its_make_hwdom_madt(d, base_ptr + table_len);
>
> Newline here please.
>
> I will leave Andre to comment on this patch as he suggested the rework.
Could you please provide comments on this patch so that I can send an 
updated v5.
>
> Cheers,
>
>>       return table_len;
>>   }
>>   diff --git a/xen/include/asm-arm/gic_v3_its.h 
>> b/xen/include/asm-arm/gic_v3_its.h
>> index 31fca66..fc37776 100644
>> --- a/xen/include/asm-arm/gic_v3_its.h
>> +++ b/xen/include/asm-arm/gic_v3_its.h
>> @@ -138,6 +138,8 @@ void gicv3_its_dt_init(const struct 
>> dt_device_node *node);
>>     #ifdef CONFIG_ACPI
>>   void gicv3_its_acpi_init(void);
>> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
>> +                                        void *base_ptr);
>>   #endif
>>     /* Deny iomem access for its */
>> @@ -208,6 +210,12 @@ static inline void gicv3_its_dt_init(const 
>> struct dt_device_node *node)
>>   static inline void gicv3_its_acpi_init(void)
>>   {
>>   }
>> +
>> +static inline unsigned long gicv3_its_make_hwdom_madt(const struct 
>> domain *d,
>> +                                                      void *base_ptr)
>> +{
>> +    return 0;
>> +}
>>   #endif
>>     static inline int gicv3_its_deny_access(const struct domain *d)
>>
>
Andre Przywara Oct. 5, 2017, 3:14 p.m. UTC | #3
Hi Manish,

On 21/09/17 14:17, mjaggi@caviumnetworks.com wrote:
> From: Manish Jaggi <mjaggi@cavium.com>
> 
> Add gicv3_its_make_hwdom_madt to update hwdom MADT ITS information.

Thanks for the rework, that looks much better now!

> Signed-off-by: Manish Jaggi <mjaggi@cavium.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Cheers,
Andre.

> ---
>  xen/arch/arm/gic-v3-its.c        | 19 +++++++++++++++++++
>  xen/arch/arm/gic-v3.c            |  1 +
>  xen/include/asm-arm/gic_v3_its.h |  8 ++++++++
>  3 files changed, 28 insertions(+)
> 
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 8697e5b..e3e7e92 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -1062,6 +1062,25 @@ void gicv3_its_acpi_init(void)
>      acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
>                              gicv3_its_acpi_probe, 0);
>  }
> +
> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr)
> +{
> +    unsigned long i = 0;
> +    void *fw_its;
> +    struct acpi_madt_generic_translator *hwdom_its;
> +
> +    hwdom_its = base_ptr;
> +
> +    for ( i = 0; i < vgic_v3_its_count(d); i++ )
> +    {
> +        fw_its = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
> +                                           i);
> +        memcpy(hwdom_its, fw_its, sizeof(struct acpi_madt_generic_translator));
> +        hwdom_its++;
> +    }
> +
> +    return sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d);
> +}
>  #endif
>  
>  /*
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 6e8d580..d29eea6 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -1403,6 +1403,7 @@ static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
>          table_len += size;
>      }
>  
> +    table_len += gicv3_its_make_hwdom_madt(d, base_ptr + table_len);
>      return table_len;
>  }
>  
> diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h
> index 31fca66..fc37776 100644
> --- a/xen/include/asm-arm/gic_v3_its.h
> +++ b/xen/include/asm-arm/gic_v3_its.h
> @@ -138,6 +138,8 @@ void gicv3_its_dt_init(const struct dt_device_node *node);
>  
>  #ifdef CONFIG_ACPI
>  void gicv3_its_acpi_init(void);
> +unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
> +                                        void *base_ptr);
>  #endif
>  
>  /* Deny iomem access for its */
> @@ -208,6 +210,12 @@ static inline void gicv3_its_dt_init(const struct dt_device_node *node)
>  static inline void gicv3_its_acpi_init(void)
>  {
>  }
> +
> +static inline unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
> +                                                      void *base_ptr)
> +{
> +    return 0;
> +}
>  #endif
>  
>  static inline int gicv3_its_deny_access(const struct domain *d)
>
diff mbox

Patch

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 8697e5b..e3e7e92 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1062,6 +1062,25 @@  void gicv3_its_acpi_init(void)
     acpi_table_parse_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
                             gicv3_its_acpi_probe, 0);
 }
+
+unsigned long gicv3_its_make_hwdom_madt(const struct domain *d, void *base_ptr)
+{
+    unsigned long i = 0;
+    void *fw_its;
+    struct acpi_madt_generic_translator *hwdom_its;
+
+    hwdom_its = base_ptr;
+
+    for ( i = 0; i < vgic_v3_its_count(d); i++ )
+    {
+        fw_its = acpi_table_get_entry_madt(ACPI_MADT_TYPE_GENERIC_TRANSLATOR,
+                                           i);
+        memcpy(hwdom_its, fw_its, sizeof(struct acpi_madt_generic_translator));
+        hwdom_its++;
+    }
+
+    return sizeof(struct acpi_madt_generic_translator) * vgic_v3_its_count(d);
+}
 #endif
 
 /*
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 6e8d580..d29eea6 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1403,6 +1403,7 @@  static int gicv3_make_hwdom_madt(const struct domain *d, u32 offset)
         table_len += size;
     }
 
+    table_len += gicv3_its_make_hwdom_madt(d, base_ptr + table_len);
     return table_len;
 }
 
diff --git a/xen/include/asm-arm/gic_v3_its.h b/xen/include/asm-arm/gic_v3_its.h
index 31fca66..fc37776 100644
--- a/xen/include/asm-arm/gic_v3_its.h
+++ b/xen/include/asm-arm/gic_v3_its.h
@@ -138,6 +138,8 @@  void gicv3_its_dt_init(const struct dt_device_node *node);
 
 #ifdef CONFIG_ACPI
 void gicv3_its_acpi_init(void);
+unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
+                                        void *base_ptr);
 #endif
 
 /* Deny iomem access for its */
@@ -208,6 +210,12 @@  static inline void gicv3_its_dt_init(const struct dt_device_node *node)
 static inline void gicv3_its_acpi_init(void)
 {
 }
+
+static inline unsigned long gicv3_its_make_hwdom_madt(const struct domain *d,
+                                                      void *base_ptr)
+{
+    return 0;
+}
 #endif
 
 static inline int gicv3_its_deny_access(const struct domain *d)