From patchwork Fri Sep 16 05:49:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 9335031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D9B5601C2 for ; Fri, 16 Sep 2016 05:51:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ECFB29EBD for ; Fri, 16 Sep 2016 05:51:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3372129EBF; Fri, 16 Sep 2016 05:51:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B8A9F29EBD for ; Fri, 16 Sep 2016 05:51:48 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkm2A-0002Nf-BC; Fri, 16 Sep 2016 05:49:58 +0000 Received: from mail-pa0-x22e.google.com ([2607:f8b0:400e:c03::22e]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bkm25-0002KP-FG for linux-arm-kernel@lists.infradead.org; Fri, 16 Sep 2016 05:49:54 +0000 Received: by mail-pa0-x22e.google.com with SMTP id id6so22922840pad.3 for ; Thu, 15 Sep 2016 22:49:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id; bh=DJrLa77FJoyPHkRs7AO/Ht6FURzcL5RnrkDqb2+KsKE=; b=EZRXx2wUzEFsqRbvwN1hrQU6V4QI2pEKsqvpuuKpS3yIgC0MhqzqZHL6xirHG5nG13 HxKzpDpNueY+OooFwRnzjKI3Dq+ADMg/N16lyQa8+k8Dx6DkNV05yVOUQLKKCdwwZoRK QZAJ1xNhCZIX8XXxHcCbSskfJyRqobyh+HXAU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DJrLa77FJoyPHkRs7AO/Ht6FURzcL5RnrkDqb2+KsKE=; b=C3YJQlTL6XgfZpODTIjO9ibZmNbubj7gjq873V9OlSW5HW4mUQpBz/VUBNcNgy/1to Zkw+DMcbUe+Gdcg37Vc7eFWOvgS3ognA7sHiYiDFOIPfLqKrSpFfkYVhEFaTf3NuN3zg 9dNrfHoGIVhsK0EbORobW73u5qLVBsME+4Dt4G5kqAxfF1rw3VfYiiGP7ai0TndaWOWi ihuMwqqNz6QwWG84wTww+gPGa4H/+I94jJ68xuiJgyx37QWCUqkq5OmI8F09VXd6UbTt w0EEA4pmmDIqSNWXH+YgWiEOvNblvd2KS3vSwY+Fh5mwuXNzWlMow6aIYq9AoP9U0bQp /F0w== X-Gm-Message-State: AE9vXwNOH39NvhK111V4P6NoL/SrM3PRv6rynV2xkCq32inxz3fPNkrh/KpkM/wPkGivChRv X-Received: by 10.66.251.131 with SMTP id zk3mr6680322pac.176.1474004972230; Thu, 15 Sep 2016 22:49:32 -0700 (PDT) Received: from briannorris-glaptop2.roam.corp.google.com ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id 70sm16077338pfn.46.2016.09.15.22.49.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Sep 2016 22:49:31 -0700 (PDT) From: Brian Norris To: Daniel Lezcano , Thomas Gleixner Subject: [PATCH] clocksource: arm_arch_timer: Don't assume clock runs in suspend Date: Fri, 16 Sep 2016 13:49:17 +0800 Message-Id: <20160916054917.16930-1-briannorris@chromium.org> X-Mailer: git-send-email 2.8.1.340.g018a5d0.dirty X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160915_224953_593623_F8562A12 X-CRM114-Status: GOOD ( 13.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Marc Zyngier , Brian Norris , Stephen Boyd , linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Since commit 4fbcdc813fb9 ("clocksource: arm_arch_timer: Use clocksource for suspend timekeeping"), this driver assumes that the ARM architected timer keeps running in suspend. This is not the case for some ARM SoCs, depending on the HW state used for system suspend. Let's not assume that all SoCs support this, and instead only support this if the device tree explicitly tells us it's "always on". In all other cases, just fall back to the RTC. This should be relatively harmless. It seems fair to key the system-suspend behavior off the same property used for C3STOP, since if the timer doesn't keep context for CPU sleep, it likely doesn't for system sleep either. Signed-off-by: Brian Norris --- drivers/clocksource/arm_arch_timer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 57700541f951..e28677a34f02 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -490,7 +490,7 @@ static struct clocksource clocksource_counter = { .rating = 400, .read = arch_counter_read, .mask = CLOCKSOURCE_MASK(56), - .flags = CLOCK_SOURCE_IS_CONTINUOUS | CLOCK_SOURCE_SUSPEND_NONSTOP, + .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; static struct cyclecounter cyclecounter = { @@ -526,6 +526,8 @@ static void __init arch_counter_register(unsigned type) clocksource_counter.name = "arch_mem_counter"; } + if (!arch_timer_c3stop) + clocksource_counter.flags |= CLOCK_SOURCE_SUSPEND_NONSTOP; start_count = arch_timer_read_counter(); clocksource_register_hz(&clocksource_counter, arch_timer_rate); cyclecounter.mult = clocksource_counter.mult;