Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1410178imm; Wed, 17 Oct 2018 20:12:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV60Rph/ZAFOI2+vaT9vCCeEpCGShUX4FQmXELlgqDRldjHT1RwQ493px5vGtMyXR09Lsrvix X-Received: by 2002:a63:dd0a:: with SMTP id t10-v6mr26861319pgg.379.1539832341729; Wed, 17 Oct 2018 20:12:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539832341; cv=none; d=google.com; s=arc-20160816; b=G0z/gHfk7FVu4LSVldafFmfID2tDj3ixsFqyxUcaRq8RE8XdCr5zm90lD6QX9BrLjr i3PFCSdfWHkFG18h/G2OYlFSnoetvjV1Ck153zwow2h61zeMuYNrrbo+wydkdeDCqVA1 mYB1U0+0wwhfLvYTKYEPRr/8jC5HVCKlCSB6qlBKe9v/voyVsUT6A3AC4432lyYng4Dw GiQArK+is6UbdI9BsRQRo5xUL7efx6X17L0gK7Ww5ADdU8kxxPYOgzDpDu45SwNYlj2N pEdRJLIuKsDbBp3wPqTDYWwBO+ll099ejNl3JqkCtI+75M5RL3hyaFGHOMAqcgLY7kBL TiIQ== 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; bh=nfBIqd5j7z6FehAsEoakO9Nr0ipXLvawVTuOUFtowNI=; b=AkTs5IVv5C0KN8KuaFHRUOVlK/ACSV8TA+NvMRAGNzoke7fadCILrjT/xRJb8keXUh 4BhGx/JE/hyCnP9ZCoZMX0RdPwUD5KcvcQh9w9Sp1BlsFcH5eRF2R2lEFwz7S9xfMS4N 7mWl3S16uVZO5H2W8V2CagCo83c1jiNpIUwSoBoWaVuHqKeYo1t+ax2jEWIpexH5dS0U Rc64d13dPQloVOk6dTGoZFHYwTAFyUqlqQ2SC/E0Cb2orWh7tVlhGrD3clJYCDHtB22m moaUufafqQiQSHmykIObUmRgLoCrZszovlm2Z5bHU+rmQiFbq40ECYEY32fMcUDABqlY wNpg== 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 r17-v6si18468120pgi.132.2018.10.17.20.11.51; Wed, 17 Oct 2018 20:12:21 -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 S1727359AbeJRLKF (ORCPT + 99 others); Thu, 18 Oct 2018 07:10:05 -0400 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:56324 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727280AbeJRLKF (ORCPT ); Thu, 18 Oct 2018 07:10:05 -0400 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07727201|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e02c03295;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=18;RT=18;SR=0;TI=SMTPD_---.D3jfmVO_1539832245; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.D3jfmVO_1539832245) by smtp.aliyun-inc.com(10.147.42.198); Thu, 18 Oct 2018 11:10:45 +0800 Date: Thu, 18 Oct 2018 11:10:24 +0800 From: Guo Ren To: Arnd Bergmann Cc: Andrew Morton , Daniel Lezcano , David Miller , gregkh , Christoph Hellwig , Marc Zyngier , Mark Rutland , Peter Zijlstra , Rob Herring , Thomas Gleixner , Linux Kernel Mailing List , linux-arch , DTML , Rob Herring , c-sky_gcc_upstream@c-sky.com, linfei_chen@c-sky.com, Mao Han Subject: Re: [PATCH V9 13/21] csky: Library functions Message-ID: <20181018031024.GA15088@guoren-Inspiron-7460> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 17, 2018 at 05:24:36PM +0200, Arnd Bergmann wrote: > On Tue, Oct 16, 2018 at 5:02 AM Guo Ren wrote: > > > +++ b/arch/csky/lib/delay.c > > @@ -0,0 +1,39 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright (C) 2018 Hangzhou C-SKY Microsystems co.,ltd. > > +#include > > +#include > > +#include > > +#include > > + > > +void __delay(unsigned long loops) > > +{ > > + asm volatile ( > > + "mov r0, r0\n" > > + "1:declt %0\n" > > + "bf 1b" > > + : "=r"(loops) > > + : "0"(loops)); > > +} > > +EXPORT_SYMBOL(__delay); > > + > > +void __const_udelay(unsigned long xloops) > > +{ > > + unsigned long long loops; > > + > > + loops = (unsigned long long)xloops * loops_per_jiffy * HZ; > > + > > + __delay(loops >> 32); > > +} > > +EXPORT_SYMBOL(__const_udelay); > > I can't find any indication we discussed this part before. Can you > explain (in the > changelog and in a reply) if there is a reliable high-resolution clocksource > available in the architecture? If you can read the elapsed time here instead of > using the loops_per_jiffy estimate, that would make this more robust, as > well as speed up the boot. > > If you can't do that in general, that's fine, and you can add my I'll add TODO list here, __delay should use get_cycles() and we didn't implement __udelay() __ndelay() ... We'll improve it next. Best Regards Guo Ren