Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp795201imm; Wed, 17 Oct 2018 08:26:00 -0700 (PDT) X-Google-Smtp-Source: ACcGV61jwCsskM7N/rYnTuG4rI1llgPkS7QCjBX+6hr0fH2UulJ0KH9g7FGeVgTnXnkrv1wUIH7n X-Received: by 2002:a63:3842:: with SMTP id h2-v6mr24726233pgn.300.1539789960044; Wed, 17 Oct 2018 08:26:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539789960; cv=none; d=google.com; s=arc-20160816; b=wtRowaJ4fMiPmWtzZ0eCiSZ/sgvkTL6xb+toDFhv9llo7c2/36WbuEc5Y03vNAY7aU HWLeush/sKy9+zt0lWMuhOf7zdjllVJuy5dZYKTlngQz6js63CLDwBVhkUm9SDzbh3cx ZlVN3S0yzVSzw/Rv7xjUnDgaeQdmZ5l7qaEPfVG7+OiYPjL8zLbUWI74t2VplgR1xms0 Kz6cGh0vtXdITPjYGgpJWmy/EKF+z6QPOv8AOHI535/nXAtjc1kzOSxhjaFV3rgAm82N 0kJfc72HLpQK9ns7ZGcrcLESUy78qIZbcQGCNWNB6b5OCQ3AhoAgBRaARt9/mnE5oGzI Pi8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=MaGRLek2OX0zEc2g5QRc22boZKv7PEzfJvudm/qjq4I=; b=eWwaHSiDyEVhNjmScvcuwaozJyL2Zs0kD85//wvazjI7Vc3eRpltX+kCbRXsCZl6as lNCxcUESz+QRFuvZNMka9i+DXY2LyHGNNPBTGwBndWfoLX/fLeqvE88DEfi4Pa+zOvLe 31T1xJsxceBVyjWt3LJU3RwS6wJ2nN1ZPgyoQ1+JZnHrtux8zL46X9Cb/AMWry4tXwTY Q6qdSqcCYR3Btup12sj14S1nTKotIGRWwynyzsrKhP16kJK28H0HaIJOMrYMxjBz8fJc UtbgZLefWPSrnuaZrVyHWRw3BAqsMDtyNNxmU/twy2qkxY8iHyiDJXTbE8V/GpiCOIYy 43lQ== 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 s63-v6si18668559pfb.217.2018.10.17.08.25.43; Wed, 17 Oct 2018 08:26:00 -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 S1727731AbeJQXVF (ORCPT + 99 others); Wed, 17 Oct 2018 19:21:05 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:44685 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727013AbeJQXVE (ORCPT ); Wed, 17 Oct 2018 19:21:04 -0400 Received: by mail-qk1-f194.google.com with SMTP id y8-v6so16701169qka.11; Wed, 17 Oct 2018 08:24:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MaGRLek2OX0zEc2g5QRc22boZKv7PEzfJvudm/qjq4I=; b=F57Ltvsf1LVZ8+K6hI1OO8RnfZv9qsQY67XM1nalDcrdu/0q0OIWHP0yjKrXZmy51k RXaAPJovWzKV4K6AShnzT93tL3O7b8t6okbwcIMXMTa45tJyThwLJ7WpXQeBzIIUKXPN WpKvuWOLTK8IbFVll+p+kqr5kGSp4WOikexT+DOLgumxUw5Lw6zTOUbsZdB2SKjPE4IG wP/6VLcer/Ed2So+Y+nR1Pu91f/9chwje3Uj+uGdTHXu2NLKM8wOKSFPzMTXChKaehPE gwsUw+Ej+wgf8QNiiVVK1wAM/x2CR5nJrM2e9c6mZ8i1X7RnGu1B1iwm3Do/w9EhOPM2 n2XQ== X-Gm-Message-State: ABuFfojiusMgrWSx3dRpFTUk0Uq4GIjJK3j/4fnz5aYi9eERRQa0wzqy fAzCCGAdLd0Q3dEFzZFNncqufSrE/bGsa0eW30g= X-Received: by 2002:a37:e21a:: with SMTP id g26-v6mr24536179qki.330.1539789892521; Wed, 17 Oct 2018 08:24:52 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Arnd Bergmann Date: Wed, 17 Oct 2018 17:24:36 +0200 Message-ID: Subject: Re: [PATCH V9 13/21] csky: Library functions To: Guo Ren 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Reviewed-by: Arnd Bergmann