Commit e9894248 authored by Thomas Gleixner's avatar Thomas Gleixner
parent ce44d1ff
This diff is collapsed.
...@@ -81,7 +81,6 @@ extern int pci_msi_ignore_mask; ...@@ -81,7 +81,6 @@ extern int pci_msi_ignore_mask;
/* Helper functions */ /* Helper functions */
struct msi_desc; struct msi_desc;
struct pci_dev; struct pci_dev;
struct platform_msi_priv_data;
struct device_attribute; struct device_attribute;
struct irq_domain; struct irq_domain;
struct irq_affinity_desc; struct irq_affinity_desc;
...@@ -231,14 +230,12 @@ struct msi_dev_domain { ...@@ -231,14 +230,12 @@ struct msi_dev_domain {
/** /**
* msi_device_data - MSI per device data * msi_device_data - MSI per device data
* @properties: MSI properties which are interesting to drivers * @properties: MSI properties which are interesting to drivers
* @platform_data: Platform-MSI specific data
* @mutex: Mutex protecting the MSI descriptor store * @mutex: Mutex protecting the MSI descriptor store
* @__domains: Internal data for per device MSI domains * @__domains: Internal data for per device MSI domains
* @__iter_idx: Index to search the next entry for iterators * @__iter_idx: Index to search the next entry for iterators
*/ */
struct msi_device_data { struct msi_device_data {
unsigned long properties; unsigned long properties;
struct platform_msi_priv_data *platform_data;
struct mutex mutex; struct mutex mutex;
struct msi_dev_domain __domains[MSI_MAX_DEVICE_IRQDOMAINS]; struct msi_dev_domain __domains[MSI_MAX_DEVICE_IRQDOMAINS];
unsigned long __iter_idx; unsigned long __iter_idx;
...@@ -641,33 +638,6 @@ void msi_domain_free_irqs_all(struct device *dev, unsigned int domid); ...@@ -641,33 +638,6 @@ void msi_domain_free_irqs_all(struct device *dev, unsigned int domid);
struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain); struct msi_domain_info *msi_get_domain_info(struct irq_domain *domain);
struct irq_domain *platform_msi_create_irq_domain(struct fwnode_handle *fwnode,
struct msi_domain_info *info,
struct irq_domain *parent);
/* When an MSI domain is used as an intermediate domain */
int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
int nvec, msi_alloc_info_t *args);
int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
int virq, int nvec, msi_alloc_info_t *args);
void msi_domain_depopulate_descs(struct device *dev, int virq, int nvec);
struct irq_domain *
__platform_msi_create_device_domain(struct device *dev,
unsigned int nvec,
bool is_tree,
irq_write_msi_msg_t write_msi_msg,
const struct irq_domain_ops *ops,
void *host_data);
#define platform_msi_create_device_tree_domain(dev, nvec, write, ops, data) \
__platform_msi_create_device_domain(dev, nvec, true, write, ops, data)
int platform_msi_device_domain_alloc(struct irq_domain *domain, unsigned int virq,
unsigned int nr_irqs);
void platform_msi_device_domain_free(struct irq_domain *domain, unsigned int virq,
unsigned int nvec);
void *platform_msi_get_host_data(struct irq_domain *domain);
/* Per device platform MSI */ /* Per device platform MSI */
int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nvec, int platform_device_msi_init_and_alloc_irqs(struct device *dev, unsigned int nvec,
irq_write_msi_msg_t write_msi_msg); irq_write_msi_msg_t write_msi_msg);
......
...@@ -1088,7 +1088,7 @@ bool msi_match_device_irq_domain(struct device *dev, unsigned int domid, ...@@ -1088,7 +1088,7 @@ bool msi_match_device_irq_domain(struct device *dev, unsigned int domid,
return ret; return ret;
} }
int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev, static int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
int nvec, msi_alloc_info_t *arg) int nvec, msi_alloc_info_t *arg)
{ {
struct msi_domain_info *info = domain->host_data; struct msi_domain_info *info = domain->host_data;
...@@ -1097,77 +1097,6 @@ int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev, ...@@ -1097,77 +1097,6 @@ int msi_domain_prepare_irqs(struct irq_domain *domain, struct device *dev,
return ops->msi_prepare(domain, dev, nvec, arg); return ops->msi_prepare(domain, dev, nvec, arg);
} }
int msi_domain_populate_irqs(struct irq_domain *domain, struct device *dev,
int virq_base, int nvec, msi_alloc_info_t *arg)
{
struct msi_domain_info *info = domain->host_data;
struct msi_domain_ops *ops = info->ops;
struct msi_ctrl ctrl = {
.domid = MSI_DEFAULT_DOMAIN,
.first = virq_base,
.last = virq_base + nvec - 1,
};
struct msi_desc *desc;
struct xarray *xa;
int ret, virq;
msi_lock_descs(dev);
if (!msi_ctrl_valid(dev, &ctrl)) {
ret = -EINVAL;
goto unlock;
}
ret = msi_domain_add_simple_msi_descs(dev, &ctrl);
if (ret)
goto unlock;
xa = &dev->msi.data->__domains[ctrl.domid].store;
for (virq = virq_base; virq < virq_base + nvec; virq++) {
desc = xa_load(xa, virq);
desc->irq = virq;
ops->set_desc(arg, desc);
ret = irq_domain_alloc_irqs_hierarchy(domain, virq, 1, arg);
if (ret)
goto fail;
irq_set_msi_desc(virq, desc);
}
msi_unlock_descs(dev);
return 0;
fail:
for (--virq; virq >= virq_base; virq--) {
msi_domain_depopulate_descs(dev, virq, 1);
irq_domain_free_irqs_common(domain, virq, 1);
}
msi_domain_free_descs(dev, &ctrl);
unlock:
msi_unlock_descs(dev);
return ret;
}
void msi_domain_depopulate_descs(struct device *dev, int virq_base, int nvec)
{
struct msi_ctrl ctrl = {
.domid = MSI_DEFAULT_DOMAIN,
.first = virq_base,
.last = virq_base + nvec - 1,
};
struct msi_desc *desc;
struct xarray *xa;
unsigned long idx;
if (!msi_ctrl_valid(dev, &ctrl))
return;
xa = &dev->msi.data->__domains[ctrl.domid].store;
xa_for_each_range(xa, idx, desc, ctrl.first, ctrl.last)
desc->irq = 0;
}
/* /*
* Carefully check whether the device can use reservation mode. If * Carefully check whether the device can use reservation mode. If
* reservation mode is enabled then the early activation will assign a * reservation mode is enabled then the early activation will assign a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment