Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp262800rdb; Thu, 30 Nov 2023 04:23:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFufKotF843Hl5P7G4vFPPZK4xZ7zLN+sgs24glQTH4QqsfOMtURWzInbNO8EbetQeaIQbl X-Received: by 2002:a05:6a00:244a:b0:6cb:8995:9028 with SMTP id d10-20020a056a00244a00b006cb89959028mr21877693pfj.19.1701347023259; Thu, 30 Nov 2023 04:23:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1701347023; cv=pass; d=google.com; s=arc-20160816; b=FrdW4nkh68qsDtvIT9Pp4/TM4oFnGsazrGtKsVRwxVIr/q1A5Rc6sN95d9+Xmb7exb /b9lWh9yVgH0CgQ45bre+Zbw8ZFwKtVFjAAxftImx4KV/cAjW0A0OWn4JSWgdhxhgnrP qCWjOC9YgocpqHMaQHGobvTDEDFoKvgiF3tbPC7b6KorWQsOVaekTM79tE73c8DGpM5b cRq2tllSnoengZpecUXSaM6RwFKjTpMKGtzZNFYoQvuLVD8SkA6j/M25rv7kCb4M5jvM 4Fp/CHIYgQLOcHrL9JNkaBie+R+8I9x6HmHKQP1jEXjLmP2SRx84lAMxBFnlFHxMDnDU H1JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tTueDx6x3QAXcukJ6Z6H1X34mDdEtjpNgKxru8qmG9Y=; fh=u/H2OOVVZ+BxcsbN4xA368fTtRxpzXinDtNqHW6xUMo=; b=XjlQ9JgdZ4SiS4EsU/xY3RWArrfFuZM5YfPMJVE/dufWBvjOH6UjWeCJ69CS9ormLl spEyZcOMFVHDhPMQ5Lj6kfnf5Y2VNbbkAkNldy/rgQu2EyrvDmX1r1yt742yCrBmzIg3 l1+YOLtBV6cf1uz7I2E9zGtzIHE6mjcS1Dz3+WmQ8rhwV7z6LTV86qMznWqWaIbRjju9 jgdRh8IsVAlSNI9xQ43N5i1JxPOxUwWRe/XzW3dC+8mN1hSTe2xD+YzR/h65xeX3xV6Y URPPo/kBZeSjBU2uyLRW1lLbQvOsu4vTFGgyrUVFtkoEE9XJ6pmuoivdTRHQlb6rybJr nyFA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=bKHqmD3y; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q21-20020a63e215000000b005859c255ce8si1214678pgh.819.2023.11.30.04.23.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 04:23:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@outlook.com header.s=selector1 header.b=bKHqmD3y; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 5C56C8028A65; Thu, 30 Nov 2023 04:23:42 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345312AbjK3MXb (ORCPT + 99 others); Thu, 30 Nov 2023 07:23:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345354AbjK3MXa (ORCPT ); Thu, 30 Nov 2023 07:23:30 -0500 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11olkn2077.outbound.protection.outlook.com [40.92.19.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C72510E3; Thu, 30 Nov 2023 04:23:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FLS5LThpD/4Dx267jd76BLT9UpfVKIbtHrmB3WIKgrlp5VEqge/VmCtQA6UhTAF6EGNxaj2RIAjmqbfRhn7s7cCMveDJ/NSESAptx1sx4f5iMr6mrvUe3VCfYXs6Zjx80ellDw54b+mQ+uCGIGOt1XbwEN1viJXFbtG5dDmplT+stU82VdrJWOC/8escm3bZOipulcHhA+yhNr5VjfDPpOI2KX0kWgYsm+czuep0WTRW4yQVxRYZLAXdTw2tSMslXII6kMKOPFITuUcz/BBx+fAvWJb1TBaNuzNvheXRrfKABg0A53pTqk5V142bkPnyh0BjvgD5xVhj6Zj9b9hGFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tTueDx6x3QAXcukJ6Z6H1X34mDdEtjpNgKxru8qmG9Y=; b=feY07/BKrgt4z2ZxhAF+m4j3bX9ktjv9Tk2HuD60pSyEVnngvYBLh0W/9VxckQc1UV+LnjLHWXY4ZhuqD2rBcSla8dg6r+t2rcUokmuyV9920Jr43IVDBZwQ38Ap7yCE6Y27d8ycHU4S+01qIq9kjT1u11ptU0OvJ86IM/9+t4UyOHIbRNFGGRFLV00zboezbEYPPeuWs/k+xVMs7nX/9Zfw+cp2vPAi30rdMnLH+8IguD6PlY9TH4tOOGkV/d/ajtiwYNqKbxDHTOaQQLPABXpjKQD8fShfjZIjnrdB+f5VXP4XExcnbpAPZHQ3VaQNKvyst6cFZsKnn1tTqKpvkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tTueDx6x3QAXcukJ6Z6H1X34mDdEtjpNgKxru8qmG9Y=; b=bKHqmD3y0OKCHsL7TxWncqCOWC/E9Xjq+nAJkhA0BWIbBhReDmy9i7ABAH1kSBTdrdQ0Fp5ISh5vtm0UtEEfBwPf14b6HUKpzlzVHe5j87MVLToWOM+sL6jAppmeDfevqO/FxbWyswxyIO/umcUI1RqcAzP2dNwZ1ESGSwkHxhQOla2U5knrcOhNNd6G4hUMtmWCtPNI7kxlJMUgRlkRCFqGVoHBOSmJLHEXYOlg/gnJr2SEcrxA4Kc4og8ISMhZFx7JqHUT2Qi0ksootiZLaiip5FgXP5wr/sTkQsiwXd7qQRMGwtehLq3Ak59MicW6jgvdbf9jhbsxTr+wG1w73w== Received: from IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) by SA1PR20MB6196.namprd20.prod.outlook.com (2603:10b6:806:33e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.24; Thu, 30 Nov 2023 12:23:32 +0000 Received: from IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::55b:c350:980:ad8]) by IA1PR20MB4953.namprd20.prod.outlook.com ([fe80::55b:c350:980:ad8%6]) with mapi id 15.20.7046.024; Thu, 30 Nov 2023 12:23:32 +0000 From: Inochi Amaoto To: Conor Dooley , Anup Patel Cc: Inochi Amaoto , Daniel Lezcano , Thomas Gleixner , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Paul Walmsley , Palmer Dabbelt , Albert Ou , Chen Wang , Anup Patel , Samuel Holland , Guo Ren , Jisheng Zhang , linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v4 1/2] dt-bindings: timer: thead,c900-aclint-mtimer: separate mtime and mtimecmp regs Date: Thu, 30 Nov 2023 20:23:25 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231130-shower-award-3cd5f1bba5db@spud> References: <20231130-shower-award-3cd5f1bba5db@spud> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TMN: [GBe5sAesTPhQ1/MDBHk1OebHxvF/D2bNgMiSlRc1Uwo=] X-ClientProxiedBy: BYAPR06CA0039.namprd06.prod.outlook.com (2603:10b6:a03:14b::16) To IA1PR20MB4953.namprd20.prod.outlook.com (2603:10b6:208:3af::19) X-Microsoft-Original-Message-ID: <20231130122326.374105-1-inochiama@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR20MB4953:EE_|SA1PR20MB6196:EE_ X-MS-Office365-Filtering-Correlation-Id: 7a57a56e-795f-456b-283e-08dbf19f2aca X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wyb3D8mAOhSTsmnD/Zkz5ELHzqa+9kFQYnLNybA/xJbEcDCTgHQYsnG0BtiX3360oEHMEkdXTTNzVE6UOmk6Mp8Ipdai00yKBY+b0ldsQUZb92NzU5ljiUf5ZNCJ+wFw7fGGLtjENjB2BFgmlPViXhELZMMIyRHZWVlxVjVb+CY5LN7ZdT3hYv2rconLLEq8o8lLzUdMWdkPaCfMuBeCGACiuH9qETNEOFRXXf5Cy9XrdVn02m2sG5fXJoNjOcBLHRICcqO1+sVjt62WdvoC8GNGkYHoXZAGPmjJUdtDH8iX5+J13zrbhcJU4tCs2OyXTjjUcvCqP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= =?utf-8?B?R0FPTVdZem5iVURZVWp3eUxiNUZtVC9rSmRGUEp6TFJBMzVISXNoNElFajlp?= =?utf-8?B?V2hnNFhxeUNLYnpnR0cwWGhkU0tWUTBGTURnZ2xKOWFkYjIvcERxL0FHN21D?= =?utf-8?B?ejluSnd0MGJGRlNFNU8vbWZKU3NRVWk4Rm5wR0FCKzlQSkk5d09HZFBvWWtr?= =?utf-8?Q?6Pda/5iHCxCxt1VKNxMvNcrEG3ir9WzsGGougdjfVfKs=3D?= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7a57a56e-795f-456b-283e-08dbf19f2aca X-MS-Exchange-CrossTenant-AuthSource: IA1PR20MB4953.namprd20.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2023 12:23:32.7319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR20MB6196 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 30 Nov 2023 04:23:42 -0800 (PST) > >On Thu, Nov 30, 2023 at 04:51:32PM +0530, Anup Patel wrote: >> On Thu, Nov 30, 2023 at 3:27 PM Conor Dooley wrote: >>> >>> On Thu, Nov 30, 2023 at 03:01:24PM +0530, Anup Patel wrote: >>>> On Sat, Nov 18, 2023 at 12:39 PM Inochi Amaoto wrote: >>>>> >>>>> The timer registers of aclint don't follow the clint layout and can >>>>> be mapped on any different offset. As sg2042 uses separated timer >>>>> and mswi for its clint, it should follow the aclint spec and have >>>>> separated registers. >>>>> >>>>> The previous patch introduced a new type of T-HEAD aclint timer which >>>>> has clint timer layout. Although it has the clint timer layout, it >>>>> should follow the aclint spec and uses the separated mtime and mtimecmp >>>>> regs. So a ABI change is needed to make the timer fit the aclint spec. >>>>> >>>>> To make T-HEAD aclint timer more closer to the aclint spec, use >>>>> regs-names to represent the mtimecmp register, which can avoid hack >>>>> for unsupport mtime register of T-HEAD aclint timer. >>>>> >>>>> Signed-off-by: Inochi Amaoto >>>>> Fixes: 4734449f7311 ("dt-bindings: timer: Add Sophgo sg2042 CLINT timer") >>>>> Link: https://lists.infradead.org/pipermail/opensbi/2023-October/005693.html >>>>> Link: https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc >>>> >>>> The ratified Priv v1.12 specification defines platform specific M-mode timer >>>> registers without defining any layout of mtime and mtimecmp registers. >>>> (Refer, "3.2.1 Machine Timer Registers (mtime and mtimecmp)") >>>> >>>> The "thead,c900-aclint-mtimer" can be thought of as is one possible >>>> implementation of "riscv,mtimer" defined by the Priv v1.12 specificaiton. >>>> >>>> If it is not too late then I suggest making this binding into generic >>>> "riscv,mtimer" binding. >>> >>> We could definitely reorganise things, it's not too late for that as >>> implementation specific compatibles would be needed regardless, so >>> software that would've matched on those will continue to do so. >>> >>> That said, does this platform actually implement the 1.12 priv spec if >>> there is no mtime register? The section you reference says: >>> "Platforms provide a real-time counter, exposed as a memory-mapped >>> machine-mode read-write register, mtime." It seems to me like this >>> hardware is not suitable for a generic "riscv,mtimer" fallback. >> >> Yes, the T-Head mtimer does not implement both mtime and mtimecmp >> so technically it only implements a portion of the ratified RISC-V mtimer >> chapter. >> >>> >>> Am I missing something there Anup? >>> >>> It doesn't even implement the draft aclint spec, given that that says: >>> "The MTIMER device provides machine-level timer functionality for a set >>> of HARTs on a RISC-V platform. It has a single fixed-frequency monotonic >>> time counter (MTIME) register and a time compare register (MTIMECMP) for >>> each HART connected to the MTIMER device." >>> >>> But I already said no to having a generic, "riscv" prefixed, compatible >>> for that, given it is in draft form. >> >> I am not suggesting T-Head timer implements aclint spec. Also, >> since aclint spec is in draft state it is out of the question. > >I did not intend to imply that you were suggesting that there should be >one. I was just trying to clarify that I was not trying to bring back >the topic of a generic aclint binding applying here. > >> My suggestion is to treat "3.2.1 Machine Timer Registers (mtime >> and mtimecmp)" as RISC-V mtimer defined by the RISC-V privileged >> specification and define "riscv" prefixed DT binding for this. > >I'm not against a binding for that at all. > >> This binding defines two possible values for "reg" property: >> 1) contains two items: a) mtime register address and, >> b) base address of mtimecmp registers >> 2) contain one item: a) base address of mtimecmp registers >> >> The t-head mtimer seems to implement #2 whereas the RISC-V >> mtimer (Priv spec) aligns with #1. >> >> If we want to keep this DT binding t-head specific then >> we should remove option #1 (above) from this DT binding > >This part is already the conclusion of one of the other "branches" of >this thread and is (AFAIU) Inochi's plan for the next version. > Yes, I have already made a new version for this. But in fact, that is just the V3 version of this patch. This is why now I still wait for some advice. The V3 version is just T-HEAD specific: https://lore.kernel.org/all/IA1PR20MB4953B8AC5CB8F8165A09D118BBB7A@IA1PR20MB4953.namprd20.prod.outlook.com/ >> and add separate "riscv" prefixed DT binding for RISC-V mtimer. > >Do you know of any users for a "riscv,mtimer" binding that are not >covered by existing bindings for the clint? > >Cheers, >Conor. > >