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: 10582725 X-Patchwork-Delegate: geert@linux-m68k.org 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 B6CC6174C 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 A3ECC2C429 for ; Thu, 30 Aug 2018 19:19:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 97DDB2C433; 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=ham 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 3B4ED2C429 for ; Thu, 30 Aug 2018 19:19:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727170AbeH3XXI (ORCPT ); Thu, 30 Aug 2018 19:23:08 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:34697 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725836AbeH3XXI (ORCPT ); Thu, 30 Aug 2018 19:23:08 -0400 Received: by mail-lj1-f196.google.com with SMTP id f8-v6so8190403ljk.1 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=au0+8KCDbPNc4qrCGmyGwqqSjWvRfG4+Wnmk/bcafSQHqCPKkTrqY/SSRb5CQdEhCR vNWRzXervsKfOH/SbQ5FbdEeS2KddQlvs66VNDn0zZJdUy3u856fmLet2Aej3AFUWze9 YOJspAky/GZ3hgdSmbwmkiB1yhmW4at3NtyPAtlrBvHj04aBUHxQyX9Xype59w/7tthx kpX0hk/BJZwEUvG4Wf4ZPLJb4D3HI3FxM6mLia6U4V6lmD/BnfuKdCAXkMtefZN4V0Z5 lhOOPvicsQybWqGoIPJLHltT4WPsaIUfkgQeC1sw+aepv67Eg1ImtB0njFgRPvpeJwh5 4yuA== X-Gm-Message-State: APzg51DKr8/z/oCPDSOFADmZVRB7BfZFgSjZt1jCXhgaG+rsx/86B2rr i6ffhNsTOBw7RIsCFULGs79iwQ== 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-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@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);