Re: [PATCH v6 1/2] genirq/msi: add wrapper msi allocation API and export msi functions

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

 



On Tue, 23 Apr 2024 16:40:20 +0530
Nipun Gupta <nipun.gupta@xxxxxxx> wrote:

> SI functions for allocation and free can be directly used by

We lost the ^M in this version.

> the device drivers without any wrapper provided by bus drivers.
> So export these MSI functions.
> 
> Also, add a wrapper API to allocate MSIs providing only the 
> number of interrupts rather than range for simpler driver usage.
> 
> Signed-off-by: Nipun Gupta <nipun.gupta@xxxxxxx>
> Reviewed-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> ---
> 
> No change in v5->v6
> 
> Changes in v4->v5:
> - updated commit description as per the comments.

I see in https://lore.kernel.org/all/87edbyfj0d.ffs@tglx/ that Thomas
also suggested a new subject:

    genirq/msi: Add MSI allocation helper and export MSI functions

I'll address both of these on commit if there are no objections or
further comments.  Patch 2/ looks ok to me now as well.  Thanks,

Alex

> - Rebased on 6.9-rc1
> 
> Changes in v3->v4:
> - No change
> 
> Changes in v3: 
> - New in this patch series. VFIO-CDX uses the new wrapper API 
>   msi_domain_alloc_irqs and exported APIs. (This patch is moved
>   from CDX interrupt support to vfio-cdx patch, where these APIs
>   are used).
> 
>  include/linux/msi.h | 6 ++++++
>  kernel/irq/msi.c    | 2 ++
>  2 files changed, 8 insertions(+)
> 
> diff --git a/include/linux/msi.h b/include/linux/msi.h
> index 84859a9aa091..dc27cf3903d5 100644
> --- a/include/linux/msi.h
> +++ b/include/linux/msi.h
> @@ -674,6 +674,12 @@ int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nve
>  void platform_device_msi_free_irqs_all(struct device *dev);
>  
>  bool msi_device_has_isolated_msi(struct device *dev);
> +
> +static inline int msi_domain_alloc_irqs(struct device *dev, unsigned int domid, int nirqs)
> +{
> +	return msi_domain_alloc_irqs_range(dev, domid, 0, nirqs - 1);
> +}
> +
>  #else /* CONFIG_GENERIC_MSI_IRQ */
>  static inline bool msi_device_has_isolated_msi(struct device *dev)
>  {
> diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c
> index f90952ebc494..2024f89baea4 100644
> --- a/kernel/irq/msi.c
> +++ b/kernel/irq/msi.c
> @@ -1434,6 +1434,7 @@ int msi_domain_alloc_irqs_range(struct device *dev, unsigned int domid,
>  	msi_unlock_descs(dev);
>  	return ret;
>  }
> +EXPORT_SYMBOL_GPL(msi_domain_alloc_irqs_range);
>  
>  /**
>   * msi_domain_alloc_irqs_all_locked - Allocate all interrupts from a MSI interrupt domain
> @@ -1680,6 +1681,7 @@ void msi_domain_free_irqs_range(struct device *dev, unsigned int domid,
>  	msi_domain_free_irqs_range_locked(dev, domid, first, last);
>  	msi_unlock_descs(dev);
>  }
> +EXPORT_SYMBOL_GPL(msi_domain_free_irqs_all);
>  
>  /**
>   * msi_domain_free_irqs_all_locked - Free all interrupts from a MSI interrupt domain





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux