Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3130366imm; Mon, 24 Sep 2018 16:42:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV60e1aj4L4i8NA7vAoTTkDxMBtAwGfoLMqVKVKByPeNYcn9IQV4D/cVOt+mcrG23L9lKnYTV X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr846935plh.317.1537832530667; Mon, 24 Sep 2018 16:42:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537832530; cv=none; d=google.com; s=arc-20160816; b=A3yrFNCZqACCowPlHeH2XssNfMdFa5cvkT/7/eXF1nq0ds1Vo5Qp0K14OWDs0GDMOP aUwYSKSTubjPFDmyo0olFnBZMe7qY+hQivULgjvnwTgF3G5f/mE5lGi2BRttpe4MhHJk feJ43q0ovcxvLMzV2RiKN5WXtuN4YolHARwBfhSLTwcRcE8ygyoHl2G+e80dL0Jazrq6 0iQbaWpbXJeY8wK5IuO//xEGIQJ4v+AP3fVbKrFfiUDk9nhG9ALdFRDO64bN433kRYH4 xjTa0VLsYyhjTI+Q1A8A+mVEnpGkfvQXMN1+qX2QGIdgmQk0vGLpbp9e7Vpvym+5mxNp w0sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from; bh=3ZxF2LHE0jKgZNB6ArtYziqg9c8UcsZgWmU7Sv7/EWM=; b=e+vFAr24puBTnJTThTiX3GvwowASy6Q0KLOXMgODRCvtpONP+SYbvwOiREkG7J89t7 jUlfkujwVCEXGl3hRvYqypY+EKMQGqhOOxXQ+o+UsisfWSO8eQ6pz3x2kA2gbQh59rp0 EHEdi7HVZuIFTrvCJxHQXBLrVtmdH+1MoEFcTkCX2BWgFtDXBDQ82xsJGJxzjz0gPL6G E8PZeH8hRoCDy57w6xDc7DXLK1wMgjEGx4o1q2TePYuJ1qlrpHXk43oM5ELn+I+FyHGE EEa8+fBCDrDUFkPYwG9xpd6Ys5PakENFe0fC2rxRzAQ5YVNLEOdaWTDvoKbuQ9CCto8g YDdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 91-v6si677140ple.169.2018.09.24.16.41.55; Mon, 24 Sep 2018 16:42:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbeIYFp7 (ORCPT + 99 others); Tue, 25 Sep 2018 01:45:59 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:56785 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728231AbeIYFp7 (ORCPT ); Tue, 25 Sep 2018 01:45:59 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07441533|-1;CH=blue;FP=10304016491971609001|1|1|14|0|-1|-1|-1;HT=e01l07447;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=19;RT=19;SR=0;TI=SMTPD_---.CvM6g5M_1537832465; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CvM6g5M_1537832465) by smtp.aliyun-inc.com(10.147.41.199); Tue, 25 Sep 2018 07:41:05 +0800 From: Guo Ren To: akpm@linux-foundation.org, arnd@arndb.de, daniel.lezcano@linaro.org, davem@davemloft.net, gregkh@linuxfoundation.org, jason@lakedaemon.net, marc.zyngier@arm.com, mark.rutland@arm.com, mchehab+samsung@kernel.org, peterz@infradead.org, robh@kernel.org, robh+dt@kernel.org, tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org, green.hu@gmail.com, palmer@sifive.com, Guo Ren Subject: [PATCH V5 21/30] csky: remove irq_mapping from smp.c Date: Tue, 25 Sep 2018 07:39:24 +0800 Message-Id: <7fea6f7e58728eef8248c8c5e518f45e6043ba4b.1537789737.git.ren_guo@c-sky.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org - Add irq_mapping return check - Move IPI_IRQ into irq-driver - remove irq_mapping from smp.c to irq-driver - Add set_ipi_irq_mapping api to irq-driver - update asm/smp.h Signed-off-by: Guo Ren --- arch/csky/include/asm/smp.h | 4 +++- arch/csky/kernel/smp.c | 27 +++++++++++++++++++-------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/arch/csky/include/asm/smp.h b/arch/csky/include/asm/smp.h index 9a53abf..f3e4f24 100644 --- a/arch/csky/include/asm/smp.h +++ b/arch/csky/include/asm/smp.h @@ -17,7 +17,9 @@ void arch_send_call_function_ipi_mask(struct cpumask *mask); void arch_send_call_function_single_ipi(int cpu); -void __init set_send_ipi(void (*func)(const unsigned long *, unsigned long)); +void __init set_send_ipi(void (*func)(const unsigned long *)); + +void __init set_ipi_irq_mapping(int (*func)(void)); #define raw_smp_processor_id() (current_thread_info()->cpu) diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c index 522c73f..14877e2 100644 --- a/arch/csky/kernel/smp.c +++ b/arch/csky/kernel/smp.c @@ -20,8 +20,6 @@ #include #include -#define IPI_IRQ 15 - static struct { unsigned long bits ____cacheline_aligned; } ipi_data[NR_CPUS] __cacheline_aligned; @@ -56,9 +54,9 @@ static irqreturn_t handle_ipi(int irq, void *dev) return IRQ_HANDLED; } -static void (*send_arch_ipi)(const unsigned long *mask, unsigned long irq) = NULL; +static void (*send_arch_ipi)(const unsigned long *mask) = NULL; -void __init set_send_ipi(void (*func)(const unsigned long *, unsigned long)) +void __init set_send_ipi(void (*func)(const unsigned long *)) { if (send_arch_ipi) return; @@ -75,7 +73,7 @@ send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation) set_bit(operation, &ipi_data[i].bits); smp_mb(); - send_arch_ipi(cpumask_bits(to_whom), IPI_IRQ); + send_arch_ipi(cpumask_bits(to_whom)); } void arch_send_call_function_ipi_mask(struct cpumask *mask) @@ -115,19 +113,32 @@ void __init smp_prepare_cpus(unsigned int max_cpus) } static int ipi_dummy_dev; +static int ipi_irq; void __init enable_smp_ipi(void) { - enable_percpu_irq(IPI_IRQ, 0); + enable_percpu_irq(ipi_irq, 0); +} + +static int (*arch_ipi_irq_mapping)(void) = NULL; + +void __init set_ipi_irq_mapping(int (*func)(void)) +{ + if (arch_ipi_irq_mapping) + return; + + arch_ipi_irq_mapping = func; } void __init setup_smp_ipi(void) { int rc; - irq_create_mapping(NULL, IPI_IRQ); + ipi_irq = arch_ipi_irq_mapping(); + if (ipi_irq == 0) + panic("%s IRQ mapping failed\n", __func__); - rc = request_percpu_irq(IPI_IRQ, handle_ipi, "IPI Interrupt", &ipi_dummy_dev); + rc = request_percpu_irq(ipi_irq, handle_ipi, "IPI Interrupt", &ipi_dummy_dev); if (rc) panic("%s IRQ request failed\n", __func__); -- 2.7.4