Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp121785lqo; Thu, 16 May 2024 00:45:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU9OtbNylx2Zzm4rv/QWrM14qt23pS1+sh6XNrh0Whbvf/h3DjVs4vJ2Cu7sJINpUYBoVXZRL7hYM995tJRqYWR4d108vDUg3aFrq3Lew== X-Google-Smtp-Source: AGHT+IG5ZJX8TU6RSbuQ+xqQVVJwJMiHGWeRxwOv+ASFBbhPy4/FAuYxIrW16UK8ZMEwxtZ/JsDw X-Received: by 2002:a05:620a:5609:b0:792:e8ab:67b1 with SMTP id af79cd13be357-792e8ab67edmr1014288385a.67.1715845514183; Thu, 16 May 2024 00:45:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715845514; cv=pass; d=google.com; s=arc-20160816; b=xdHjC+wmNVd95Oq9TmBfX1qnMN09omNWXdfTk4AiDZUvxhPNl0l1gHVtj3NxJe0CCi xL6FHXM2s4bCyENA4WB0qjHSU98KlSvTyvWUGkyEnZ7lvK4+W2v7ezkGkZdF3jlW65/p XaVZsRtYtXjXo08rwyN/yhh1CvKiaZvG6SiwruKZr3wkgXJF0F1ll8WtDGgxjlCFFnu5 WSIuCMKWNWj47Dq+D/AO1v/hCyMJkzOTKa7RKhsiOJvDX4are3IdQISZU/qSYNTaO2Gg Glpxw/PWpiTKHmG+Bsz3RFHoKCPgTs3CIVtsYNH03fE83GiaLnOvvuh7xOlbD+7TXarM 9Gkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=fGbR8sYV9QIn7SFPWuDEizW7wFbyJ157IMhZGWfECk8=; fh=GjGMYrM16PYM7ibCZzzvGOOfyn/O11XYrbQ+qLRYArs=; b=H6ISVOWeQqFghLW09RYj/XYK2kWiJVpVyXZ/l51cm1RKSOnzBV8hS25qSGrdfaufJD m9V50SSY6XsXBpJg29xIR4Sf1vOuRixadt/NKSu9xzfH9zUlRPPV5/UT86CWUE2+Rmer 9sQ4xkjpDXwWo9ugs8GLkdxWej1Mzan2Y5/p2LhPDuf3D5iEDXmEaq1g770nB3mUh6+O HHewQmucl/ksR6rZf2hrUxEU/h7visDz98vdxFOODmXjLwN01HTOFMZdOK/wRo2V8NRE 8CNn6LD5EYNpF+384r68zZ0ThYNqCUeazwPCtLUuGGc8xQDXGpAqfY6uQiBwZ/oR0jkf GYug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=oYqfZv8r; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-crypto+bounces-4197-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-792d0a4761fsi1134093285a.594.2024.05.16.00.45.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 00:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4197-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=oYqfZv8r; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-crypto+bounces-4197-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4197-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com 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 AA0FD1C21246 for ; Thu, 16 May 2024 07:45:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E05D14120A; Thu, 16 May 2024 07:45:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="oYqfZv8r" X-Original-To: linux-crypto@vger.kernel.org Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (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 A61882031D; Thu, 16 May 2024 07:45:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715845508; cv=none; b=E0cXU0q5Z9F7q8zAWHCt90dM9A1d+roKZ1cXFkPD3utXNm5ceyqhW/rFZBXJR/oEPlEhBqbU6f1N29VmX5x4hbT5v0HLlOMJmcWR0M6Oe1FO7mu/nW+roc28vScZEq5OKDAsNEPOma5oeCcQVbpTjVL7pE7f0r4sc4cOCYeM9Jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715845508; c=relaxed/simple; bh=qfYpAbbXpjEyYh4WRvM9+5NG8w1h1rMukIJoCgIKlMA=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=hLTKOt6ZExE8adkTxucWg+Xm91PAAODtfLyKu94M/AGupSsduphWnzgoSncIARMwmG4AioliUaEyAYr6wUaBIxf4lHUtxA2LoNTuumzqIxZ0W3AySulv0QF2WVKtOTTd6fFkt0+Jj8HQujoVUHwPIgVt2dd9oiiElw228wiojCk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=oYqfZv8r; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44FLuDT2005399; Thu, 16 May 2024 09:43:59 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=fGbR8sYV9QIn7SFPWuDEizW7wFbyJ157IMhZGWfECk8=; b=oY qfZv8rDdRNbMc7CuGM5totYTdN9MafA0OvTOD5Bg8sANV7hrr5gE+FzkxDU36Waj GZgSqPWrLU9QEO0tgCZh9XoJSVUXHGvM4veRgE+AphbOHcaWPUr46euV2l67MbY3 79iR7SfUEbRcjoNwffonPiTxIhlRchgK3KbHRHkINnZeOcIYYKRAVfbZR0BSBZ7H OC7hJx5YYF/kslkbMKZfXNw8OSEFmLEg4mlJzvOX/1hq4zjC8LdgMs6ClFejYjMd mqX3Uxp6rN62bL09ZKrBStE0nXilBa5dETimsczq3HDcs2fuJuk6ugVHm07GaVhO PiS051HwTsAgndN36Wkg== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3y4symc615-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 16 May 2024 09:43:59 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 494D140046; Thu, 16 May 2024 09:43:51 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1F791211958; Thu, 16 May 2024 09:42:57 +0200 (CEST) Received: from [10.48.87.204] (10.48.87.204) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 16 May 2024 09:42:55 +0200 Message-ID: <5b39b5b6-7008-4362-a578-3faab87cd23b@foss.st.com> Date: Thu, 16 May 2024 09:42:51 +0200 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [RFC] clk: stm32mp1: Keep RNG1 clock always running To: Marek Vasut , CC: =?UTF-8?Q?Uwe_Kleine-K=C3=B6nig?= , Alexandre Torgue , Gabriel Fernandez , Herbert Xu , Maxime Coquelin , Michael Turquette , Olivia Mackall , Rob Herring , Stephen Boyd , Yang Yingliang , , , References: <20240513220349.183568-1-marex@denx.de> <51951dd4-8e8c-4e67-89f6-6a710022e34f@foss.st.com> <3257e8f8-5bb0-4c75-a3a3-e5685b65de2a@denx.de> Content-Language: en-US From: Gatien CHEVALLIER In-Reply-To: <3257e8f8-5bb0-4c75-a3a3-e5685b65de2a@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-16_03,2024-05-15_01,2023-05-22_02 Hi Marek On 5/16/24 03:06, Marek Vasut wrote: > On 5/15/24 11:16 AM, Gatien CHEVALLIER wrote: > > Hi, > >>>> What if you add a trace in a random generation function in random.c? >>> >>> Do you have a function name or line number for me ? >> >> I put a trace in _get_random_bytes() in drivers/char/random.c. I'm not >> 100% sure but this should be the entry point when getting a random >> number. > > You're right, there is a read attempt right before the hang, and > __clk_is_enabled() returns 0 in stm32_read_rng() . In fact, it is the > pm_runtime_get_sync() which is returning -EACCES instead of zero, and > this is currently not checked so the failure is not detected before > register access takes place, to register file with clock disabled, which > triggers a hard hang. > > I'll be sending a patch shortly, thanks for this hint ! > Great news, indeed the return code isn't checked. Let's use pm_runtime_resume_and_get(). >>>> After this, I'll try to reproduce the issue. >>> >>> If you have a minute to test it on some ST MP15 board, that would be >>> real nice. Thanks ! >> >> I tried to reproduce the issue you're facing on a STM32MP157C-DK2 no >> SCMI on the 6.9-rc7 kernel tag. I uses OP-TEE and TF-A in the bootchain >> but this should not have an impact here. >> >> How did you manage to test using "echo core > /sys/power/pm_test"? >> In kernel/power/suspend.c, enter_state(). If the pm_test_level is core, >> then an error is fired with the following trace: >> "Unsupported test mode for suspend to idle, please choose >> none/freezer/devices/platform." > > Could this be firmware related ? > >> I've tried using "echo devices > /sys/power/pm_test" so that I can at >> least test that the driver is put to sleep then wakes up. I do not >> reproduce your issue. > > Can you try 'processors' ? > Given this: #ifdef CONFIG_PM_DEBUG if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) { pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n"); return -EAGAIN; } #endif and this static const char * const pm_tests[__TEST_AFTER_LAST] = { [TEST_NONE] = "none", [TEST_CORE] = "core", [TEST_CPUS] = "processors", [TEST_PLATFORM] = "platform", [TEST_DEVICES] = "devices", [TEST_FREEZER] = "freezer", }; I'm getting the error as well. > I did also notice it sometimes takes much longer than a minute to hang, > but eventually it does hang. Maybe let it cycle for an hour or a few ? > I'll let it loop for some time then for device pm state. > [...] > Thanks for investigating this. Cheers, Gatien