From patchwork Thu May 29 09:23:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Pieralisi X-Patchwork-Id: 31109 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f70.google.com (mail-oa0-f70.google.com [209.85.219.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F113420068 for ; Thu, 29 May 2014 09:23:24 +0000 (UTC) Received: by mail-oa0-f70.google.com with SMTP id g18sf279851oah.5 for ; Thu, 29 May 2014 02:23:24 -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=/RdjOf/ozPWPeHn6V/WvDSsQxxlrDoB7pvXs1ZNjPhU=; b=NqkIN1Nst2Kujnrt+ogxb2tYQi1MEi2TFWB/D6OED6bx1Me0CfyCNdI+iyjb1qdkA2 MqDUxMZfslCCG21kL5ajjwNYefUUwQ0d7046CS4fjIQSk7docgQubzK4TtaT/9zJFgDP x9D6A8q0JAXPN8RQIKHQ9I8taOwGkaHEkswcPnf+zymDULUSjifT4j/NspeG//oKfnp4 yfH6mEMfE/eH6oDIkO6kP1JBdgyQK9J4bRfjPVDJ47WmhE6DAOSaKKJsc+ATR/5ebptr 47Mw8lkcD27zheXRbJBhK1rggg29UfgDzAKjPomwFg6G4orzFf1TE2Ruwzhawz+f2JXc pB8w== X-Gm-Message-State: ALoCoQmQsGRGb5jgQs6gTj9njC8yT8uMB0p7wqyvDsx8e0KDoXnquAr5XsOoNiNvBQ81M3uy6xSS X-Received: by 10.42.229.194 with SMTP id jj2mr2278398icb.18.1401355404471; Thu, 29 May 2014 02:23:24 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.229 with SMTP id j92ls502285qgf.14.gmail; Thu, 29 May 2014 02:23:24 -0700 (PDT) X-Received: by 10.221.64.20 with SMTP id xg20mr5193432vcb.3.1401355404336; Thu, 29 May 2014 02:23:24 -0700 (PDT) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id su2si49955vec.27.2014.05.29.02.23.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 29 May 2014 02:23:24 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.177 as permitted sender) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id hq11so63849vcb.22 for ; Thu, 29 May 2014 02:23:24 -0700 (PDT) X-Received: by 10.220.139.198 with SMTP id f6mr36684vcu.47.1401355404237; Thu, 29 May 2014 02:23:24 -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 ib8csp13293vcb; Thu, 29 May 2014 02:23:23 -0700 (PDT) X-Received: by 10.66.161.33 with SMTP id xp1mr7228523pab.74.1401355403541; Thu, 29 May 2014 02:23:23 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tk2si143438pac.24.2014.05.29.02.23.22; Thu, 29 May 2014 02:23:22 -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 S934240AbaE2JXO (ORCPT + 27 others); Thu, 29 May 2014 05:23:14 -0400 Received: from service87.mimecast.com ([91.220.42.44]:33741 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932814AbaE2JXN (ORCPT ); Thu, 29 May 2014 05:23:13 -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 10:23:11 +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 10:23:08 +0100 From: Lorenzo Pieralisi To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mark.rutland@arm.com, Lorenzo Pieralisi , Preeti U Murthy , Will Deacon Subject: [PATCH] arm64: kernel: initialize broadcast hrtimer based clock event device Date: Thu, 29 May 2014 10:23:01 +0100 Message-Id: <1401355381-11446-1-git-send-email-lorenzo.pieralisi@arm.com> X-Mailer: git-send-email 1.8.4 X-OriginalArrivalTime: 29 May 2014 09:23:08.0079 (UTC) FILETIME=[9A5973F0:01CF7B1F] X-MC-Unique: 114052910231101601 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.220.177 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 software broadcast hrtimer upon boot. 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. On systems with power management capabilities but no functional HW broadcast tick device, the hrtimer based clock event device allows the kernel to enter high-resolution timer mode, which improves system latencies and saves dynamic power. The side effect of 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 has lowest possible rating so that, if a platform contains a functional HW clock event device with broadcast capabilities, that device is always chosen as a tick broadcast device instead of the software based one, now present by default. Cc: Preeti U Murthy Cc: Will Deacon Acked-by: Mark Rutland Signed-off-by: Lorenzo Pieralisi --- 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 29c39d5..3d43900 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 @@ -67,6 +68,8 @@ void __init time_init(void) 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");