[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 5/5] ARM: ITS: Expose ITS in the MADT table



Hi,

On 05/09/17 18:15, mjaggi@xxxxxxxxxxxxxxxxxx wrote:
> From: Manish Jaggi <mjaggi@xxxxxxxxxx>
> 
> Add gicv3_its_make_hwdom_madt to update hwdom MADT ITS information.
> 
> Signed-off-by: Manish Jaggi <mjaggi@xxxxxxxxxx>
> ---
>  xen/arch/arm/gic-v3-its.c        | 23 +++++++++++++++++++++++
>  xen/arch/arm/gic-v3.c            |  1 +
>  xen/include/asm-arm/gic_v3_its.h |  8 ++++++++
>  3 files changed, 32 insertions(+)
> 
> diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
> index 0ab1466..bf84db8 100644
> --- a/xen/arch/arm/gic-v3-its.c
> +++ b/xen/arch/arm/gic-v3-its.c
> @@ -1064,6 +1064,29 @@ 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, u8 *base_ptr,
> +                                        unsigned long offset)

What about we drop offset here and add it at the caller, then return
just the size of the ITS MADT size? Also base_ptr could be a void* then.

> +{
> +    unsigned long i;
> +    struct acpi_madt_generic_translator *fw_its;

If you make this either a "void *" or a "struct acpi_subtable_header *"
then you can save the rather ugly cast in the assignment below.

> +    struct acpi_madt_generic_translator *hwdom_its;
> +
> +    hwdom_its = (struct acpi_madt_generic_translator *)(base_ptr
> +                   + offset);

If you drop offset as mentioned above and make base_ptr a void*, you can
save the cast.

> +
> +    for ( i = 0; i < vgic_v3_its_count(d); i++ )
> +    {
> +        fw_its = (struct acpi_madt_generic_translator *)
> +                    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 (offset + 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 3eb67f2..0392795 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);

... and here you could mimic the other calls then:
        table_len += gicv3_its_make_hwdom_madt(d, base_ptr + table_len);

(or directly return).

Cheers,
Andre.


>      return table_len;
>  }
>  
> diff --git a/xen/include/asm-arm/gic_v3_its.h 
> b/xen/include/asm-arm/gic_v3_its.h
> index 9cf18da..ae8a494 100644
> --- a/xen/include/asm-arm/gic_v3_its.h
> +++ b/xen/include/asm-arm/gic_v3_its.h
> @@ -137,6 +137,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, u8 *base_ptr,
> +                                        unsigned long offset);
>  #endif
>  
>  /* Deny iomem access for its */
> @@ -207,6 +209,12 @@ static inline void gicv3_its_dt_init(const struct 
> dt_device_node *node)
>  static inline void gicv3_its_acpi_init(void)
>  {
>  }
> +
> +unsigned long gicv3_its_make_hwdom_madt(struct domain *d, u8 *base_ptr,
> +                                        unsigned long offset)
> +{
> +    return 0;
> +}
>  #endif
>  
>  static inline int gicv3_its_deny_access(const struct domain *d)
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.