Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1579545imm; Wed, 19 Sep 2018 22:41:06 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb++7VvRSfbRhToOT6CruMqLNq6YedTzOVY7ltgVQbz1cvnnzFY/+88jzFtWWRKrpVwFhg+ X-Received: by 2002:a63:5815:: with SMTP id m21-v6mr35219665pgb.78.1537422066555; Wed, 19 Sep 2018 22:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537422066; cv=none; d=google.com; s=arc-20160816; b=Nz61f01cQEgloFLAnCieR04NwGI8UaBtXEcFncCb9HBdb2A57lkDXTiOeOIZL/XQxp g/J1zQzzVcbIe4ZOwVw1zGgP+y9yy8FZ2VOPKbEgMG1mxLYoWGkNYJZga2IMRGIsJLR6 XYGbCSAtQvS3OjRlT8vmJzVR7ipWfIH1SClS/M3KP/sM4jgdkN+FUfVnavKF0PQg6720 9666FBBY3RenoLntRIA66AlUP9Fuup01N8JNRDvGg8XzFC6sDeaBrdCeiliI61gQEBUk +VINkAccTqX463MYsbQwb/wDxbeRy3/I7HwG7xJSpvegW1323kYvG/8fsQdxSfJjlHO+ Z1Jw== 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=yaS37GYIojus/82IbZbifV7bI4E70v2cS2ZQIhm117XrVaYG4P48WitrKiALTFb0Gn 57novX7qf+2Dua1FcmCvuE3uTFMejWOYWiLXbj3P6otEupQE8mIWppswl0GaUTV5AwuG uAfVPjza5VoQX8OlS6DZsTUww43zVnp4Xo9AricOSQcedbq33StR7Q5pbnP+E0K/myaF qNqn3TmOoULTfgdTL3eTDv71V1uH7F+O7FZ0CbUNEWHSCENXeoEY2EmgzavjT6uohFes rFOwUWEJbmRs9LKaSf/hhxRvDX0t0P5RQcKU+u+bgb/aWUS9nJqRo5d5oRWWdjBYt3gY 0ReA== 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 190-v6si24531120pfu.343.2018.09.19.22.40.51; Wed, 19 Sep 2018 22:41:06 -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 S1731703AbeITLVw (ORCPT + 99 others); Thu, 20 Sep 2018 07:21:52 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:38190 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726994AbeITLVv (ORCPT ); Thu, 20 Sep 2018 07:21:51 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07441849|-1;CH=green;FP=10376074086009536937|1|1|1|0|-1|-1|-1;HT=e02c03273;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=15;RT=15;SR=0;TI=SMTPD_---.CtGldDV_1537421981; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.CtGldDV_1537421981) by smtp.aliyun-inc.com(10.147.41.138); Thu, 20 Sep 2018 13:39:41 +0800 From: Guo Ren To: tglx@linutronix.de, jason@lakedaemon.net, marc.zyngier@arm.com, robh+dt@kernel.org, mark.rutland@arm.com, arnd@arndb.de, robh@kernel.org, sfr@canb.auug.org.au Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arch@vger.kernel.org, c-sky_gcc_upstream@c-sky.com, gnu-csky@mentor.com, green.hu@gmail.com, Guo Ren Subject: [PATCH V8 2/6] csky: remove irq_mapping from smp.c Date: Thu, 20 Sep 2018 13:39:28 +0800 Message-Id: <7fea6f7e58728eef8248c8c5e518f45e6043ba4b.1537417413.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