Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3047886ybt; Mon, 29 Jun 2020 13:53:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw47n93AI6pLfWP3GQjofiGJnWwt48XHCzgRbhnHJFgMT8hE7LWcxUGtcHFMBxdzp0QUT4Z X-Received: by 2002:a05:6402:3d0:: with SMTP id t16mr18783672edw.287.1593464033819; Mon, 29 Jun 2020 13:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593464033; cv=none; d=google.com; s=arc-20160816; b=MbEzwBAes8hrKKwNtb6zK/jGORXzhUsAsJph9VNP8oUpgFkcyqNh9Z6hIt8lO5TM5I EIFRL4PM71T7oUfrdO1iIpJbLUWKmTs/OeBgK+G1wsP5nN/jc4KezIYFjn53NfnjQEhv LC0IjXLIW/U9pWhj6xmgrvcLZh821TTeTh8pNwh/mse3tszU4jUll4UJdG820O2+CGYi k40R5frH9U/fmWOnHYjXD82MqPFHMD3Uydclzxi64kM3nY6zIaKytJ+6C4FV7AkzNAk1 GyYRQSf1CsnyC9dNIWBRCp6mRVELemo2D7ytSGP7xMAEIIlwrk62mo4wndWsXa5bTnJS CZeA== 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:dkim-signature; bh=+6Di78aul04vs2kyIJtsqSNPWqTVlpseLwhNlVPJlCw=; b=VMv2+7YqBOlWMDa8MtjQ5GCNqTvlyh/Fzw77zhp3lLDVnvDDeY1nFbT2NlkQy5C/sr sRXNZIiol+3r3OemcBtdRiXV/PkTx6jPEFRZz68LevCVMiKnydpQGa5Zp03bNJXoreav GmmGDbhxXhyaXtFxVsF+f90HaQ0x3tEBONsxsd2Wx6QoNf4946Wb7nu2cC2J0UdzQjiF pPjZxwEjt1LD6HdzgC5izuUYXm9yBMp4vvVucg4BWd048tWJGm0KiLPNkHqQ3xP5zgZO xwcR4uJ4C3MVVljEb/J3hxpDTatQVxGEfLKfoRcbY86YTd+Ol47B3CKecjHIPwVuqjMg N3YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=jB71Ljjq; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb4si364538ejb.173.2020.06.29.13.53.30; Mon, 29 Jun 2020 13:53:53 -0700 (PDT) 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=@sifive.com header.s=google header.b=jB71Ljjq; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731454AbgF2Uub (ORCPT + 99 others); Mon, 29 Jun 2020 16:50:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731452AbgF2TNf (ORCPT ); Mon, 29 Jun 2020 15:13:35 -0400 Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CE7CC08EB30 for ; Sun, 28 Jun 2020 23:36:07 -0700 (PDT) Received: by mail-oi1-x244.google.com with SMTP id l63so13478109oih.13 for ; Sun, 28 Jun 2020 23:36:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+6Di78aul04vs2kyIJtsqSNPWqTVlpseLwhNlVPJlCw=; b=jB71Ljjq1eBRRMow3ePRUvEUQNwMfHAqv9mcp0yegcgOVA2UsvNwiMG2zLfZ8JVZ/r f0CHXYLQ/yer0HIXZkBafxzwQhkWzsoZUNmApVOMiciGG2kr8AqjAF5JDOb0sNFgonkH BJqaXq71xyAFuJyeF2Ifg3SFLTBmmkI3SAgMT4b6kGScWcc5PZ0PukTdyhON7/07MRvf HlZdVMdh24gdrmnmh4Zp9VPjAVtiCbD7GN26cDy9LTiwY/F7ioVTN9UWztx+kQo0RyJn jY5SpKDwmkn2uWBOYXWmPbFka+EA1mC1mklgB62+SF12rIHoOQpCQRmNdKK9aup8EwJW fEUQ== 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=+6Di78aul04vs2kyIJtsqSNPWqTVlpseLwhNlVPJlCw=; b=QsCPh6lYVenA4umKwEKvPkMYiF4parbZxtXoiakKGBu50TFDmSC6qVRHBaG0y5h9+y jDrg09UsnwRl9RDfmwKziGB/cMHTeKRvau/gut2F06OZGo5lO8NhgC4huxgUv37vPwHu DG3TySz9JRm173xfqCcOmDTVfMRg3NPfHblwCQUjQ1rc1jYLySOfiV50lVyW9eGyljC7 NmTOXxs/Sxbo2eKJ0xK8dDZhZqZf6066lD9f1b35NUb8CQRBkJBaSEQJ/euFhI1FhVhi TVxZ9D5UrsWnJCyt8Nk4NCurxa4FeR6AcB2wkVqmYrpyTDbJqMs9jUq9kvuHwiCfpR/p 61zg== X-Gm-Message-State: AOAM532Qj136b8YFf6ir2aHb3awtqhMWOKpglaMGH1C9VFFR0YTUzYU4 /dSQxF9qATu4r7cHVy68uRq416NxKawjC+BWwwTWzg== X-Received: by 2002:a05:6808:919:: with SMTP id w25mr11077804oih.91.1593412566656; Sun, 28 Jun 2020 23:36:06 -0700 (PDT) MIME-Version: 1.0 References: <3de3a480517d167a3faae086aa8ab0c0c7141d99.1593397455.git.zong.li@sifive.com> In-Reply-To: From: Zong Li Date: Mon, 29 Jun 2020 14:35:55 +0800 Message-ID: Subject: Re: [RFC PATCH 1/6] dt-bindings: riscv: Add YAML documentation for PMU To: Anup Patel Cc: Palmer Dabbelt , Paul Walmsley , linux-riscv , "linux-kernel@vger.kernel.org List" 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 Mon, Jun 29, 2020 at 12:38 PM Anup Patel wrote: > > On Mon, Jun 29, 2020 at 9:58 AM Zong Li wrote: > > > > On Mon, Jun 29, 2020 at 12:09 PM Anup Patel wrote: > > > > > > On Mon, Jun 29, 2020 at 8:49 AM Zong Li wrote: > > > > > > > > Add device tree bindings for performance monitor unit. And it passes the > > > > dt_binding_check verification. > > > > > > > > Signed-off-by: Zong Li > > > > --- > > > > .../devicetree/bindings/riscv/pmu.yaml | 59 +++++++++++++++++++ > > > > 1 file changed, 59 insertions(+) > > > > create mode 100644 Documentation/devicetree/bindings/riscv/pmu.yaml > > > > > > > > diff --git a/Documentation/devicetree/bindings/riscv/pmu.yaml b/Documentation/devicetree/bindings/riscv/pmu.yaml > > > > new file mode 100644 > > > > index 000000000000..f55ccbc6c685 > > > > --- /dev/null > > > > +++ b/Documentation/devicetree/bindings/riscv/pmu.yaml > > > > @@ -0,0 +1,59 @@ > > > > +# SPDX-License-Identifier: GPL-2.0 > > > > +%YAML 1.2 > > > > +--- > > > > +$id: http://devicetree.org/schemas/riscv/pmu.yaml# > > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > > + > > > > +title: RISC-V Performance Monitor Units > > > > + > > > > +maintainers: > > > > + - Zong Li > > > > + - Paul Walmsley > > > > + - Palmer Dabbelt > > > > + > > > > +properties: > > > > + compatible: > > > > + items: > > > > + - const: riscv,pmu > > > > + > > > > + riscv,width-base-cntr: > > > > + description: The width of cycle and instret CSRs. > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + > > > > + riscv,width-event-cntr: > > > > + description: The width of hpmcounter CSRs. > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > > > The terms "base" and "event" is confusing because > > > we only have counters with no interrupt associated with it. > > > > > > The RISC-V spec defines 3 counters and rest are all > > > implementation specific counters. > > > > As I know, there are 2 counters of spec definition: cycle and instret. > > What is the 3rd counter you mentioned? > > TIME is a counter CSR. > > > > > > > > > I suggest using the terms "spec counters" and "impl counters" > > > instead of "base counters" and "event counters". > > > > OK, they are good to me. Let me change it. > > > > > > > > > > Further, "riscv,width" properties are redundant because > > > RISC-V spec clearly tells that counters are 64bit for both > > > RV32 and RV64. > > > Sorry for the lost replying. The maximum length of counters is 64, but it doesn't require to implement all bits. A real case is that unleashed board only implements 40 bit for mhpmcounters. > > > > + > > > > + riscv,n-event-cntr: > > > > + description: The number of hpmcounter CSRs. > > > > + $ref: /schemas/types.yaml#/definitions/uint32 > > > > + > > > > + riscv,hw-event-map: > > > > + description: The mapping of generic hardware events. Default is no mapping. > > > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > > > + > > > > + riscv,hw-cache-event-map: > > > > + description: The mapping of generic hardware cache events. > > > > + Default is no mapping. > > > > + $ref: /schemas/types.yaml#/definitions/uint32-array > > > > + > > > > +required: > > > > + - compatible > > > > + - riscv,width-base-cntr > > > > + - riscv,width-event-cntr > > > > + - riscv,n-event-cntr > > > > + > > > > +additionalProperties: false > > > > + > > > > +examples: > > > > + - | > > > > + pmu { > > > > + compatible = "riscv,pmu"; > > > > + riscv,width-base-cntr = <64>; > > > > + riscv,width-event-cntr = <40>; > > > > + riscv,n-event-cntr = <2>; > > > > + riscv,hw-event-map = <0x0 0x0 0x1 0x1 0x3 0x0202 0x4 0x4000>; > > > > + riscv,hw-cache-event-map = <0x010201 0x0102 0x010204 0x0802>; > > > > + }; > > > > + > > > > +... > > > > -- > > > > 2.27.0 > > > > > > > > > > Regards, > > > Anup