Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6788898pxb; Wed, 17 Feb 2021 13:32:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7K6E/FFrXi5yA1DH1p+joQk8azEqd7hlgolvyAWCLlAZFhirVTw3DYl1NQz/2tNbUJP0p X-Received: by 2002:a05:6402:610:: with SMTP id n16mr779911edv.288.1613597571238; Wed, 17 Feb 2021 13:32:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613597571; cv=none; d=google.com; s=arc-20160816; b=yExfVfAURgvRk2JmhJawbf9F2n9MVPM93LbFUernKKrEGmX7AqmVYtum8NRcQt+P2p y5jk3UKKgzcHu3KK9M6ef+OQz4DMyLOabh2DcddAF8ycnsX3y7aWBGjYAEZW3+QfU9/Q KtUPAPPemQOyKIdyJxaQPCy2/0/XFUBWsLZ0JrIRfKDms7VePiHMJ6pwCum8utMK31Ns kCd6fIREJlFyoTujymOzc9RjYVUNjfsTX8KngatgAuNXrA8wADzEg6h2rwN0lYyz7d0T nuvcj0MPSOJ2UOLP21Kz13WzNCRThPSTQat75qWOCDxvOBVNgwFcwif45zFKXtF2KoJT 3aVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2go1+ZpvC0e1wx0Dfdv5Zsl8e6dhv97GMkE0UiMJMM8=; b=0Yjg+Y7wUN7bdGGUdWz4YAwOpNuHFadiptQgOWGR4abnLdMiLfqENjCcfGKYtCinS1 1r0zHqCiD6LDlbIrCWtBaEL/YPndoixhm+KPZ4pgLklc0MDZ/UBlU9Y7Gs3Mi4WHBObC Nd7yRtp/ZvHGk5hkuPkXezuyfeb8WAOsy456hMmth4dQv2cw3XLEBITjXysM06dqH7f5 pOwyd1nIjdBcvWxWbn4BnOrG8f0RfGlDzwDidlQWyJLz3UqlWx3wvwZKjAyG1d0a2d4o FWkL1ZE8PcEyPs+4TyOYyDSQ2IiyAfjQg/7a1QXwivaFm2+XKfuNT9OHcxGXSosPIO38 O+aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IIUYl+kx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si1835462ejo.251.2021.02.17.13.32.17; Wed, 17 Feb 2021 13:32:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IIUYl+kx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232968AbhBQVb2 (ORCPT + 99 others); Wed, 17 Feb 2021 16:31:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:51166 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232890AbhBQVbM (ORCPT ); Wed, 17 Feb 2021 16:31:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5497664E85; Wed, 17 Feb 2021 21:30:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613597431; bh=WgRxiqmGWb/NNjj30Km3X2UGAL7IO9ln+kqQU/TQu6U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=IIUYl+kx286L8XAbuoI1nFhR6GLGmWR37+lXiZQPd90hH0szDCBrQ5FWMXeULISx4 gaGpIyG2FFlt+DMObk0hMPlCkYnTawuCtljEEkzUUU0RSvnC0yJ0NNUKpMYcekSOvh Yh32Mpve4kb1c1Vs1CdrIcxcOXSPV0X7VowLnjotPugA6AEXPwYJ8z2NkUvAafVWit Inak6DJoiZrLTk28Ij6mL2nyqxB6h8v1qO5SCswhTtT4OiUmdFL3E4UQqf2I8jn7nS k1Q+T/5tBxPh2r++1Q5iSVvz81r6cURl4C0hA/4QwHqr2FZznojt5aH8PwyLmIDWrV FMrnWA7HNT1OA== Received: by mail-ot1-f50.google.com with SMTP id 80so33786oty.2; Wed, 17 Feb 2021 13:30:31 -0800 (PST) X-Gm-Message-State: AOAM531JY6QzHLiBU7S5n6LuNv4XVtzclYzmJ84vdsYFYNEQqs6tO3mX 21eUbij8ekOttpQWyG9r4iK3+T+MmB7u73HZPYU= X-Received: by 2002:a05:6830:1db5:: with SMTP id z21mr807185oti.210.1613597430588; Wed, 17 Feb 2021 13:30:30 -0800 (PST) MIME-Version: 1.0 References: <1613012611-8489-1-git-send-email-min.li.xe@renesas.com> In-Reply-To: From: Arnd Bergmann Date: Wed, 17 Feb 2021 22:30:14 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH net-next] misc: Add Renesas Synchronization Management Unit (SMU) support To: Min Li Cc: Derek Kiernan , Dragan Cvetic , Arnd Bergmann , gregkh , "linux-kernel@vger.kernel.org" , Networking , Richard Cochran Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2021 at 9:20 PM Min Li wrote: > > I attached the G.8273.2 document, where chapter 6 is about supporting physical layer > frequency. And combo mode is Renesas way to support this requirement. Other companies > may come up with different ways to support it. > > When EEC quality is below certain level, we would wanna turn off combo mode. Maybe this is something that could be handled inside of the device driver then? If the driver can use the same algorithm that is in your user space software today, that would seem to be a nicer way to handle it than requiring a separate application. > > > This function will read FCW first and convert it to FFO. > > > > Is this related to the information in the timex->freq field? It sounds like this > > would already be accessible through the existing > > clock_adjtime() interface. > > > > They are related, but dealing with timex->freq has limitations > > 1) Renesas SMU has up to 8 DPLLs and only one of the them would be ptp > clock and we want to be able to read any DPLL's FFO or state Is this necessarily unique to Renesas SMU though? Not sure what makes sense in terms of the phc/ptp interface. Could there just be a separate instance for each DPLL in the phc subsystem even if it's actually a ptp clock, or would that be an incorrect use? > 2) timex->freq's unit is ppb and we want to read more precise ffo in smaller unit of ppqt This also sounds like something that would not be vendor specific. If you need a higher resolution, then at some point others would need it as well. There is already precedence in 'struct timex' to redefine the resolution of some fields based on a flag -- 'time.tv_usec' can either refer to microseconds to nanoseconds. If the range of the 'freq' field is sufficient to encode ppqt, you could add another flag for that, otherwise another reserved field can be used. > 3) there is no interface in the current ptp hardware clock infrastructure to read ffo back from hardware Adding an internal interface is the easy part here, the hard part is defining the user interface. > > Wouldn't any PTP clock run in one of these modes? If this is just > > informational, it might be appropriate to have another sysfs attribute for > > each PTP clock that shows the state of the DPLL, and then have the PTP > > driver either fill in the current value in 'struct ptp_clock', or provide a > > callback to report the state when a user reads the sysfs attribute. > > > > What you propose can work. But DPLL operating mode is not standardized > so different vendor may have different explanation for various modes. If it's a string, that could easily be extended to further modes, as long as the kernel documents which names are allowed. If multiple vendors refer to the same mode by different names, someone will have to decide what to call it in the kernel, and everyone afterwards would use the same name. > Also, I thought sysfs is only for debug or informational purpose. > Production software is not supposed to use it for critical tasks? No, you are probably thinking of debugfs. sysfs is one of multiple common ways to exchange this kind of data in a reliable way. An ioctl would probably work just as well though, usually sysfs is better when the information makes sense to human operators or simple shell scripts, while an ioctl interface is better if performance is important, or if the information is primarily used in C programs. Arnd