Received: by 2002:a05:7412:361b:b0:f9:2edb:3e4d with SMTP id ie27csp67781rdb; Sun, 17 Dec 2023 15:05:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHx9YjzGgSHeJxfZwjmyznPM+BCSp1k2vT+ZvX2XcfUrlYJewQRYkd8/Dn64YN2CD37sxL X-Received: by 2002:a0c:fca5:0:b0:67a:a721:ec03 with SMTP id h5-20020a0cfca5000000b0067aa721ec03mr10629863qvq.71.1702854313768; Sun, 17 Dec 2023 15:05:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702854313; cv=none; d=google.com; s=arc-20160816; b=UIF4YsuFUzuNnPLV9aCk1nhcJqEcBccG4ns7OP5AdyLR7+kpd+0J9de8bRSauRjJHC Td/PVp54k70dP6dK2NqvJkD8mooq3TJgMwrV7iXpEVcq+uQNrAmz/m8xsHFTdQ+ch8zu DwgPGB4xYvXqYDXscbw8AsKTN0tSD7Fi/BSvWkrb1/OpjwteOMcdoIxXMbVJuee3kzv0 6u167544KeRtzsiMdLM3y/hfF1sLq0vEI764qg3lKb7Z49YSWl6hTpKAwHPqcl3KF6SL 9+7XWCnaquKLS4HOMVvU6CmSRUL54UR4bK00QiSHoVCVa0zkZdddwTrjFLNYBPm/Hlfu fyAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:date:to:cc:from:subject:references:in-reply-to :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:dkim-signature; bh=C31/vdIwlOG4/RQpDKhURj/OwqcINur5NKr6OP5ZcBY=; fh=cLtuBoRgivEGJXAEBa7YEEMMUvmW2hbIc35Z30EcpfY=; b=PDRYhFixbiylGXck3DJ47iP1LIazUo3qjTqjexXrlQbkjeW9WEP2d013EWzfNjIg7+ KPrWu53PQhWS9+jjGOw3cqH/Di/4H3lEKOORiJ0FvJhkQDAJwP4fOzXthyWURaHqQHXf 3ggeWJHg3hbQrot3aLTPMrZxnmuaTOPO9gw3+k9PrsGzAkAI8oROc642+cTXXs8hpZdL iEz+OIk9nNt0deB1l6dorS+LZ0xQePHvFEGQmGFXJqXiUF6sUJ2f37PUEQwuhpcKY3E/ U/vW15/3+aptR8l1Rf/Gtzqn5czPAHvDQjYtgKaMFKM0EcoXXuAh1+VEWNTeMD4N6g9s yQCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=caqjKKMZ; spf=pass (google.com: domain of linux-kernel+bounces-2861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b17-20020a0cc991000000b0067efda3a18fsi3636787qvk.129.2023.12.17.15.05.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Dec 2023 15:05:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-2861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=caqjKKMZ; spf=pass (google.com: domain of linux-kernel+bounces-2861-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-2861-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7E8321C211F3 for ; Sun, 17 Dec 2023 23:05:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 14A1949F9E; Sun, 17 Dec 2023 23:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="caqjKKMZ" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B6901E49D; Sun, 17 Dec 2023 23:05:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4A8FC433C7; Sun, 17 Dec 2023 23:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702854303; bh=C31/vdIwlOG4/RQpDKhURj/OwqcINur5NKr6OP5ZcBY=; h=In-Reply-To:References:Subject:From:Cc:To:Date:From; b=caqjKKMZzNHtUE0k7JGP35K97SrxPimgNRsRVIJWxbjG1a00XoKn/0+6ZnN89afve PIBAxXW8bxMrKeUs+DTNEf5gXZnCr4QZvlvWU+9uYUhn8hDW3nyYmQlTQJ1YpG36zn CUYH4ZjWdNwIOt9h2GICr9xgmZVbfoG1VW+kPLf96DYm3hE9cwBJ+pU/5Dn4tJjUN+ 9y0OpSVS4eBouTH5fVXb7cBzIiM2xBIa/GQq2jsqRrdhewFJG6oU5Zz/opuLCgtrt0 lr0ISwKr0/aUkOPgwzNWluAXdwOsnl/IBG7obL957qQpuvRPCK76VaMuKUJU2BFe0b vEooQ6HNn55/w== Message-ID: <883a61872f94c972cc410da84eaf7b97.sboyd@kernel.org> Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20231002180854.1603452-2-ben.wolsieffer@hefring.com> References: <20231002180854.1603452-1-ben.wolsieffer@hefring.com> <20231002180854.1603452-2-ben.wolsieffer@hefring.com> Subject: Re: [PATCH 1/2] clk: stm32: initialize syscon after clocks are registered From: Stephen Boyd Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Michael Turquette , Ben Wolsieffer To: Ben Wolsieffer , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Date: Sun, 17 Dec 2023 15:05:01 -0800 User-Agent: alot/0.10 Quoting Ben Wolsieffer (2023-10-02 11:08:53) > The stm32-power-config syscon (PWR peripheral) is used in this driver > and the STM32 RTC driver to enable write access to backup domain > registers. The syscon's clock has a gate controlled by this clock > driver, but this clock is currently not registered in the device tree. > This only happens to work currently because all relevant clock setup and > RTC initialization happens before clk_disabled_unused(). After this > point, all syscon register writes are ignored. Seems like we should mark those clks as CLK_IGNORE_UNUSED and add a comment to that fact. >=20 > If we simply add the syscon clock in the device tree, we end up with a > circular dependency because the clock has not been registered at the > point this driver requests the syscon. >=20 > This patch avoids this circular dependency by moving the syscon lookup > after the clocks are registered. This does appear to create a possible > race condition where someone could attempt to perform an operation on a > backup domain clock before the syscon has been initialized. This would > result in the operation having no effect because backup domain writes > could not be enabled. I'm not sure if this is a problem or if there is > a way to avoid it. There's no comment in the code that says the regmap must be set there instead of earlier. What's to stop someone from tripping over this problem later? At the least, please add a comment.