lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210305132859.8208-1-wsa+renesas@sang-engineering.com>
Date:   Fri,  5 Mar 2021 14:28:59 +0100
From:   Wolfram Sang <wsa+renesas@...g-engineering.com>
To:     linux-renesas-soc@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Daniel Lezcano <daniel.lezcano@...aro.org>,
        Niklas Söderlund <niklas.soderlund@...natech.se>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Phong Hoang <phong.hoang.wz@...esas.com>
Subject: [PATCH] clocksource: sh_cmt: use CMTOUT_IE only when supported

CMTOUT_IE is only supported for older SoCs. Newer SoCs shall not set
this bit. So, add a version check.

Reported-by: Phong Hoang <phong.hoang.wz@...esas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@...g-engineering.com>
---

Confirmed with datasheets and could successfully repeat Niklas' CMT
tests on an R-Car M3N based Salvator-XS.

 drivers/clocksource/sh_cmt.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/clocksource/sh_cmt.c b/drivers/clocksource/sh_cmt.c
index c98f8851fd68..3b53c6cb1da9 100644
--- a/drivers/clocksource/sh_cmt.c
+++ b/drivers/clocksource/sh_cmt.c
@@ -143,6 +143,7 @@ struct sh_cmt_device {
 #define SH_CMT32_CMCSR_SSIE		(1 << 10)
 #define SH_CMT32_CMCSR_CMS		(1 << 9)
 #define SH_CMT32_CMCSR_CMM		(1 << 8)
+/* CMTOUT_IE only for SH_CMT_32BIT and SH_CMT_48BIT */
 #define SH_CMT32_CMCSR_CMTOUT_IE	(1 << 7)
 #define SH_CMT32_CMCSR_CMR_NONE		(0 << 4)
 #define SH_CMT32_CMCSR_CMR_DMA		(1 << 4)
@@ -339,8 +340,9 @@ static int sh_cmt_enable(struct sh_cmt_channel *ch)
 		sh_cmt_write_cmcsr(ch, SH_CMT16_CMCSR_CMIE |
 				   SH_CMT16_CMCSR_CKS512);
 	} else {
-		sh_cmt_write_cmcsr(ch, SH_CMT32_CMCSR_CMM |
-				   SH_CMT32_CMCSR_CMTOUT_IE |
+		u32 cmtout = ch->cmt->info->model <= SH_CMT_48BIT ?
+			      SH_CMT32_CMCSR_CMTOUT_IE : 0;
+		sh_cmt_write_cmcsr(ch, cmtout | SH_CMT32_CMCSR_CMM |
 				   SH_CMT32_CMCSR_CMR_IRQ |
 				   SH_CMT32_CMCSR_CKS_RCLK8);
 	}
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ