Received: by 10.223.164.221 with SMTP id h29csp2096376wrb; Thu, 2 Nov 2017 05:56:24 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Syn7hxUJoqMCVuIzb5oaFZ7WYXsOgmCN99+e/5rjEiR04wGZcIVJWCDJOYGT5M70dvRixS X-Received: by 10.84.237.9 with SMTP id s9mr3074693plk.417.1509627384021; Thu, 02 Nov 2017 05:56:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509627383; cv=none; d=google.com; s=arc-20160816; b=SgEqhfxg+L0p+Mu0Oh83bd0saRFp2BscriZskA2noIhtWnB9r8vt2F224sHJQ9q8g3 DH7LKVYbEG1qa/rU+jhZzvWjXyK4LiPj0YH8fGID/B90jKr8yUWl4BJditrXDbRIbgMj K8A7Woq12t+ERS6g9xe+Z/pVw8dQRnBGJxw21sgwT+nBZXntdXqlXPFALRe0xQgyBS/8 G21Vebm4Mo1n0072vP4rMJCoLaVrHuI1Sy9rRoZ9WO5yWBpdeai4d9XjVnAxa6YChYnE N2dDMC3e447dGxwuDT/hS8A5ANrOTnHKCwBTERsIaw9ffLcDS4sWQLW4qlS3tiHvm3xp UZJA== 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:arc-authentication-results; bh=xH6rVxZcuupMZZSU/H8utEi1cskYmgX2LdzBhtmTbmo=; b=JcWjlGiMvgeArH/zVv6DCmDks+cbfcZN6HpaeQj/isIT8+V+/BT7aiweR4m0AscdeR q6aehQneYVkZSZoy3KHgv6bGrzESI6/WZ2W7OfqjnuxBp4emHOnnUrqQZzWZcv6QrEDf VUhRMSqx0en7pENnnP92kHs0W/Gdd/Z+Or4EIFlLWGXj1iGOkHpeUEnNkJx/v1FZ1gx4 HS7bFQ4m5T9k/CKAey6kwVBZzl70H65DK3xTJWesJ5x4xnwUkPALHusVAUkjkH6/d9j9 uYTXdiK89R09BED+t+rMqJ25e5CNY3UISDAkwpZ9MrOsbK99uG+ksS9S0XnMxg1uEJXM 2hfg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si2170563pln.146.2017.11.02.05.56.09; Thu, 02 Nov 2017 05:56:23 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754804AbdKBMz1 (ORCPT + 96 others); Thu, 2 Nov 2017 08:55:27 -0400 Received: from 19pmail.ess.barracuda.com ([64.235.154.230]:41118 "EHLO 19pmail.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752392AbdKBMzZ (ORCPT ); Thu, 2 Nov 2017 08:55:25 -0400 Received: from MIPSMAIL01.mipstec.com (mailrelay.mips.com [12.201.5.28]) by mx1402.ess.rzc.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NO); Thu, 02 Nov 2017 12:53:45 +0000 Received: from localhost (192.168.154.110) by MIPSMAIL01.mipstec.com (10.20.43.31) with Microsoft SMTP Server (TLS) id 14.3.361.1; Thu, 2 Nov 2017 05:53:05 -0700 Date: Thu, 2 Nov 2017 12:53:59 +0000 From: James Hogan To: Miodrag Dinic CC: Aleksandar Markovic , "linux-mips@linux-mips.org" , Goran Ferenc , Aleksandar Markovic , "David S. Miller" , Douglas Leung , Greg Kroah-Hartman , "linux-kernel@vger.kernel.org" , Mauro Carvalho Chehab , Miodrag Dinic , Paul Burton , Paul Burton , Petar Jovanovic , Raghu Gandham , Ralf Baechle , Randy Dunlap Subject: Re: [PATCH v6 5/5] MIPS: ranchu: Add Ranchu as a new generic-based board Message-ID: <20171102125359.GN15235@jhogan-linux> References: <1509364642-21771-1-git-send-email-aleksandar.markovic@rt-rk.com> <1509364642-21771-6-git-send-email-aleksandar.markovic@rt-rk.com> <20171030164523.GA15235@jhogan-linux> <48924BBB91ABDE4D9335632A6B179DD6A74206@MIPSMAIL01.mipstec.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <48924BBB91ABDE4D9335632A6B179DD6A74206@MIPSMAIL01.mipstec.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-Originating-IP: [192.168.154.110] X-BESS-ID: 1509627225-321458-20098-76388-1 X-BESS-VER: 2017.12-r1709122024 X-BESS-Apparent-Source-IP: 12.201.5.28 X-BESS-Outbound-Spam-Score: 0.61 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.186513 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.60 MARKETING_SUBJECT HEADER: Subject contains popular marketing words 0.01 BSF_SC0_SA_TO_FROM_DOMAIN_MATCH META: Sender Domain Matches Recipient Domain X-BESS-Outbound-Spam-Status: SCORE=0.61 using account:ESS59374 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, MARKETING_SUBJECT, BSF_SC0_SA_TO_FROM_DOMAIN_MATCH X-BESS-BRTS-Status: 1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 02, 2017 at 12:47:27PM +0000, Miodrag Dinic wrote: > > > +static __init uint64_t read_rtc_time(void __iomem *base) > > > +{ > > > + u64 time_low; > > > + u64 time_high; > > > + > > > + time_low = readl(base + GOLDFISH_TIMER_LOW); > > > + time_high = readl(base + GOLDFISH_TIMER_HIGH); > > > + > > > + return (time_high << 32) | time_low; > > > > What if high changes while reading this? > > > > E.g. > > TIMER_LOW 0x00000000 *0xffffffff* > > TIMER_HIGH *0x00000001* 0x00000000 > > > > You'd presumably get 0x00000001ffffffff. > > > > Perhaps it should read HIGH before too, and retry if it has changed. > > This was already discussed in some earlier posts. (https://patchwork.linux-mips.org/patch/16628/) > Reading the low value first actually latches the high value, > so it is safe to leave it this way. Here is the relevant RTC device > implementation in QEMU: > > static uint64_t goldfish_rtc_read(void *opaque, hwaddr offset, unsigned size) > { > struct rtc_state *s = (struct rtc_state *)opaque; > switch(offset) { > case TIMER_TIME_LOW: > s->now_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->time_base; > return s->now_ns; > case TIMER_TIME_HIGH: > return s->now_ns >> 32; Ah okay. In that case the side effect of reading low clearly isn't obvious enough reading the driver code and it needs a comment to clarify the hardware behaviour :-) Cheers James From 1582958684093174586@xxx Thu Nov 02 12:50:40 +0000 2017 X-GM-THRID: 1582683942030413790 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread