From patchwork Thu May 29 17:16:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 31141 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7BEC4203E6 for ; Thu, 29 May 2014 17:17:11 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id lc6sf2553506vcb.11 for ; Thu, 29 May 2014 10:17:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type :content-transfer-encoding; bh=oQViCySjZRkfnIXmE67/CGx6qFOVUnT5wM+ZY5/Bpqs=; b=BfRuMUFnW0uiXNvB91buk+VRWwf5DjKZ8YB4AcrXh0PCMbKes1RVuKqkVNvnIEFcSa P0tkeMm1Mca5E8hCw1d3cXos9i+JH9PE1c99gm23wRDqeBWKdIkTfKL7d/4PXpMdpn8b I3MVpPAu0dG55+ZstHinHL36u5OxcYsuN2kjFq+RRM5Qj2z/YJQg9+lWSaaBm81byMT6 j4ZAq1ymGJSapeRnp6hOqIjQd0OdP/vspr7KhHJ2gBBYEZ67EUmsJkLQrREikXbOl3+D P9SA2j7nCLJuI4xd3qgolDfNzD6lQwTKcy69u1LwZqfyQ4C78WLm1KnQhfI0QzT8bVcg VDew== X-Gm-Message-State: ALoCoQmMNx9ptVLU1xr85RApj3Mly5qUWVCXkfBIKmdF2UjCTOrog2dkSUKMrqxHJaJO3/dZllOQ X-Received: by 10.236.222.36 with SMTP id s34mr3179214yhp.24.1401383831098; Thu, 29 May 2014 10:17:11 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.29.4 with SMTP id a4ls681710qga.45.gmail; Thu, 29 May 2014 10:17:10 -0700 (PDT) X-Received: by 10.221.40.193 with SMTP id tr1mr7989479vcb.31.1401383830938; Thu, 29 May 2014 10:17:10 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id n9si990327vcx.91.2014.05.29.10.17.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 10:17:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id db12so734848veb.25 for ; Thu, 29 May 2014 10:17:10 -0700 (PDT) X-Received: by 10.52.25.130 with SMTP id c2mr2087609vdg.27.1401383830762; Thu, 29 May 2014 10:17:10 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp45276vcb; Thu, 29 May 2014 10:17:10 -0700 (PDT) X-Received: by 10.68.231.7 with SMTP id tc7mr10830660pbc.32.1401383829948; Thu, 29 May 2014 10:17:09 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cw3si1756392pbc.117.2014.05.29.10.17.09 for ; Thu, 29 May 2014 10:17:09 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758071AbaE2RRB (ORCPT + 27 others); Thu, 29 May 2014 13:17:01 -0400 Received: from service87.mimecast.com ([91.220.42.44]:49888 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757464AbaE2RRA (ORCPT ); Thu, 29 May 2014 13:17:00 -0400 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 29 May 2014 18:16:58 +0100 Received: from red-moon.cambridge.arm.com ([10.1.255.212]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 29 May 2014 18:16:55 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: will.deacon@arm.com, mark.rutland@arm.com, Lorenzo Pieralisi , Preeti U Murthy Subject: [PATCH v2] arm64: kernel: initialize broadcast hrtimer based clock event device Date: Thu, 29 May 2014 18:16:54 +0100 Message-Id: <1401383814-22600-1-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.8.4 X-OriginalArrivalTime: 29 May 2014 17:16:55.0899 (UTC) FILETIME=[CAA68AB0:01CF7B61] X-MC-Unique: 114052918165800701 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: lorenzo.pieralisi@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On platforms implementing CPU power management, the CPUidle subsystem can allow CPUs to enter idle states where local timers logic is lost on power down. To keep the software timers functional the kernel relies on an always-on broadcast timer to be present in the platform to relay the interrupt signalling the timer expiries. For platforms implementing CPU core gating that do not implement an always-on HW timer or implement it in a broken way, this patch adds code to initialize the kernel hrtimer based clock event device upon boot (which can be chosen as tick broadcast device by the kernel). It relies on a dynamically chosen CPU to be always powered-up. This CPU then relays the timer interrupt to CPUs in deep-idle states through its HW local timer device. Having a CPU always-on has implications on power management platform capabilities and makes CPUidle suboptimal, since at least a CPU is kept always in a shallow idle state by the kernel to relay timer interrupts, but at least leaves the kernel with a functional system with some working power management capabilities. The hrtimer based clock event device is unconditionally registered, but has the lowest possible rating such that any broadcast-capable HW clock event device present will be chosen in preference as the tick broadcast device. Cc: Preeti U Murthy Acked-by: Will Deacon Acked-by: Mark Rutland Signed-off-by: Lorenzo Pieralisi Reviewed-by: Preeti U Murthy --- changes in v2: - Reworded the commit log according to reviews It should be ready to go. Thanks, Lorenzo arch/arm64/kernel/time.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm64/kernel/time.c b/arch/arm64/kernel/time.c index 6815987..1a7125c 100644 --- a/arch/arm64/kernel/time.c +++ b/arch/arm64/kernel/time.c @@ -18,6 +18,7 @@ * along with this program. If not, see . */ +#include #include #include #include @@ -69,6 +70,8 @@ void __init time_init(void) of_clk_init(NULL); clocksource_of_init(); + tick_setup_hrtimer_broadcast(); + arch_timer_rate = arch_timer_get_rate(); if (!arch_timer_rate) panic("Unable to initialise architected timer.\n");