Message ID | 1603800624-180488-3-git-send-email-john.garry@huawei.com |
---|---|
State | Superseded |
Headers | show |
Series | Support managed interrupts for platform devices | expand |
Hi John, I love your patch! Perhaps something to improve: [auto build test WARNING on mkp-scsi/for-next] [also build test WARNING on scsi/for-next tip/irq/core driver-core/driver-core-testing linus/master v5.10-rc1 next-20201029] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/John-Garry/Support-managed-interrupts-for-platform-devices/20201027-201557 base: https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next config: h8300-randconfig-r025-20201029 (attached as .config) compiler: h8300-linux-gcc (GCC) 9.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/0day-ci/linux/commit/8675e033c5fd8a87c202e2bc74834122f010adc5 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review John-Garry/Support-managed-interrupts-for-platform-devices/20201027-201557 git checkout 8675e033c5fd8a87c202e2bc74834122f010adc5 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from include/linux/mfd/core.h:13, from drivers/mfd/88pm800.c:27: >> include/linux/irqchip.h:31:42: warning: 'struct platform_device' declared inside parameter list will not be visible outside of this definition or declaration 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~ -- In file included from include/linux/irqchip.h:17, from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from drivers/mfd/tps65217.c:21: >> include/linux/platform_device.h:75:18: warning: 'struct irq_affinity' declared inside parameter list will not be visible outside of this definition or declaration 75 | struct irq_affinity *affd, | ^~~~~~~~~~~~ In file included from include/linux/dev_printk.h:14, from include/linux/device.h:15, from drivers/mfd/tps65217.c:18: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra] 93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ -- In file included from include/linux/irqchip.h:17, from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from drivers/mfd/max77650.c:10: >> include/linux/platform_device.h:75:18: warning: 'struct irq_affinity' declared inside parameter list will not be visible outside of this definition or declaration 75 | struct irq_affinity *affd, | ^~~~~~~~~~~~ -- In file included from include/linux/kernel.h:11, from include/linux/list.h:9, from include/linux/module.h:12, from drivers/mfd/si476x-prop.c:11: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra] 93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from include/linux/mfd/core.h:13, from include/linux/mfd/si476x-core.h:20, from drivers/mfd/si476x-prop.c:13: include/linux/irqchip.h: At top level: >> include/linux/irqchip.h:31:42: warning: 'struct platform_device' declared inside parameter list will not be visible outside of this definition or declaration 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~ -- In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from include/linux/of_device.h:6, from drivers/irqchip/irqchip.c:13: >> include/linux/irqchip.h:31:42: warning: 'struct platform_device' declared inside parameter list will not be visible outside of this definition or declaration 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~ drivers/irqchip/irqchip.c:35:5: error: conflicting types for 'platform_irqchip_probe' 35 | int platform_irqchip_probe(struct platform_device *pdev) | ^~~~~~~~~~~~~~~~~~~~~~ In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from include/linux/of_device.h:6, from drivers/irqchip/irqchip.c:13: include/linux/irqchip.h:31:12: note: previous declaration of 'platform_irqchip_probe' was here 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~~~~~~~~ In file included from include/linux/linkage.h:7, from include/linux/kernel.h:8, from include/linux/list.h:9, from include/linux/kobject.h:19, from include/linux/of.h:17, from include/linux/irqdomain.h:35, from include/linux/acpi.h:13, from drivers/irqchip/irqchip.c:11: drivers/irqchip/irqchip.c:60:19: error: conflicting types for 'platform_irqchip_probe' 60 | EXPORT_SYMBOL_GPL(platform_irqchip_probe); | ^~~~~~~~~~~~~~~~~~~~~~ include/linux/export.h:98:21: note: in definition of macro '___EXPORT_SYMBOL' 98 | extern typeof(sym) sym; \ | ^~~ include/linux/export.h:155:34: note: in expansion of macro '__EXPORT_SYMBOL' 155 | #define _EXPORT_SYMBOL(sym, sec) __EXPORT_SYMBOL(sym, sec, "") | ^~~~~~~~~~~~~~~ include/linux/export.h:159:33: note: in expansion of macro '_EXPORT_SYMBOL' 159 | #define EXPORT_SYMBOL_GPL(sym) _EXPORT_SYMBOL(sym, "_gpl") | ^~~~~~~~~~~~~~ drivers/irqchip/irqchip.c:60:1: note: in expansion of macro 'EXPORT_SYMBOL_GPL' 60 | EXPORT_SYMBOL_GPL(platform_irqchip_probe); | ^~~~~~~~~~~~~~~~~ In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from include/linux/of_device.h:6, from drivers/irqchip/irqchip.c:13: include/linux/irqchip.h:31:12: note: previous declaration of 'platform_irqchip_probe' was here 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~~~~~~~~ -- In file included from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/platform_device.h:14, from drivers/mfd/sm501.c:17: >> include/linux/irqchip.h:31:42: warning: 'struct platform_device' declared inside parameter list will not be visible outside of this definition or declaration 31 | extern int platform_irqchip_probe(struct platform_device *pdev); | ^~~~~~~~~~~~~~~ In file included from include/linux/kernel.h:11, from drivers/mfd/sm501.c:11: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra] 93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ -- In file included from include/linux/dev_printk.h:14, from include/linux/device.h:15, from include/linux/spi/spi.h:9, from drivers/mfd/stmpe-spi.c:10: include/linux/scatterlist.h: In function 'sg_set_buf': include/asm-generic/page.h:93:50: warning: ordered comparison of pointer with null pointer [-Wextra] 93 | #define virt_addr_valid(kaddr) (((void *)(kaddr) >= (void *)PAGE_OFFSET) && \ | ^~ include/linux/compiler.h:78:42: note: in definition of macro 'unlikely' 78 | # define unlikely(x) __builtin_expect(!!(x), 0) | ^ include/linux/scatterlist.h:143:2: note: in expansion of macro 'BUG_ON' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~ include/linux/scatterlist.h:143:10: note: in expansion of macro 'virt_addr_valid' 143 | BUG_ON(!virt_addr_valid(buf)); | ^~~~~~~~~~~~~~~ In file included from include/linux/irqchip.h:17, from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from drivers/mfd/stmpe-spi.c:11: include/linux/platform_device.h: At top level: >> include/linux/platform_device.h:75:18: warning: 'struct irq_affinity' declared inside parameter list will not be visible outside of this definition or declaration 75 | struct irq_affinity *affd, | ^~~~~~~~~~~~ -- In file included from include/linux/irqchip.h:17, from arch/h8300/include/asm/irq.h:5, from include/linux/irq.h:23, from include/asm-generic/hardirq.h:13, from ./arch/h8300/include/generated/asm/hardirq.h:1, from include/linux/hardirq.h:10, from include/linux/interrupt.h:11, from include/linux/kernel_stat.h:9, from arch/h8300/kernel/asm-offsets.c:14: >> include/linux/platform_device.h:75:18: warning: 'struct irq_affinity' declared inside parameter list will not be visible outside of this definition or declaration 75 | struct irq_affinity *affd, | ^~~~~~~~~~~~ <stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp] vim +31 include/linux/irqchip.h 91e20b5040c67c5 Joel Porquet 2015-07-02 30 f8410e626569324 Saravana Kannan 2020-07-17 @31 extern int platform_irqchip_probe(struct platform_device *pdev); f8410e626569324 Saravana Kannan 2020-07-17 32 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 88aef93eb4dd..c110b35469d6 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -269,6 +269,64 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) } EXPORT_SYMBOL_GPL(platform_get_irq); +/** + * platform_get_irqs_affinity - get all IRQs for a device using an affinity + * descriptor + * @dev: platform device pointer + * @affd: affinity descriptor, must be set + * @count: pointer to count of IRQS + * @irqs: pointer holder for IRQ numbers + * + * Gets a full set of IRQs for a platform device, and updates IRQ afffinty + * according to the passed affinity descriptor + * + * Return: 0 on success, negative error number on failure. + */ +int platform_get_irqs_affinity(struct platform_device *dev, + struct irq_affinity *affd, + unsigned int *count, + int **irqs) +{ + struct irq_affinity_desc *desc; + int i, *pirqs; + + if (!affd) + return -EPERM; + + *count = platform_irq_count(dev); + + if (*count <= affd->pre_vectors + affd->post_vectors) + return -EIO; + + pirqs = kcalloc(*count, sizeof(int), GFP_KERNEL); + if (!pirqs) + return -ENOMEM; + + for (i = 0; i < *count; i++) { + int irq = platform_get_irq(dev, i); + if (irq < 0) { + kfree(pirqs); + return irq; + } + pirqs[i] = irq; + } + + desc = irq_create_affinity_masks(*count, affd); + if (!desc) { + kfree(pirqs); + return -ENOMEM; + } + + for (i = 0; i < *count; i++) + irq_update_affinity_desc(pirqs[i], &desc[i]); + + kfree(desc); + *irqs = pirqs; + + return 0; +} +EXPORT_SYMBOL_GPL(platform_get_irqs_affinity); + /** * platform_irq_count - Count the number of IRQs a platform device uses * @dev: platform device diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 77a2aada106d..c3f4fc5a76b9 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -11,6 +11,7 @@ #define _PLATFORM_DEVICE_H_ #include <linux/device.h> +#include <linux/interrupt.h> #define PLATFORM_DEVID_NONE (-1) #define PLATFORM_DEVID_AUTO (-2) @@ -70,6 +71,10 @@ devm_platform_ioremap_resource_byname(struct platform_device *pdev, extern int platform_get_irq(struct platform_device *, unsigned int); extern int platform_get_irq_optional(struct platform_device *, unsigned int); extern int platform_irq_count(struct platform_device *); +extern int platform_get_irqs_affinity(struct platform_device *dev, + struct irq_affinity *affd, + unsigned int *count, + int **irqs); extern struct resource *platform_get_resource_byname(struct platform_device *, unsigned int, const char *);
Drivers for multi-queue platform devices may also want managed interrupts for handling HW queue completion interrupts, so add support. The function accepts an affinity descriptor pointer, which covers all IRQs expected for the device. The platform device driver is expected to hold all the IRQ numbers, as there is no point in holding these in the common platform_device structure. Signed-off-by: John Garry <john.garry@huawei.com> --- drivers/base/platform.c | 58 +++++++++++++++++++++++++++++++++ include/linux/platform_device.h | 5 +++ 2 files changed, 63 insertions(+) -- 2.26.2