Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp225588pxx; Wed, 28 Oct 2020 03:22:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCLwb91WgwEIHezc2QN/lsbGsi0WSR/5CZoqrcrlZjipqUNlcDVFrjsJ7GGJy+XJMQLM/X X-Received: by 2002:a17:906:1e04:: with SMTP id g4mr6712746ejj.72.1603880538286; Wed, 28 Oct 2020 03:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603880538; cv=none; d=google.com; s=arc-20160816; b=f/dPqo+VJUXrl7ZKjvya2U/hRthvY478CCYSdIANFyY/nak3d523BEg3jwsEgYW7x5 d0AyykHGPK+6kMkvLThY5ZP9apBbv3qTcVRlwhDm6x4Eyhjpva3GZDGDhTP7jto8a4kD 82rtwr+1NQCy1QINZVQ1zNEJUR3nH4YrdzAl6gU4HNH32l9TMlcZSV3XPZWymI7T/tmf brGBINzvdxh1Mxwmkcf9Zh9zqoZH+vf0cKIfqTbRtVzmO0Ch1furm6zYByU+f/7/aY1I RPcCqJ8zmO/nghnjJX8wNx9zuea1N+uzSViPF1LY7BULgL2JQw42CBH0KPYbsUAxknHf ph1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=xEWcOGrh1byRxwo2DE5eQWcJzB2a9Jt2npOHHv55F04=; b=dCLvTBYgmJBHydZNrT2fOS5bdJvSMqB/HXh3iZkamTPlR762oziJyACRHitAX10P67 eWSzwhljTpCd1Es7TFD6cZGgDa7hIAhKPwQiaBK+qZRbgwK77kgGa+KHeWGr3lXoIyZK 6TuOTQtPXVaszuKbV04y4v3HoqvmImvz5pZW76dgTknmPCv1yeOab4raojQMlFX410yw CmILZRTuUALZiqbQlrTJ3WUKxXHq72SlePpRM1NtBWkvR0rjzT73oIAecdNZa1S/xkFT 3S5qs41Vuu9cXvGMEsk0BBNdPVHpfVe53nFjjuhrfZUU14cSdegz+PrKmki8YGl6n79E xivw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="eface/Hg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si2879649ejg.48.2020.10.28.03.21.56; Wed, 28 Oct 2020 03:22:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="eface/Hg"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761259AbgJ0Oil (ORCPT + 99 others); Tue, 27 Oct 2020 10:38:41 -0400 Received: from mail.kernel.org ([198.145.29.99]:37796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S460379AbgJ0Oie (ORCPT ); Tue, 27 Oct 2020 10:38:34 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 893C0206B2; Tue, 27 Oct 2020 14:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809513; bh=ubs5dbW8ANBVTvqvuujXK/aBDQM5Sg7M4MLSGcm8dJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eface/HgkGtWQF1L49N81So9wD9RGcNSNNNeNO8Vr89pHl8L8k0Novg2Ltx2fzjEE g6k8XEdpD4seKGMadvVbu5dNDX8u2DEXtJjPgM7z7xuSjP0tRaORLGRU9vhchbg8Hv AH0L9PGCL3olOgI3BMRUuzeA3jdZdxh81ALcfJ2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Finn Thain , Stan Johnson , Michael Ellerman , Sasha Levin Subject: [PATCH 5.4 223/408] powerpc/tau: Use appropriate temperature sample interval Date: Tue, 27 Oct 2020 14:52:41 +0100 Message-Id: <20201027135505.426804587@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Finn Thain [ Upstream commit 66943005cc41f48e4d05614e8f76c0ca1812f0fd ] According to the MPC750 Users Manual, the SITV value in Thermal Management Register 3 is 13 bits long. The present code calculates the SITV value as 60 * 500 cycles. This would overflow to give 10 us on a 500 MHz CPU rather than the intended 60 us. (But according to the Microprocessor Datasheet, there is also a factor of 266 that has to be applied to this value on certain parts i.e. speed sort above 266 MHz.) Always use the maximum cycle count, as recommended by the Datasheet. Fixes: 1da177e4c3f41 ("Linux-2.6.12-rc2") Signed-off-by: Finn Thain Tested-by: Stan Johnson Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/896f542e5f0f1d6cf8218524c2b67d79f3d69b3c.1599260540.git.fthain@telegraphics.com.au Signed-off-by: Sasha Levin --- arch/powerpc/include/asm/reg.h | 2 +- arch/powerpc/kernel/tau_6xx.c | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index b3cbb1136bce0..34d08ff21b988 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h @@ -796,7 +796,7 @@ #define THRM1_TIN (1 << 31) #define THRM1_TIV (1 << 30) #define THRM1_THRES(x) ((x&0x7f)<<23) -#define THRM3_SITV(x) ((x&0x3fff)<<1) +#define THRM3_SITV(x) ((x & 0x1fff) << 1) #define THRM1_TID (1<<2) #define THRM1_TIE (1<<1) #define THRM1_V (1<<0) diff --git a/arch/powerpc/kernel/tau_6xx.c b/arch/powerpc/kernel/tau_6xx.c index e2ab8a111b693..976d5bc1b5176 100644 --- a/arch/powerpc/kernel/tau_6xx.c +++ b/arch/powerpc/kernel/tau_6xx.c @@ -178,15 +178,11 @@ static void tau_timeout(void * info) * complex sleep code needs to be added. One mtspr every time * tau_timeout is called is probably not a big deal. * - * Enable thermal sensor and set up sample interval timer - * need 20 us to do the compare.. until a nice 'cpu_speed' function - * call is implemented, just assume a 500 mhz clock. It doesn't really - * matter if we take too long for a compare since it's all interrupt - * driven anyway. - * - * use a extra long time.. (60 us @ 500 mhz) + * The "PowerPC 740 and PowerPC 750 Microprocessor Datasheet" + * recommends that "the maximum value be set in THRM3 under all + * conditions." */ - mtspr(SPRN_THRM3, THRM3_SITV(500*60) | THRM3_E); + mtspr(SPRN_THRM3, THRM3_SITV(0x1fff) | THRM3_E); local_irq_restore(flags); } -- 2.25.1