From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751238AbdEaV4N (ORCPT ); Wed, 31 May 2017 17:56:13 -0400 Received: from smtp2-g21.free.fr ([212.27.42.2]:42088 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbdEaV4J (ORCPT ); Wed, 31 May 2017 17:56:09 -0400 Subject: Re: [PATCH v4 1/2] PCI: Add tango MSI controller support To: Bjorn Helgaas , Marc Zyngier , Thomas Gleixner Cc: Lorenzo Pieralisi , linux-pci , Liviu Dudau , LKML , David Laight , Robin Murphy , Linux ARM , Marc Gonzalez References: <20170531173414.GB4496@bhelgaas-glaptop.roam.corp.google.com> <4885137f-7c1c-5742-4f66-f48c32ce7abb@free.fr> <20170531190037.GA18084@bhelgaas-glaptop.roam.corp.google.com> <20170531191258.GA18454@bhelgaas-glaptop.roam.corp.google.com> <74d6d867-313a-2304-9753-9739ad4703a8@free.fr> <20170531200424.GA23171@bhelgaas-glaptop.roam.corp.google.com> From: Mason Message-ID: <8bbdc8a4-98a5-ae13-ff0f-d644307986d5@free.fr> Date: Wed, 31 May 2017 23:55:37 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0 SeaMonkey/2.49 MIME-Version: 1.0 In-Reply-To: <20170531200424.GA23171@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/05/2017 22:04, Bjorn Helgaas wrote: > Cscope only sees 94 definitions of irq_set_affinity. I know *I* could > never write a script faster than looking at them manually. for F in $(find -name '*.c'); do if grep -q pci_msi_create_irq_domain $F; then grep 'irq_set_affinity\s*=' $F | cut -f2 -d= | tr -d ',;' | while read CALLBACK do Y=$(grep -A4 "$CALLBACK(struct" $F) echo $Y | grep static done fi done static int ls_scfg_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { return -EINVAL; } static int armada_370_xp_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { return -EINVAL; } static int armada_xp_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force) { irq_hw_number_t hwirq = irqd_to_hwirq(d); static int nwl_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { return -EINVAL; } static int hv_set_affinity(struct irq_data *data, const struct cpumask *dest, bool force) { struct irq_data *parent = data->parent_data; static int xgene_msi_set_affinity(struct irq_data *irqdata, const struct cpumask *mask, bool force) { int target_cpu = cpumask_first(mask); int curr_cpu; static int vmd_irq_set_affinity(struct irq_data *data, const struct cpumask *dest, bool force) { return -EINVAL; } static int altera_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { return -EINVAL; } static int advk_msi_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { return -EINVAL; } static int iproc_msi_irq_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force) { struct iproc_msi *msi = irq_data_get_irq_chip_data(data); > While doing that, I noticed irq_chip_set_affinity_parent(), which is > used in 14 cases and appears similar to your patch. Indeed. I suppose msi_domain_set_affinity() could look like below, if we don't mind changing EINVAL to ENOSYS. What do you think? diff --git a/kernel/irq/msi.c b/kernel/irq/msi.c index ddc2f5427f75..d37d2ba790df 100644 --- a/kernel/irq/msi.c +++ b/kernel/irq/msi.c @@ -87,11 +87,10 @@ static inline void irq_chip_write_msi_msg(struct irq_data *data, int msi_domain_set_affinity(struct irq_data *irq_data, const struct cpumask *mask, bool force) { - struct irq_data *parent = irq_data->parent_data; struct msi_msg msg; int ret; - ret = parent->chip->irq_set_affinity(parent, mask, force); + ret = irq_chip_set_affinity_parent(irq_data, mask, force); if (ret >= 0 && ret != IRQ_SET_MASK_OK_DONE) { BUG_ON(irq_chip_compose_msi_msg(irq_data, &msg)); irq_chip_write_msi_msg(irq_data, &msg);