From patchwork Thu Aug 30 19:19:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 10582727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C30CB920 for ; Thu, 30 Aug 2018 19:19:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B480A2C42A for ; Thu, 30 Aug 2018 19:19:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8BD72C43F; Thu, 30 Aug 2018 19:19:29 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CA962C42A for ; Thu, 30 Aug 2018 19:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725836AbeH3XXI (ORCPT ); Thu, 30 Aug 2018 19:23:08 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44266 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbeH3XXI (ORCPT ); Thu, 30 Aug 2018 19:23:08 -0400 Received: by mail-lj1-f194.google.com with SMTP id q127-v6so8171408ljq.11 for ; Thu, 30 Aug 2018 12:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:subject:to:cc:organization:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=TovEBHTQQLb1JwFnbagC6Fa0T4rhsiXOCLALa8S70b8=; b=1BP7pbUKmhEHo1xEJUT8tVsY1LGpSyfLyN44YFjjMAwFI45hVOZzzYJCHO14NXqV46 JY7SDGHviLZxgdrtTGGq3r+/+e6okVtQz+e7NKrwtiKZVtTjF7UjtaS0TvjtbO6h+NJL QpQRYWJGNtndJ/6fBb9Wfm0egU2iK3TILGtn7oG/nql4vWczcVFpFGm6PLwue5wSr8ZI ZSVkOQrhiesXXIKR9EF4G+ZBMW5FRtjtOcB1YFZFAxc3bXxbH8q2yegxxKwXkM3sdSpq cLmZGkb12NEyAMpbrXGowAT3S5pRut997JKW/PkK+K77j+/FBTMBudB/HEJBDvij9d4D 1gAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:cc:organization:message-id:date :user-agent:mime-version:content-language:content-transfer-encoding; bh=TovEBHTQQLb1JwFnbagC6Fa0T4rhsiXOCLALa8S70b8=; b=Wdwf8SwrPyfeovj8gcSp2igUwkuV91ZO6hct6poHp4cGi/DfBm39qHiY/CVuObJwOA tCQSlg+D+YJ79x2OGwfh0ndyQtStgzdn+9JmxMSaqThbvw0b9zBXPU7CC39Vxxj9So1e qSjrZO3g21Pn5EGLtY0SwUzUPq0XHLpu3yVDMARLUWJOCL6rU8NFXPtSdWRdQJ+Ni4xm sl4WSTH3W8iKLghc6ScpDwkLmj6U+KwTwgc8hIdve6N8/HyZaJAzNlICvig/LRgHbLhu mPFa01ydAA6VIYJFdwdcuiR6ndFXQc5xYCl+WYShLJQXUPNTgKj4xYC28anqB0s8+WVm 5kng== X-Gm-Message-State: APzg51CTZPe8ArFLT5uI5/EtV4PDVumnQoUlg+KrSa0FdXWveOPZa+MY IoWmYDdH0PRD7wsthGZlj1mcoQfEN0c= X-Google-Smtp-Source: ANB0VdbYpmcTNlwcf/Nm3hyeyOy6E4vSA//nnc5umsX2L4Q5u7wPht9rH8W8YP/Pgz7cupbuwtoMFw== X-Received: by 2002:a2e:9d0c:: with SMTP id t12-v6mr8180464lji.75.1535656766434; Thu, 30 Aug 2018 12:19:26 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.83.90]) by smtp.gmail.com with ESMTPSA id v62-v6sm1437604lfa.51.2018.08.30.12.19.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Aug 2018 12:19:25 -0700 (PDT) From: Sergei Shtylyov Subject: [PATCH] clocksource: sh_cmt: fixup for 64-bit machines To: Daniel Lezcano , Thomas Gleixner , linux-renesas-soc@vger.kernel.org Cc: Vladimir Barinov , Andrey Gusakov , Mikhail Ulyanov , linux-sh@vger.kernel.org Organization: Cogent Embedded Message-ID: <8aa6d2cd-68f9-eae4-cba0-222c1511eb9d@cogentembedded.com> Date: Thu, 30 Aug 2018 22:19:24 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 Content-Language: en-MW Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When trying to use CMT for clockevents on R-Car gen3 SoCs, I noticed that the maximum delta (in ns) for the broadcast timer was diplayed as 1000 in /proc/timer_list. It turned out that when calculating it, the driver did shift left 1 by 32 (causing what I think was undefined behaviour) getting 1 as a result. Using 1UL instead fixed the maximum delta and did even fix switching an active clocksource to a CMT channel (which caused the system to go non-interactive before). Signed-off-by: Sergei Shtylyov --- This patch is against the 'tip.git' repo's 'timers/core' branch. I am not sure whether the CMT driver was ever used on SH64; on R-Car gen3 (ARM64) I'm only enabling this driver now, so not sure how urgent is this... drivers/clocksource/sh_cmt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: tip/drivers/clocksource/sh_cmt.c =================================================================== --- tip.orig/drivers/clocksource/sh_cmt.c +++ tip/drivers/clocksource/sh_cmt.c @@ -891,7 +891,7 @@ static int sh_cmt_setup_channel(struct s if (cmt->info->width == (sizeof(ch->max_match_value) * 8)) ch->max_match_value = ~0; else - ch->max_match_value = (1 << cmt->info->width) - 1; + ch->max_match_value = (1UL << cmt->info->width) - 1; ch->match_value = ch->max_match_value; raw_spin_lock_init(&ch->lock);