Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp209199lqr; Wed, 5 Jun 2024 03:54:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV4ddzLIj2RclYkOQXsnvOTGyHZQ8vO7DWqZMseCdWyX7dQAScwFiQcQDjVE/YzfUE8GsbGi9XhaH6p9bFlMtlX2+br0I73UlnoPXcLZQ== X-Google-Smtp-Source: AGHT+IFydMUa/3NjKjqj3Ge39S6lp7r+NK1zAWj9BGtR9cCbTIKVpjvj7bX5QdbRwpbi3GlKRAE5 X-Received: by 2002:a05:6a20:da86:b0:1ae:4266:b39c with SMTP id adf61e73a8af0-1b2a2c0a647mr7601345637.17.1717584883161; Wed, 05 Jun 2024 03:54:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717584883; cv=pass; d=google.com; s=arc-20160816; b=DWLnIAAVAsOH9/Ye2coTvNQyoNtwTf2P+SzErNGXvohgdFPfNjC6MceJXfIBAoCD9z +pHAmAu69Ff8oJV2+TxEh+0BYqwwoF3Hum7mCDeYrRM7GCUp8wo/wCXf+S1rZ3EUlb3U OFG8ywtuZtKJ00SXpCRaMvy59pUdeef0OASZQ9+j94LUisbZmm1X9j2LWYyP0lToXl86 SlzcUfSpe0QfhsuhJ3oCM+/L3xkhCkYkoT0oJZo56qJg+B7B0bs0X87FMRJjCeqryCcg VLVl/ZXalYDLSAyr8HTFkFDY1OKQy4ld8K0unLa1omPSRWD8DNLGKmkY5AWgD4aLaz7z AGlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=jwOYdBEP20eHqXfiLB/uZRRK7vGmn2sMRMDnSyVKlSw=; fh=CqeGLXh83TzSGaFcqRQ152TUlnd8BfmcVUygYXJzF4c=; b=Yy91stFTkmhjzvkvqK6eJGsX1QpW3vrPgkWB/wm7VJ23O04I+GfI6kOgZdNxr+iMnC XA6+kmXS7rWdaToL9uUytV8r5fEtdgvPoHiUYmjxZ6eFqIskjsNU+/1hDs2GnIpSI9En LbtkenfVbStX/W1djvDTXmmTZa4sCd8QKpGjCPrJ1Xc3mZFHtiamnyZkK1EARTxaVkfn L4zcI+hRknbUrPUZ6w/lEg92RAEvZAXsrx3CxKuDpnO8wiILPqxlyB+yrZprA6VhpmIk bvDR2JpQ/1Y0JxQmZC4fBWc1yCeaw90x6IigYf5YJDTmrX7aW6gW0qJUt+C8B+xWAzmL UAAg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qOy05tkp; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-202220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c3540fb02bsi10148310a12.17.2024.06.05.03.54.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 03:54:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qOy05tkp; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-202220-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A93BC284578 for ; Wed, 5 Jun 2024 10:54:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F1CDA1922CA; Wed, 5 Jun 2024 10:54:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qOy05tkp" Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E5BE4965F for ; Wed, 5 Jun 2024 10:54:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717584874; cv=none; b=lI8zsL9nBYS4l1EMB1rtgWi7XyrXw1SiEDWraZ+o/O9oesWp/bQIMEJBOahN0Ye48uhNngzb7xcdhN70dyXccjG+WdGE6YIIWYgy14HrlvJ8d24JFS1atP4HrFznNBK9G9Wu+ptUbLFym59ew3J0AubFIDJYaefCgWPpEp3cGXU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717584874; c=relaxed/simple; bh=FTgBRYYy6JQRexZRZJFjuNAFj4Osr8S9dZDMnD+Hpkg=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=aXX8k2HfDSrFrrkQAno93Sb4R3hwyILoAbWEXhgJk+mvkHbAgyqJfDewnAh/ATDsN03TXRx4OwzCPOOOfb5z/HDE0p2RceYTJNOYiGeX7E7Hr+Ep7qF2EA/97zk9DrvNQTcAKxBRCWigDW+vEaHt0Csf4wFrRncMjTWMYu5sLnQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qOy05tkp; arc=none smtp.client-ip=209.85.219.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f173.google.com with SMTP id 3f1490d57ef6-dfa71ded97bso659136276.1 for ; Wed, 05 Jun 2024 03:54:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717584871; x=1718189671; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=jwOYdBEP20eHqXfiLB/uZRRK7vGmn2sMRMDnSyVKlSw=; b=qOy05tkp1Jh9xyTIiDfcWBORdVYV9xOpdRiBq5wfsDPG3C03dKc5lIEI9cgtiUDw97 79BOWCujxAwC42Ia9HJuq2CvetruFN1Qq3klniYjWPtZziiBVZwXkDiyu1bZ9NBpaLcv 6JR90CNU4nd3KyrUKWJRQJ9XnGk4xbt0KjoltJUCC+NpAqnfeFjBeB7g711/V8MVfRqy l6pTVZ5fII/62FaGvHXWr87DRgtumoiP1M/gyccN6P6yV1e1U5OfFv1OGwJLpV6iFYNa X5XIfjQBNF6tKb9wJDbvjfxyxgi52+59XVhrRIZYvKGru9tjjlS886D+XZHB8rOU9jIW fFug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717584871; x=1718189671; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jwOYdBEP20eHqXfiLB/uZRRK7vGmn2sMRMDnSyVKlSw=; b=qwq3uYl0L9mwvLCCVg46OLE1WVrDZKB9JjzLnXLxEqvN5DMWRdAh1JuT4Y69VZQXsW w4OkFrA+JJ9murwJz4VH7cLJiYwXZtuOqJqwmUqVwshYPlOrKzxOr6ra8gw3J/aFUW8F f0RQ1QU9R8/Bh9N3X/lJWjywSgevQfW7apcFWk0lusmuBE6YSdYGt96Vvwaac36SQIGh /BfIyfN+7cLiaDcVFSkXJ3h//KTQkEysYwLjRYhzdMq0bGRtaBFzE7LdipQXip+ndzSe kIkPcD+wm5E+pZN4s/UA6I2+GzTGxDWXWMlsiiY9NULFCLd8+a7SargCsuyizu0hmreL cmRA== X-Forwarded-Encrypted: i=1; AJvYcCWkUMfu9c1cXN/QWuONdfghlszIgQIB2oQn8b8zEIckK0Xk60C5TV/pp6gFPL4lje2DZyBJ6x4c3PGg2orTw5WbJtUHzT6RUkoHOrDp X-Gm-Message-State: AOJu0Yyd2tP8K9VmCUkRcLDM2yATCmqFUWZZLy3sxHku2QLsFO+BVQjN sE2rxcb4LJdxqlxT8v7RUeTtZg1JXUt/7jI5T080NkLxT7zsUp/H0PBie/RRHhjrV2gZUUarlwZ wP894ATmjU2IpbX3TCjMOWE0dRLpMB18SOyw7vA== X-Received: by 2002:a25:c102:0:b0:df4:d98d:3e4f with SMTP id 3f1490d57ef6-dfab854c9c8mr4052568276.12.1717584871226; Wed, 05 Jun 2024 03:54:31 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <0a025885-ed95-45d3-bf76-d2a043baaed7@ideasonboard.com> In-Reply-To: <0a025885-ed95-45d3-bf76-d2a043baaed7@ideasonboard.com> From: Ulf Hansson Date: Wed, 5 Jun 2024 12:53:55 +0200 Message-ID: Subject: Re: [PATCH/RFC 0/3] pmdomain: renesas: rmobile-sysc: Remove serial console handling To: Tomi Valkeinen Cc: Geert Uytterhoeven , Greg Kroah-Hartman , Jiri Slaby , "Rafael J . Wysocki" , Rob Herring , Saravana Kannan , Claudiu Beznea , Peng Fan , linux-pm@vger.kernel.org, linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Devarsh Thakkar , Laurent Pinchart Content-Type: text/plain; charset="UTF-8" On Wed, 5 Jun 2024 at 12:41, Tomi Valkeinen wrote: > > Hi Ulf, > > On 05/06/2024 12:34, Ulf Hansson wrote: > > + Tomi > > > > On Mon, 27 May 2024 at 14:41, Geert Uytterhoeven > > wrote: > >> > >> Hi all, > >> > >> Since commit a47cf07f60dcb02d ("serial: core: Call > >> device_set_awake_path() for console port"), the serial driver properly > >> handles the case where the serial console is part of the awake path, and > >> it looked like we could start removing special serial console handling > >> from PM Domain drivers like the R-Mobile SYSC PM Domain driver. > >> Unfortunately the devil is in the details, as usual... > >> > >> Earlycon relies on the serial port to be initialized by the firmware > >> and/or bootloader. Linux is not aware of any hardware dependencies that > >> must be met to keep the port working, and thus cannot guarantee they > >> stay met, until the full serial driver takes over. > >> > >> E.g. all unused clocks and unused PM Domains are disabled in a late > >> initcall. As this happens after the full serial driver has taken over, > >> the serial port's clock and/or PM Domain are no longer deemed unused, > >> and this is typically not a problem. > >> > >> However, if the serial port's clock or PM Domain is shared with another > >> device, and that other device is runtime-suspended before the full > >> serial driver has probed, the serial port's clock and/or PM Domain will > >> be disabled inadvertently. Any subsequent serial console output will > >> cause a crash or system lock-up. E.g. on R/SH-Mobile SoCs, the serial > >> ports share their PM Domain with several other I/O devices. After the > >> use of pwm (Armadillo-800-EVA) or i2c (KZM-A9-GT) during early boot, > >> before the full serial driver takes over, the PM Domain containing the > >> early serial port is powered down, causing a lock-up when booted with > >> "earlycon". > > > > Hi Geert, > > > > Thanks for the detailed description of the problem! As pointed out in > > regards to another similar recent patch [1], this is indeed a generic > > problem, not limited to the serial console handling. > > > > At Linaro Connect a few weeks ago I followed up with Saravana from the > > earlier discussions at LPC last fall. We now have a generic solution > > for genpd drafted on plain paper, based on fw_devlink and the > > ->sync_state() callback. I am currently working on the genpd series, > > while Saravana will re-spin the series (can't find the link to the > > last version) for the clock framework. Ideally, we want these things > > to work in a very similar way. > > > > That said, allow me to post the series for genpd in a week or two to > > see if it can solve your problem too, for the serial console. > > Both the genpd and the clock solutions will make suppliers depend on all > their consumers to be probed, right? > > I think it is a solution, and should be worked on, but it has the > drawback that suppliers that have consumers that will possibly never be > probed, will also never be able to turn off unused resources. > > This was specifically the case with the TI ti-sci pmdomain case I was > looking at: the genpd driver (ti_sci_pm_domains.c) provides a lot of > genpds for totally unrelated devices, and so if, e.g., you don't have or > don't want to load a driver for the GPU, all PDs are affected. > > Even here the solutions you mention will help: instead of things getting > broken because genpds get turned off while they are actually in use, the > genpds will be kept enabled, thus fixing the breakage. Unfortunately, > they'll be kept enabled forever. > > I've been ill for quite a while so I haven't had the chance to look at > this more, but before that I was hacking around a bit with something I > named .partial_sync_state(). .sync_state() gets called when all the > consumers have probed, but .partial_sync_state() gets called when _a_ > consumer has been probed. > > For the .sync_state() things are easy for the driver, as it knows > everything related has been probed, but for .partial_sync_state() the > driver needs to track resources internally. .partial_sync_state() will > tell the driver that a consumer device has probed, the driver can then > find out which specific resources (genpds in my case) that consumer > refers to, and then... Well, that's how far I got with my hacks =). > > So, I don't know if this .partial_sync_state() can even work, but I > think we do need something more on top of the .sync_state(). Thanks for the update! You certainly have a point, but rather than implementing some platform specific method, I think we should be able enforce the call to ->sync_state(), based upon some condition/timeout - and even if all consumers haven't been probed. [...] Kind regards Uffe