[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [patch 02/10] genirq/msi: Add range argument to msi_domain_alloc/free_descs_locked()
In preparation for supporting range allocations for MSI-X, add a range argument to the msi_domain_alloc/free_descs_locked() functions and fixup all affected places. Hand in ranges which are covering the current use case. They will be refined in later steps. Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx> --- drivers/pci/msi/irqdomain.c | 6 ++++-- include/linux/msi.h | 5 ++--- kernel/irq/msi.c | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 14 deletions(-) --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -10,22 +10,24 @@ int pci_msi_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) { + struct msi_range range = { .first = 0, .last = UINT_MAX, .ndesc = nvec}; struct irq_domain *domain; domain = dev_get_msi_domain(&dev->dev); if (domain && irq_domain_is_hierarchy(domain)) - return msi_domain_alloc_irqs_descs_locked(domain, &dev->dev, nvec); + return msi_domain_alloc_irqs_descs_locked(domain, &dev->dev, &range); return pci_msi_legacy_setup_msi_irqs(dev, nvec, type); } void pci_msi_teardown_msi_irqs(struct pci_dev *dev) { + struct msi_range range = { .first = 0, .last = UINT_MAX, }; struct irq_domain *domain; domain = dev_get_msi_domain(&dev->dev); if (domain && irq_domain_is_hierarchy(domain)) - msi_domain_free_irqs_descs_locked(domain, &dev->dev); + msi_domain_free_irqs_descs_locked(domain, &dev->dev, &range); else pci_msi_legacy_teardown_msi_irqs(dev); } --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -502,12 +502,11 @@ struct irq_domain *msi_create_irq_domain struct msi_domain_info *info, struct irq_domain *parent); int __msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, struct msi_range *range); -int msi_domain_alloc_irqs_descs_locked(struct irq_domain *domain, struct device *dev, - int nvec); +int msi_domain_alloc_irqs_descs_locked(struct irq_domain *domain, struct device *dev, struct msi_range *range); int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, int nvec); void __msi_domain_free_irqs(struct irq_domain *domain, struct device *dev, struct msi_range *range); -void msi_domain_free_irqs_descs_locked(struct irq_domain *domain, struct device *dev); +void msi_domain_free_irqs_descs_locked(struct irq_domain *domain, struct device *dev, struct msi_range *range); void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev); struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain); --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -956,22 +956,21 @@ static int msi_domain_add_simple_msi_des * Return: %0 on success or an error code. */ int msi_domain_alloc_irqs_descs_locked(struct irq_domain *domain, struct device *dev, - int nvec) + struct msi_range *range) { struct msi_domain_info *info = domain->host_data; - struct msi_range range = { .ndesc = nvec }; struct msi_domain_ops *ops = info->ops; int ret; lockdep_assert_held(&dev->msi.data->mutex); - ret = msi_domain_add_simple_msi_descs(info, dev, nvec); + ret = msi_domain_add_simple_msi_descs(info, dev, range->ndesc); if (ret) return ret; - ret = ops->domain_alloc_irqs(domain, dev, &range); + ret = ops->domain_alloc_irqs(domain, dev, range); if (ret) - msi_domain_free_irqs_descs_locked(domain, dev); + msi_domain_free_irqs_descs_locked(domain, dev, range); return ret; } @@ -986,10 +985,11 @@ int msi_domain_alloc_irqs_descs_locked(s */ int msi_domain_alloc_irqs(struct irq_domain *domain, struct device *dev, int nvec) { + struct msi_range range = { .first = 0, .last = UINT_MAX, .ndesc = nvec, }; int ret; msi_lock_descs(dev); - ret = msi_domain_alloc_irqs_descs_locked(domain, dev, nvec); + ret = msi_domain_alloc_irqs_descs_locked(domain, dev, &range); msi_unlock_descs(dev); return ret; } @@ -1034,14 +1034,15 @@ static void msi_domain_free_msi_descs(st * pair. Use this for MSI irqdomains which implement their own vector * allocation. */ -void msi_domain_free_irqs_descs_locked(struct irq_domain *domain, struct device *dev) +void msi_domain_free_irqs_descs_locked(struct irq_domain *domain, struct device *dev, + struct msi_range *range) { struct msi_domain_info *info = domain->host_data; struct msi_domain_ops *ops = info->ops; lockdep_assert_held(&dev->msi.data->mutex); - ops->domain_free_irqs(domain, dev, NULL); + ops->domain_free_irqs(domain, dev, range); msi_domain_free_msi_descs(info, dev); } @@ -1053,8 +1054,10 @@ void msi_domain_free_irqs_descs_locked(s */ void msi_domain_free_irqs(struct irq_domain *domain, struct device *dev) { + struct msi_range range = { .first = 0, .last = UINT_MAX, }; + msi_lock_descs(dev); - msi_domain_free_irqs_descs_locked(domain, dev); + msi_domain_free_irqs_descs_locked(domain, dev, &range); msi_unlock_descs(dev); }
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |