Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp800732pxb; Sat, 6 Mar 2021 18:30:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJymM5Gitd3B7fBmnqcnizE5ED2P1lKtzX07SAfoya4u/xtVPcDaqFKcFURSsbLlhhy1OzPC X-Received: by 2002:a17:906:2816:: with SMTP id r22mr8910204ejc.2.1615084231190; Sat, 06 Mar 2021 18:30:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615084231; cv=none; d=google.com; s=arc-20160816; b=P5YTfKGAEGq8yrlo8/yNnrfE1w1m/AL3X5KLUJhQUIqf6HNQI4xUL5u3AznFMos9Eq rF/HVr23LxCHA1Lrsm2SuGc1oiXTqJmj8gHlfmuyGaGm5vOuiTs9c0r2BrEZCO/q/VIP ZfDx2Xy/npe9ms3JHc0NQdBJP1Z+O2AIqyhAX4HaftmqUfU1JQ0yBkyVtCh57KClcEiL jpMnicy0WAuIMIPWRaKR1W+n2Mh8RoLfsBx3bKm5U6kwa8VLgHf1ycKyhkIBv4+B6wlb Dw/Juh4LwaVwniMlNLoguyBxG8O3ZjeoxZCnh3IGPv8s12mkJ6Ny4q3lUelbhgKf+kKa A+2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=s5Np+kumFT2qbDLV3RlhLcEE6rTG1pLPMypBs2Z2a1A=; b=k3+knWVqGIIbbwsxc7GUgUdlt8ymBDFZivUMx3ggN0bPix5XNvWZ7K+0Ds8XIgCc4T mmh7sClqdpOPHphKFyIRXyU7oEXgqawcC90jYC6tCSoc8jgugCvBimi6Z8IbcZWdco8Z kPDGwOlqqmGY7hTYZW5kex0eK+6I0Dt4r3R/6KdmSGQum4xFmyx+PK427APyZC/0S8Fg QO8roMjTh6gtAKrAOJ8uckC0JD8Sfcko2KOZA3xcJZ6mqw3A49SRt8xyx42dzz014FOs 5vwAZirlNOMblaObv+3JKwcJuJSL6zSUqddG8RbfFxW1R7XGcrkqUAPjzlxa51VYhPHR 4aAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P/PmwbHZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si83730ejo.244.2021.03.06.18.30.08; Sat, 06 Mar 2021 18:30:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="P/PmwbHZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230139AbhCGCZl (ORCPT + 99 others); Sat, 6 Mar 2021 21:25:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:37972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229957AbhCGCZK (ORCPT ); Sat, 6 Mar 2021 21:25:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2295F65056; Sun, 7 Mar 2021 02:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615083910; bh=WhlbkUebwc1GJfXvE/1rpEg/Mf21MpRw1uus7X8kdhM=; h=From:To:Cc:Subject:Date:From; b=P/PmwbHZ6rBXncMvOhHWf1UeeMdm+EzqFTqXWkT46ndkYAfO1qnLQxRFvfotu3sJY Kh5z/TnOtYx6WabQsMWEtpP5NJtcFjN9r9dSYGTnJTR8TziqKn0M45t2L73ISLmSSw 8DJVqyWu6l4pssJWUlB2uAn4XSept9KW85JTvRzM0joP4Aal2p2RvdOI+Bx2koToGu Jkew5iPqShZCoORlTR9AwEYJqPKBz23lIfW6nDs7TrTkx/sL/jfKTIhJjam+DJJb1B 6a7qVm1pZEvrAU51xaXZoFodiLSwNiuf5JDqNfxfjo10vqlIz7G5Mx70WXjz4D6Hve 5Wtbn7puahsJQ== From: guoren@kernel.org To: arnd@arndb.de, guoren@kernel.org Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linux-csky@vger.kernel.org, linux-riscv@lists.infradead.org, Guo Ren , Thomas Gleixner , Daniel Lezcano Subject: [PATCH 1/2] csky: Enable generic clockevent broadcast Date: Sun, 7 Mar 2021 10:24:45 +0800 Message-Id: <20210307022446.63732-1-guoren@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren When percpu-timers are stopped by deep power saving mode, we need system timer help to broadcast IPI_TIMER. This is first introduced by broken x86 hardware, where the local apic timer stops in C3 state. But many other architectures(powerpc, mips, arm, hexagon, openrisc, sh) have supported the infrastructure to deal with Power Management issues. Signed-off-by: Guo Ren Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Daniel Lezcano --- arch/csky/Kconfig | 2 ++ arch/csky/kernel/smp.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/csky/Kconfig b/arch/csky/Kconfig index 34e91224adc3..4328511ac050 100644 --- a/arch/csky/Kconfig +++ b/arch/csky/Kconfig @@ -6,6 +6,7 @@ config CSKY select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SYNC_DMA_FOR_CPU select ARCH_HAS_SYNC_DMA_FOR_DEVICE + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_USE_BUILTIN_BSWAP select ARCH_USE_QUEUED_RWLOCKS select ARCH_WANT_FRAME_POINTERS if !CPU_CK610 @@ -19,6 +20,7 @@ config CSKY select IRQ_DOMAIN select HANDLE_DOMAIN_IRQ select DW_APB_TIMER_OF + select GENERIC_CLOCKEVENTS_BROADCAST if SMP select GENERIC_IOREMAP select GENERIC_LIB_ASHLDI3 select GENERIC_LIB_ASHRDI3 diff --git a/arch/csky/kernel/smp.c b/arch/csky/kernel/smp.c index 0f9f5eef9338..76d38d84da70 100644 --- a/arch/csky/kernel/smp.c +++ b/arch/csky/kernel/smp.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ enum ipi_message_type { IPI_RESCHEDULE, IPI_CALL_FUNC, IPI_IRQ_WORK, + IPI_TIMER, IPI_MAX }; @@ -67,6 +69,13 @@ static irqreturn_t handle_ipi(int irq, void *dev) irq_work_run(); } +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST + if (ops & (1 << IPI_TIMER)) { + stats[IPI_TIMER]++; + tick_receive_broadcast(); + } +#endif + BUG_ON((ops >> IPI_MAX) != 0); } @@ -102,6 +111,7 @@ static const char * const ipi_names[] = { [IPI_RESCHEDULE] = "Rescheduling interrupts", [IPI_CALL_FUNC] = "Function call interrupts", [IPI_IRQ_WORK] = "Irq work interrupts", + [IPI_TIMER] = "Timer broadcast interrupts", }; int arch_show_interrupts(struct seq_file *p, int prec) @@ -130,6 +140,13 @@ void arch_send_call_function_single_ipi(int cpu) send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC); } +#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST +void tick_broadcast(const struct cpumask *mask) +{ + send_ipi_message(mask, IPI_TIMER); +} +#endif + static void ipi_stop(void *unused) { while (1); -- 2.25.1