From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753101AbbKGMPp (ORCPT ); Sat, 7 Nov 2015 07:15:45 -0500 Received: from www.linutronix.de ([62.245.132.108]:35220 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751378AbbKGMPl (ORCPT ); Sat, 7 Nov 2015 07:15:41 -0500 Date: Sat, 7 Nov 2015 13:14:57 +0100 (CET) From: Thomas Gleixner To: Qais Yousef cc: linux-kernel@vger.kernel.org, jason@lakedaemon.net, marc.zyngier@arm.com, jiang.liu@linux.intel.com, ralf@linux-mips.org, linux-mips@linux-mips.org Subject: Re: [PATCH 09/14] genirq: Implement irq_send_ipi() to be used by drivers In-Reply-To: <1446549181-31788-10-git-send-email-qais.yousef@imgtec.com> Message-ID: References: <1446549181-31788-1-git-send-email-qais.yousef@imgtec.com> <1446549181-31788-10-git-send-email-qais.yousef@imgtec.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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