Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1261403 > unrolled thread
| Started by | Qais Yousef <qais.yousef@imgtec.com> |
|---|---|
| First post | 2015-11-03 12:20 +0100 |
| Last post | 2015-11-07 13:20 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers Qais Yousef <qais.yousef@imgtec.com> - 2015-11-03 12:20 +0100
Re: [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers kbuild test robot <lkp@intel.com> - 2015-11-03 13:10 +0100
Re: [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers Thomas Gleixner <tglx@linutronix.de> - 2015-11-07 13:20 +0100
| From | Qais Yousef <qais.yousef@imgtec.com> |
|---|---|
| Date | 2015-11-03 12:20 +0100 |
| Subject | [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers |
| Message-ID | <qqHN7-1ZB-9@gated-at.bofh.it> |
There are 2 variants. __irq_desc_send_ipi() is meant to be used by arch code to
save the desc lookup when doing SMP IPIs.
irq_send_ipi() is meant for drivers that want to send IPIs to coprocessors they
interact with.
Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
---
include/linux/irq.h | 3 +++
kernel/irq/manage.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 69 insertions(+), 1 deletion(-)
diff --git a/include/linux/irq.h b/include/linux/irq.h
index 3b2f448b7ac3..680bee078879 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -1032,4 +1032,7 @@ int irq_map_ipi(struct ipi_mapping *map,
int irq_unmap_ipi(struct ipi_mapping *map,
unsigned int cpu, irq_hw_number_t *hwirq);
+int __irq_desc_send_ipi(struct irq_desc *desc, const struct ipi_mask *dest);
+int irq_send_ipi(unsigned int virq, const struct ipi_mask *dest);
+
#endif /* _LINUX_IRQ_H */
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 67a71667a359..4bdf6df95b45 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -2013,7 +2013,6 @@ EXPORT_SYMBOL_GPL(irq_set_irqchip_state);
struct ipi_mapping *irq_alloc_ipi_mapping(unsigned int nr_cpus)
{
struct ipi_mapping *map;
- int i;
map = kzalloc(sizeof(struct ipi_mapping) +
BITS_TO_LONGS(nr_cpus), GFP_KERNEL);
@@ -2087,3 +2086,69 @@ int irq_unmap_ipi(struct ipi_mapping *map,
return 0;
}
+
+/**
+ * __irq_desc_send_ipi - send an IPI to target CPU(s)
+ * @irq_desc: pointer to irq_desc of the IRQ
+ * @dest: dest CPU(s), must be the same or a subset of the mask passed to
+ * irq_reserve_ipi()
+ *
+ * Sends an IPI to all cpus in dest mask.
+ * This function is meant to be used from arch code to save the need to do
+ * desc lookup that happens in the generic irq_send_ipi().
+ *
+ * Returns zero on success and negative error number on failure.
+ */
+int __irq_desc_send_ipi(struct irq_desc *desc, const struct ipi_mask *dest)
+{
+ struct irq_data *data = irq_desc_get_irq_data(desc);
+ struct irq_chip *chip = irq_data_get_irq_chip(data);
+
+ if (!chip || !chip->irq_send_ipi)
+ return -EINVAL;
+
+ if (dest->nbits > data->common->ipi_mask->nbits)
+ return -EINVAL;
+
+ /*
+ * Do not validate the mask for IPIs marked global. These are
+ * regular IPIs so we can avoid the operation as their target
+ * mask is the cpu_possible_mask.
+ */
+ if (!data->common->ipi_mask->global) {
+ if (dest->global)
+ return -EINVAL;
+
+ if (!bitmap_subset(dest->cpu_bitmap,
+ data->common->ipi_mask->cpu_bitmap,
+ dest->nbits))
+ return -EINVAL;
+ } else {
+ if (!dest->global)
+ return -EINVAL;
+ }
+
+ chip->irq_send_ipi(data, dest);
+ return 0;
+}
+
+/**
+ * irq_send_ipi - send an IPI to target CPU(s)
+ * @irq: linux irq number from irq_reserve_ipi()
+ * @dest: dest CPU(s), must be the same or a subset of the mask passed to
+ * irq_reserve_ipi()
+ *
+ * Sends an IPI to all cpus in dest mask.
+ *
+ * Returns zero on success and negative error number on failure.
+ */
+int irq_send_ipi(unsigned int virq, const struct ipi_mask *dest)
+{
+ struct irq_desc *desc = irq_to_desc(virq);
+
+ if (!desc)
+ return -EINVAL;
+
+ return __irq_desc_send_ipi(desc, dest);
+}
+EXPORT_SYMBOL_GPL(irq_send_ipi);
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | kbuild test robot <lkp@intel.com> |
|---|---|
| Date | 2015-11-03 13:10 +0100 |
| Subject | Re: [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers |
| Message-ID | <qqIzw-2w3-7@gated-at.bofh.it> |
| In reply to | #1261403 |
[Multipart message — attachments visible in raw view] — view raw
Hi Qais,
[auto build test WARNING on tip/irq/core -- if it's inappropriate base, please suggest rules for selecting the more suitable base]
url: https://github.com/0day-ci/linux/commits/Qais-Yousef/Implement-generic-IPI-support-mechanism/20151103-192028
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
include/linux/irq.h:168: warning: No description found for parameter 'ipi_mask'
>> kernel/irq/manage.c:2103: warning: No description found for parameter 'desc'
>> kernel/irq/manage.c:2103: warning: Excess function parameter 'irq_desc' description in '__irq_desc_send_ipi'
kernel/irq/manage.c:2146: warning: No description found for parameter 'virq'
kernel/irq/manage.c:2146: warning: Excess function parameter 'irq' description in 'irq_send_ipi'
kernel/irq/handle.c:1: warning: no structured comments found
--
lib/crc32.c:148: warning: No description found for parameter 'tab)[256]'
lib/crc32.c:148: warning: Excess function parameter 'tab' description in 'crc32_le_generic'
lib/crc32.c:293: warning: No description found for parameter 'tab)[256]'
lib/crc32.c:293: warning: Excess function parameter 'tab' description in 'crc32_be_generic'
lib/crc32.c:1: warning: no structured comments found
>> kernel/irq/manage.c:2103: warning: No description found for parameter 'desc'
>> kernel/irq/manage.c:2103: warning: Excess function parameter 'irq_desc' description in '__irq_desc_send_ipi'
kernel/irq/manage.c:2146: warning: No description found for parameter 'virq'
kernel/irq/manage.c:2146: warning: Excess function parameter 'irq' description in 'irq_send_ipi'
block/blk-core.c:1549: warning: No description found for parameter 'same_queue_rq'
block/blk-core.c:1549: warning: No description found for parameter 'same_queue_rq'
vim +/desc +2103 kernel/irq/manage.c
2087 return 0;
2088 }
2089
2090 /**
2091 * __irq_desc_send_ipi - send an IPI to target CPU(s)
2092 * @irq_desc: pointer to irq_desc of the IRQ
2093 * @dest: dest CPU(s), must be the same or a subset of the mask passed to
2094 * irq_reserve_ipi()
2095 *
2096 * Sends an IPI to all cpus in dest mask.
2097 * This function is meant to be used from arch code to save the need to do
2098 * desc lookup that happens in the generic irq_send_ipi().
2099 *
2100 * Returns zero on success and negative error number on failure.
2101 */
2102 int __irq_desc_send_ipi(struct irq_desc *desc, const struct ipi_mask *dest)
> 2103 {
2104 struct irq_data *data = irq_desc_get_irq_data(desc);
2105 struct irq_chip *chip = irq_data_get_irq_chip(data);
2106
2107 if (!chip || !chip->irq_send_ipi)
2108 return -EINVAL;
2109
2110 if (dest->nbits > data->common->ipi_mask->nbits)
2111 return -EINVAL;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[toc] | [prev] | [next] | [standalone]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-11-07 13:20 +0100 |
| Subject | Re: [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers |
| Message-ID | <qsaDn-29u-11@gated-at.bofh.it> |
| In reply to | #1261403 |
On Tue, 3 Nov 2015, Qais Yousef wrote:
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -2013,7 +2013,6 @@ EXPORT_SYMBOL_GPL(irq_set_irqchip_state);
> struct ipi_mapping *irq_alloc_ipi_mapping(unsigned int nr_cpus)
> {
> struct ipi_mapping *map;
> - int i;
That one wants to be folded back into the patch which adds it.
> +
> +/**
> + * __irq_desc_send_ipi - send an IPI to target CPU(s)
> + * @irq_desc: pointer to irq_desc of the IRQ
> + * @dest: dest CPU(s), must be the same or a subset of the mask passed to
> + * irq_reserve_ipi()
> + *
> + * Sends an IPI to all cpus in dest mask.
> + * This function is meant to be used from arch code to save the need to do
> + * desc lookup that happens in the generic irq_send_ipi().
> + *
> + * Returns zero on success and negative error number on failure.
> + */
> +int __irq_desc_send_ipi(struct irq_desc *desc, const struct ipi_mask *dest)
> +{
> + struct irq_data *data = irq_desc_get_irq_data(desc);
> + struct irq_chip *chip = irq_data_get_irq_chip(data);
> +
> + if (!chip || !chip->irq_send_ipi)
> + return -EINVAL;
> +
> + if (dest->nbits > data->common->ipi_mask->nbits)
> + return -EINVAL;
> +
> + /*
> + * Do not validate the mask for IPIs marked global. These are
> + * regular IPIs so we can avoid the operation as their target
> + * mask is the cpu_possible_mask.
> + */
> + if (!data->common->ipi_mask->global) {
> + if (dest->global)
> + return -EINVAL;
> +
> + if (!bitmap_subset(dest->cpu_bitmap,
> + data->common->ipi_mask->cpu_bitmap,
> + dest->nbits))
> + return -EINVAL;
> + } else {
> + if (!dest->global)
> + return -EINVAL;
We might want to add sanity checks here as well, but you can leave it
as is for now.
This can move to ipi.c as well.
Thanks,
tglx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web