Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp780198imu; Tue, 20 Nov 2018 06:54:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/VYxDAAPDP9wYSsoqf8TA1YUfS8LLmP3V341e+OYt1OX7JVxJygJlPqp7IeBrTxqt0/Jo5L X-Received: by 2002:a17:902:b584:: with SMTP id a4mr2549250pls.246.1542725678129; Tue, 20 Nov 2018 06:54:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542725678; cv=none; d=google.com; s=arc-20160816; b=O9etqpvbSXuGgK7IXvK7fTOxB1rDC70CzDYNgWEoxYc9lYca8iu+b9zv6tI8dMLJeT rwoXl9klbVEMnV0BIAHmrys489X/oIKuWOs0lD7jxbLJjXyAX4pxBwjr0tfVQPh59ErI GwiTfwgssTfnB2N3QtYCsmY+5SLcWKjoli7PxKpni48CTHKYbNEtEHFulF7ZQLtVSgyr /psTJ6gWVlK8arsDyBRHkn2ZC0jUiEE6EdqL79N6bZggql+hC8icGDASIdJ0C9swhdJb 8CW+PPEuNk7A6oxyz2NRiAOQFYDH/pgcjz2ZC8IIAFyQrkEaoNXKMJSK6x15qqYUHLAV A+Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lYB4xqSJtkzhhD7ckpSBmuTLtmqzQ+/DBGZbGVQg8ro=; b=SfrmdAhWAQ4N1jdwBEaGg1OodT2Grc9N+0V4UOzpFLwGnVgLSrYarvLRb20dsY3gvJ OuzCXNtXR9tYpcQDTW0ZT9M+HTwPs7YJ12Gpb8+8Om5T8xWzRPvVhOAnHwcZ53W+H4NR 7kGt0gmpV8osgZv/Lxs28bhpifLF94VwGsM9lNIPxlHRhSyPl/tTkmg+XhMvDxHBHBOA PdRrRy+FRvEygAuNCY9eC2zm9ONEz/9Y85VezGmnTlTe9O7S3l0qkcTyGIw7SQq2gq7Y z8Fm639AUy7/p8bLl8FCPquDrh1fF4LUQQxO/hbXP/bca4t4mKlydFyc5+0NaSz3gXpB samQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hUExi1JK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q61-v6si43809548plb.418.2018.11.20.06.54.23; Tue, 20 Nov 2018 06:54:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hUExi1JK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729361AbeKTWiL (ORCPT + 99 others); Tue, 20 Nov 2018 17:38:11 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:38704 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728785AbeKTWiK (ORCPT ); Tue, 20 Nov 2018 17:38:10 -0500 Received: by mail-pg1-f193.google.com with SMTP id g189so825949pgc.5 for ; Tue, 20 Nov 2018 04:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=lYB4xqSJtkzhhD7ckpSBmuTLtmqzQ+/DBGZbGVQg8ro=; b=hUExi1JK5WhH41XsKdVxt9hNA2nMaPU1u7lopJNUtboAe8znTyudRBbnT1RFo+GeoM CvjztmVsrHkR1bJCRxiw9gxb7qPqL36WPIlJP9z3fvyOE2f1mF/jC/GEwsqHgkVYsxye gbzLsXZ7VT8QXTCqxp2SEEhdRqe+C7Tr4ga38= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=lYB4xqSJtkzhhD7ckpSBmuTLtmqzQ+/DBGZbGVQg8ro=; b=GPllnctpasgMUscqEtjL7chm4KsMBz+ZW9yPJvAQbiWGMvf+IRPz4rvJ1VazrrKbdt 4ZkC+rkFh2JanUR2Sa9bUiO75EVtMGltK8feTKI9fT9lMZ4Hj9RQ4oinrux8upCfs9hd 60bOHSSw/i9Gf2Yeso1emcfzhk1B0E1ShQrjCztq04NprfWwXlHPl4ET1hG63ad8X0qC ZWlT05WcAxhHYG51Y2WHfq778yoFir3H/T6+DRrMC6/68e7ixvOdc5gX25Qa7jt1GH1G PnQl4Bpc5y/rl39lSGu42Xh26hK/qNWACbImBBKwOTzoYod+NoHGz1PCEDQcbzj257bY qctQ== X-Gm-Message-State: AGRZ1gLWeoIL7Wxzh/oVXCa5V46JejbAbQn5Ki1OuDmIOnUhP1ME9j8T OdSLdXCxkGbtljdrK4/IVrrp X-Received: by 2002:a62:6981:: with SMTP id e123-v6mr1911576pfc.104.1542715760805; Tue, 20 Nov 2018 04:09:20 -0800 (PST) Received: from mani ([103.59.133.81]) by smtp.gmail.com with ESMTPSA id m3sm68668940pgl.69.2018.11.20.04.09.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 20 Nov 2018 04:09:19 -0800 (PST) Date: Tue, 20 Nov 2018 17:39:10 +0530 From: Manivannan Sadhasivam To: Marc Zyngier Cc: Linus Walleij , Olof Johansson , Arnd Bergmann , Rob Herring , Thomas Gleixner , Jason Cooper , Daniel Lezcano , Linux ARM , "linux-kernel@vger.kernel.org" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Amit Kucheria , zhao_steven@263.net, Andreas =?iso-8859-1?Q?F=E4rber?= Subject: Re: [PATCH 12/16] clocksource: Add clock driver for RDA8810PL SoC Message-ID: <20181120120910.GA13485@mani> References: <20181119170939.19153-1-manivannan.sadhasivam@linaro.org> <20181119170939.19153-13-manivannan.sadhasivam@linaro.org> <20181120050650.GC5885@Mani-XPS-13-9360> <86pnv0rwna.wl-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 20, 2018 at 11:05:41AM +0000, Marc Zyngier wrote: > On 20/11/2018 08:56, Linus Walleij wrote: > > On Tue, Nov 20, 2018 at 9:17 AM Marc Zyngier wrote: > > > >> How does this change anything with the fact that the above code is > >> broken? 56 or 64 bit, you cannot read this counter with a single > >> access, or two. The canonical way of reading such a counter is > >> something like this: > >> > >> do { > >> lo = readl_relaxed(LO); > >> hi = readl_relaxed(HI); > >> } while (hi != read_relaxed(HI)); > > > > To be fair, I have seen hardware that employ a logic latch > > such that when a read access is done to the LO register, > > the value of the whole counter is latched, also for the HI > > register, so when you read the HI register in the second > > step, it is never subject to wrapping. (Conversely reading > > the HI before the LO will always give you insane values > > :D) > > I've seen such HW indeed, and I've also seen it being broken... ;-) > > It this timer is built around such a (non-broken) logic, I'd really like > to see it spelled out. It will otherwise be a real pain to debug... > There is no information about HW latch in datasheet and vendor code. But the vendor driver doesn't use any logic to prevent wrapping. However, this doesn't mean that we can assume that the hardware is capable of preventing overrun. So I guess it is best to go with Marc's suggestion here. Thanks, Mani > > However the above code should be fine unless you know > > for sure the hardware was constructed with a clever latch. > > Let's find out! > > Thanks, > > M. > -- > Jazz is not dead. It just smells funny...