Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6003085rwb; Tue, 22 Nov 2022 07:37:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5R6coX3gh9swZFeZM/JhFox5EHLDKARzRg74PSteb7lVgNqMwU5j3kIVnIFWiQCmAooGyn X-Received: by 2002:a05:6402:530c:b0:462:df63:5ec5 with SMTP id eo12-20020a056402530c00b00462df635ec5mr21637818edb.147.1669131432626; Tue, 22 Nov 2022 07:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669131432; cv=none; d=google.com; s=arc-20160816; b=HoM6j08p9NQFzdLMBIY+x/IC7kwRErq7XNlZp/xAZ//I1CJQcjgOUbfHxAXaBIJnaF thfxV8mO9mE/SS5mRKdPpwpGW+EBn43/zW90K5oD0jABQHOErUUal4ilNTgeghty1CrI ZJoPKeTrWSqX2Qtu7Df20+tVPhVADIoQGtIW/3iCl5NoXcBLsUqH+qMf+5TOeypbCnFW 46TlWjmidwvanQI1QgysMHhvH9JMuwJFh5wAdawLY5T+DUbVPh3YwFpjYIkUPYPfMcaA l+yltvZdkydrXt6n6KQPsbqGNProfiC2iuZvB2ANKmaM55rufFI2Pd6FOGH3uP8eP+Ma QnLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HdlEbaE0htQR57v7n40NHmeTc34ckCyMumawDFJMeYo=; b=kUmXuVUM0Z06GDLeXjZJdWwxiCQ5kWG9FrWPrhNtU0UumW6xmgK7atq1bym/Kq3314 y9IjLKav8uY56wi6E+quS1A1d2phB4FBXVZRhNZelvG00ERMmBLQRNtY5IKk9tYoPcWv bNs4giT44fpRTLJValvc0vl4OCrPHiAyCyx+Y9f3BXPFgZADe4RXzsVzsL9zsoRCanGU WyNeMPfU9vuKhk8KBrdXagao7u9K5nJ9rCUYxzmVA14/lLkSrUjlRJWrqg+6vq7cyDNr vw2bGmxI67+CTSRsCljOEy8M0LpP3Gy4IfsSClFc8yC+r/SLP1hV8XNIztw0GB4CvRzP l1Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="hHDXnX/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg22-20020a170907971600b0078e20d9c473si12797512ejc.764.2022.11.22.07.36.48; Tue, 22 Nov 2022 07:37:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="hHDXnX/8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234201AbiKVO7h (ORCPT + 90 others); Tue, 22 Nov 2022 09:59:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234058AbiKVO7H (ORCPT ); Tue, 22 Nov 2022 09:59:07 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DB019592; Tue, 22 Nov 2022 06:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1669129052; x=1700665052; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ptcKDaqf3gRRwrB0yaoMEgRygHe9Kq+LCx/IHTSE3fY=; b=hHDXnX/8KESKJDqzyI6WdbBytWghshqQwu9FzutiFD/19vhpLLkqC4nE XrwJzYrEiuqvO6ELjgFLaO6AFdY01hajrzLsG+ZftzIOvHOlb90k4CO+S 5UET+WrQ38u+2y49C8I0hMRX1gHoYSlvlVn3J6QgrJk+oxlNpS9iSZeTB OKbA+Wmn/V+O8JnMW7IFooZS17cpu49R8+1wpXjN5LX9vw26n3bRDWXuR Zo/hLMbFSS/tOZhng44F/BN7PuiagDTUvMX1eD6h7QXwX3YDLbmPP1CZm q+xciUx4Ymqv2tcNPysDXD5VEn7CT/wwpXCuCAWg5wCaSYosbRFvQkM7u Q==; X-IronPort-AV: E=Sophos;i="5.96,184,1665471600"; d="scan'208";a="124605464" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 22 Nov 2022 07:57:30 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Tue, 22 Nov 2022 07:57:26 -0700 Received: from wendy (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12 via Frontend Transport; Tue, 22 Nov 2022 07:57:23 -0700 Date: Tue, 22 Nov 2022 14:57:05 +0000 From: Conor Dooley To: Anup Patel CC: Krzysztof Kozlowski , Anup Patel , Rob Herring , Krzysztof Kozlowski , Palmer Dabbelt , Paul Walmsley , Daniel Lezcano , Thomas Gleixner , Andrew Jones , Atish Patra , Samuel Holland , , , Subject: Re: [PATCH v2 1/2] dt-bindings: riscv: Add optional DT property riscv,timer-can-wake-cpu Message-ID: References: <20220727114302.302201-1-apatel@ventanamicro.com> <20220727114302.302201-2-apatel@ventanamicro.com> <372e37bf-ac90-c371-ad9e-b9c18e1cc059@linaro.org> <7a0477a0-9f0f-87d6-4070-30321745f4cc@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,T_SPF_TEMPERROR 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 Hey Anup, I've been meaning to get back to you on this stuff for quite a while, but unfortunately I've gotten distracted with other stuff every time I got close. Apologies for that :( On Wed, Jul 27, 2022 at 07:04:57PM +0530, Anup Patel wrote: > On Wed, Jul 27, 2022 at 6:05 PM Krzysztof Kozlowski > wrote: > > > > On 27/07/2022 14:21, Anup Patel wrote: > > > On Wed, Jul 27, 2022 at 5:37 PM Krzysztof Kozlowski > > > wrote: > > >> > > >> On 27/07/2022 13:43, Anup Patel wrote: > > > > > > Since, there is no dedicated timer node, we use CPU compatible string > > > for probing the per-CPU timer. > > > > Next time you add a properties: > > riscv,saata-can-wake-cpu > > riscv,usb-can-wake-cpu > > riscv,interrupt-controller-can-wake-cpu > > > > and so on and keep explaining that "historically" you did not define > > separate nodes, so thus must be in CPU node. > > This is a one-of-case with RISC-V DeviceTree where we are living with > the fact that there is no timer DT node. If we add a timer DT node now > then we have to deal with compatibility for existing platforms. I don't really understand the argument here. Perhaps this made sense a few months ago, but it no longer does IMO. We have existing platforms that interpreted the SBI spec (or perhaps predated the SBI spec in the relevant form?) differently. I've pasted it several times now I feel but it's relevant so pasting it here again... On the subject of suspend, the RISC-V SBI spec states: > Request the SBI implementation to put the calling hart in a platform > specific suspend (or low power) state specified by the suspend_type > parameter. The hart will automatically come out of suspended state and > resume normal execution when it receives an interrupt or platform > specific hardware event. This does not cover whether a given event actually reaches the hart or not, just what the hart will do if it receives an event. For the implementation on the Allwinner D1, timer events are not received during suspend. Through-out the various bits of conversation so far, I have been operating on the assumption that on PolarFire SoC, and potentially other SiFive based implementations, events from the RISC-V timer do reach a hart during suspend. I realised while writing this response that I have never actually tested it - the C3STOP flag caused problems for me during regular operation & not while using some DT defined sleep states. I've been learning/piecing together the bits of what is happening here as time goes on, so I made an assumption that may or may not be correct, and I am still oh-so-far from an understanding. I just took it for granted that the existing driver worked correctly for "old" SiFive stuff which MPFS is based on & figured that with ~the same core complex as the fu540 that we'd behave similarly. Perhaps that was not a good idea & please let me know if I've been barking up the wrong tree. Do we know definitively what is/isn't the case for any of the existing platforms? I can test some stuff, but it'll take some time as it's a bad week in my neck of the woods. > If we add a timer DT node now > then we have to deal with compatibility for existing platforms. In terms of what to encode in a DT, and given the spec never says that the timer interrupt must arrive during suspend, we must assume, by default, that no timer events arrive during suspend. We have a bunch of existing platforms that may (do?) get timer events during suspend, the opposite of the proposed default behaviour. I'm trying to follow the line of reasoning but I fail to see how taking either the property or node approach allows us to maintain behaviour for exiting platforms that that do see timer events during suspend without adding *something* to the DT. No matter what we add, we've got some sort of backwards compatibility issue, right? I noted the above: > Since, there is no dedicated timer node, we use CPU compatible string > for probing the per-CPU timer. If we could rely on the cpu compatible why would we need to add a dt-property anyway? Forgive my naivety here, but is the timer event in suspend behaviour not a "core complex" level attribute rather than a something that can be consistently determined by the cpu compatible? Either way, we need to figure out why enabling C3STOP is causing other timer issues even when we are not in some sort of sleep state & do something about that - or figure out some different way to communicate the behavioural differences. I would expect timers to continue working "normally" with the flag set, even if how they work is subtly different? On a D1, with the C3STOP "feature" flag set, and it's custom timer implementation unused, how do timers behave? Hopefully I've missed something blatant here Anup! Thanks, Conor.