From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12151C433E0 for ; Wed, 1 Jul 2020 03:22:58 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D1875206EB for ; Wed, 1 Jul 2020 03:22:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2NLZEHfk"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="RvCFU860" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D1875206EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=LXKJqrBIrc9ipLMTH7MxKBZA7rW8D0EmJs2ARmBJ1MI=; b=2NLZEHfkFmle+LZCamJdITVA5 v8xBisFJX0NGRnoDlYvFNgfeUEvSxBn9iGmxMkXOkXbOISc/xaCk3vLEmzigVvCkCcAcQVe2XIhiN 8+EShF2tn5sFu1VTDLBexZdJIt+xTM/w+tz2XoC5VeWgUgVFrxn/irSFJdcK53Xds0pyUDVZnEH9p F73loYVzk4NapLEW2lMunj9BCMhE6Kv8m/oS7rVISVPxU27AxFr4sraY/sv0U1wrmcpUTnV1kDN2+ 7t+NbcJKuiw+0Ki4Lmn9JWDMfpiEnibUtLN9Eeo9XnmskLnD8O+ICpLNLUi9H9yYKPklqVS7LaGIU FIhUPuwLg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqTKm-0005nZ-U5; Wed, 01 Jul 2020 03:22:52 +0000 Received: from mail-ot1-x342.google.com ([2607:f8b0:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqTKk-0005n0-Ij for linux-riscv@lists.infradead.org; Wed, 01 Jul 2020 03:22:51 +0000 Received: by mail-ot1-x342.google.com with SMTP id k15so20296849otp.8 for ; Tue, 30 Jun 2020 20:22:49 -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=j6Wcbur2BcxA/2SwdlYsRcboQiRRQa/uiPODuO/VSLs=; b=RvCFU8605SjLYaG70zLK+0uxlwZUBkkmmgtY7dm3OkUTtJEowyKrLxgWa9uI8uHYgo NCQIY3xbQ6OOVxHAAyFAtD65pQC5VJA3MjkzNSma4jPJM/Pt/thqrtlFaBqDc2ZGIzua aLJPrHDKZY9Dl2ZmoB5ZN33Sq6CvkWYPVuPOGDXWnKmA8Iqrsx32nQP19R6NTb3GtvvC +QUueFod7xsOskHR6Pv9wfqdRbmBY4SYTjC4AjJ8L6Satxjm7ca0ijJCaCgt8ylBvLJs 8X0fEXtMILLGYyIyJpzHw8mAJKdFZkAcsbs9SpjGB5MM7zFXah/seTbhuTeLSFzIMzCR 3TUA== 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=j6Wcbur2BcxA/2SwdlYsRcboQiRRQa/uiPODuO/VSLs=; b=YBUPVC5m8gA8/5sRHGU8Sw3erC5VR4bQ88yX/6U9xjRlKER6I5SwEHHPMxdfQT39X6 ++6+2rao81l1n51Xt0A0ih2lXmFgRt5lgdN7jRekq63VFev/dysuvzGkv/jsuwhM1n4i 9I2vhfDSlgbOxwa/uVQobmDxwVuaL7hpLpvUSj+exLzbcFVaGwvRlrfsJe1+O+ZiB9IH VQMveESRb7C6345gbqdaCCDgq2FrRaPBDe5Uj4/bQa7wR+ye1gW12CVuDiH3/u6UP/Vq 5e1wwDTZBavA3uTAP+9pkPSyTtcDMxewG3u/QTS6YhLx8DZ5f0niDHIE2pHJza11+Izm B89w== X-Gm-Message-State: AOAM530g3UgYsJW6JGN3TAW38bxBSesaTZQrvkWKldnekD8IK0hH06CA fjXfGJZHIlK48TV0x6wattmiPE+pnqi38THUnx67cA== X-Google-Smtp-Source: ABdhPJwQ8eI9QVyXoY0iY48/NkTpBY2b114TMeosKBxvdz0skb3SSIDgp6VBMvnsq6whxCEGjBTpV271g6emaWULuZ8= X-Received: by 2002:a9d:3a36:: with SMTP id j51mr21343282otc.129.1593573768420; Tue, 30 Jun 2020 20:22:48 -0700 (PDT) MIME-Version: 1.0 References: <3de3a480517d167a3faae086aa8ab0c0c7141d99.1593397455.git.zong.li@sifive.com> In-Reply-To: From: Zong Li Date: Wed, 1 Jul 2020 11:22:36 +0800 Message-ID: Subject: Re: [RFC PATCH 1/6] dt-bindings: riscv: Add YAML documentation for PMU To: Anup Patel X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200630_232250_749390_287DB142 X-CRM114-Status: GOOD ( 26.15 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-riscv , Palmer Dabbelt , "linux-kernel@vger.kernel.org List" , Paul Walmsley Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Mon, Jun 29, 2020 at 4:31 PM Anup Patel wrote: > > On Mon, Jun 29, 2020 at 12:06 PM Zong Li wrote: > > > > 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. > > The "3.1.11 Hardware Performance Monitor" clearly states that > all counters are 64bit > In the privileged spec, 3.1.11 section said, "The mhpmcounters are WARL registers that support up to 64 bits of precision on RV32 and RV64". It seems to me that WARL implies the size of registers could be variable, and support up to 64 bits as maximum size. > To take care of the unleashed board, the "riscv,width-xyz" DT properties > should be optional. Whenever these properties are not present, we > should assume 64bit counter width. > > > > > > > > > + > > > > > > + 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 > > Regards, > Anup _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv