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

Re: [Xen-devel] [RFC PATCH 3/23] VIOMMU: Add irq request callback to deal with irq remapping



On Fri, Mar 17, 2017 at 07:27:03PM +0800, Lan Tianyu wrote:
> This patch is to add irq request callback for platform implementation
> to deal with irq remapping request.
> 
> Signed-off-by: Lan Tianyu <tianyu.lan@xxxxxxxxx>
> ---
>  xen/common/viommu.c          | 11 +++++++++++
>  xen/include/asm-arm/viommu.h |  4 ++++
>  xen/include/asm-x86/viommu.h | 15 +++++++++++++++
>  xen/include/xen/viommu.h     |  8 ++++++++
>  4 files changed, 38 insertions(+)
> 
> diff --git a/xen/common/viommu.c b/xen/common/viommu.c
> index 4c1c788..62c66db 100644
> --- a/xen/common/viommu.c
> +++ b/xen/common/viommu.c
> @@ -87,6 +87,17 @@ u64 viommu_query_caps(struct domain *d)
>      return info->ops->query_caps(d);
>  }
>  
> +int viommu_handle_irq_request(struct domain *d,
> +        struct irq_remapping_request *request)
> +{
> +    struct viommu_info *info = &d->viommu;
> +
> +    if ( !info || !info->ops || !info->ops->handle_irq_request)

You are missing an space at the end.
> +        return -EINVAL;
> +
> +    return info->ops->handle_irq_request(d, request);
> +}
> +
>  /*
>   * Local variables:
>   * mode: C
> diff --git a/xen/include/asm-arm/viommu.h b/xen/include/asm-arm/viommu.h
> index ef6a60b..6a81ecb 100644
> --- a/xen/include/asm-arm/viommu.h
> +++ b/xen/include/asm-arm/viommu.h
> @@ -22,6 +22,10 @@
>  
>  #include <xen/viommu.h>
>  
> +struct irq_remapping_request
> +{
> +};
> +
>  static inline const struct viommu_ops *viommu_get_ops(void)
>  {
>      return NULL;
> diff --git a/xen/include/asm-x86/viommu.h b/xen/include/asm-x86/viommu.h
> index efb435f..b6e01a5 100644
> --- a/xen/include/asm-x86/viommu.h
> +++ b/xen/include/asm-x86/viommu.h
> @@ -23,6 +23,21 @@
>  #include <xen/viommu.h>
>  #include <asm/types.h>
>  
> +struct irq_remapping_request
> +{
> +    u8 type;
> +    u16 source_id;
> +    union {
> +        /* MSI */
> +        struct {
> +            u64 addr;
> +            u32 data;
> +        } msi;
> +        /* Redirection Entry in IOAPIC */
> +        u64 rte;
> +    } msg;
> +};

Will this work right? As in with the default padding and such?
> +
>  static inline const struct viommu_ops *viommu_get_ops(void)
>  {
>      return NULL;
> diff --git a/xen/include/xen/viommu.h b/xen/include/xen/viommu.h
> index a0abbdf..246b29d 100644
> --- a/xen/include/xen/viommu.h
> +++ b/xen/include/xen/viommu.h
> @@ -24,6 +24,10 @@
>  
>  #define NR_VIOMMU_PER_DOMAIN 1
>  
> +/* IRQ request type */
> +#define VIOMMU_REQUEST_IRQ_MSI          0
> +#define VIOMMU_REQUEST_IRQ_APIC         1

What is this used for?
> +
>  struct viommu {
>      u64 base_address;
>      u64 length;
> @@ -36,6 +40,8 @@ struct viommu_ops {
>      u64 (*query_caps)(struct domain *d);
>      int (*create)(struct domain *d, struct viommu *viommu);
>      int (*destroy)(struct viommu *viommu);
> +    int (*handle_irq_request)(struct domain *d,
> +                              struct irq_remapping_request *request);
>  };
>  
>  struct viommu_info {
> @@ -48,6 +54,8 @@ int viommu_init_domain(struct domain *d);
>  int viommu_create(struct domain *d, u64 base_address, u64 length, u64 caps);
>  int viommu_destroy(struct domain *d, u32 viommu_id);
>  u64 viommu_query_caps(struct domain *d);
> +int viommu_handle_irq_request(struct domain *d,
> +                              struct irq_remapping_request *request);
>  
>  #endif /* __XEN_VIOMMU_H__ */
>  
> -- 
> 1.8.3.1
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> https://lists.xen.org/xen-devel

_______________________________________________
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®.