Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 52D4DCCF9E8 for ; Wed, 25 Sep 2024 17:42:15 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 99D4788363; Wed, 25 Sep 2024 19:42:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="7ISV5n2/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EF6CD88216; Wed, 25 Sep 2024 19:42:12 +0200 (CEST) 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 phobos.denx.de (Postfix) with ESMTPS id 0F2D488363 for ; Wed, 25 Sep 2024 19:42:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=999876f45b=patrick.delaunay@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 48PD001t025721; Wed, 25 Sep 2024 19:42:08 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= cNbILd9a5+wkS7QvjeyRS9e0335pxMRsLzbPciSRYsw=; b=7ISV5n2/RNInvpkS 4VCWDkZqCcQT9LiVzmcmuHC0quNUEFyqBD7FLqNBcJUyA/tlkUZxSPTf4iBrkZhL wo9oTVGwN7XN31MjQf4mttvvuqJw4AVtD45JDL7hruJatkQ35wo5VB1Kv1/mXzx+ l2EIyEJyU+bMiTAhNdDXSpd05zHh6ikp/t1fjBYwpV0ER/6eWpF+aG6ftpN0V5/r UUf74GfNbUwJGjqDUjbqKRM4PEhgpd5WkCCu06IyMM7l/Q0CAWoKx7iUgOR44GUK 75/YXE4PGXSk0jt25n4mvK233rZoW4r4qsmYlwsoqB8fZLhhHrDXDKjZITYfKKq8 YxIzuA== 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 41sk95p31n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 25 Sep 2024 19:42:08 +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 661914009C; Wed, 25 Sep 2024 19:41:11 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 14D6227C223; Wed, 25 Sep 2024 19:37:08 +0200 (CEST) Received: from [10.48.86.243] (10.48.86.243) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.37; Wed, 25 Sep 2024 19:37:06 +0200 Message-ID: <38cac570-b496-4fde-85ed-9df63db7a99e@foss.st.com> Date: Wed, 25 Sep 2024 19:37:04 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ARM: stm32: Fix secure_waitbits() mask check To: Marek Vasut , CC: Patrice Chotard , Tom Rini , References: <20240708114344.18354-1-marex@denx.de> Content-Language: en-US From: Patrick DELAUNAY In-Reply-To: <20240708114344.18354-1-marex@denx.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.48.86.243] X-ClientProxiedBy: SHFCAS1NODE2.st.com (10.75.129.73) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Hi Marek, On 7/8/24 13:43, Marek Vasut wrote: > Do not apply bitwise AND to register value and expected value, only > apply bitwise AND to register value and mask, and only then compare > the result with expected value that the function polls for. > > Fixes: b49105320a5b ("stm32mp: psci: Implement PSCI system suspend and DRAM SSR") > Signed-off-by: Marek Vasut > --- > Cc: Patrice Chotard > Cc: Patrick Delaunay > Cc: Tom Rini > Cc: u-boot@lists.denx.de > Cc: uboot-stm32@st-md-mailman.stormreply.com > --- > arch/arm/mach-stm32mp/stm32mp1/psci.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/arm/mach-stm32mp/stm32mp1/psci.c b/arch/arm/mach-stm32mp/stm32mp1/psci.c > index e99103910d9..ffdafea464d 100644 > --- a/arch/arm/mach-stm32mp/stm32mp1/psci.c > +++ b/arch/arm/mach-stm32mp/stm32mp1/psci.c > @@ -393,8 +393,7 @@ static int __secure secure_waitbits(u32 reg, u32 mask, u32 val) > asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (start)); > for (;;) { > tmp = readl(reg); > - tmp &= mask; > - if ((tmp & val) == val) > + if ((tmp & mask) == val) > return 0; > asm volatile("mrrc p15, 0, %Q0, %R0, c14" : "=r" (end)); > if ((end - start) > delay) Reviewed-by: Patrick Delaunay Thanks Patrick