From nobody Wed Oct 8 23:40:10 2025 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 5115A235065; Mon, 23 Jun 2025 09:30:04 +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=1750671007; cv=none; b=CxDc7yRSfE0bOZ2f9eSzObiLGZHYWD9Crbl5XCDKNi4UX/xUMyWDpKfC5jKZVzYzWQUb9YhFqmSBGmSxbShRilOWy7l9OS/dAUGIWCRF2UKiQjzKZLnKuWOulpJcvicGaBB65WBKFtyw7UQc+p2g+IlRV/vSYUDZd1xrp0nyXYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671007; c=relaxed/simple; bh=Dq2ykfq63wn8VObJtf2Dtv3Y1KpLFKfxnczqmYre38w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=sb5IpP/2GWI/+EkUzV3nWu+fG3aRMM9iKIbjeYh9R+AzwbpmF1gcHiVnZDI+vLjY9STxp8JuLB+/Knf08NWga15KgCeUr0qsvllgtaGijh2GvtRDk+GZDr/o9lGL2CCK0lftPSXK8/78uHAfFa0KKpYbLo9Oz2mjPlllzwx24Pc= 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=RIm1V+03; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="RIm1V+03" 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 55N98GPx025818; Mon, 23 Jun 2025 11:29:40 +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= 1S+/fxjBGM9OThOsnlJiBdnI+RCOnybmlz6yPJOrPUQ=; b=RIm1V+03JsaWqIcT wKZqPovnP+21RzLk6lgr7YSf0yw3hif8p4ORA3ltYKtso6AvFqxaa425ruMXwZON /kTvkK0K6V7zEiUPPgIFo4j0Wj6Ik0TksgkB5kUu60B3lUSXekHjoAufTx7H2M2T lGtlwPBymjYDUUsK/2NtNe6EG47cJeyFlrm+zjT6iS9wXWOmi9WehG1Q9cr3yw6H ifkSRyHs0L+41zQ2Wt64nEEhvrIZ+sJdqZEg0Jo9N2GPHwlhpswntFn6/oFGjf+P 3oS5ZXHoCAkZdqJQzTC9Sh6teeejXB4gHTgwN1g93FI2LvL71PofA4I5TIvX4OUH RyGobw== 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 47dhvbevay-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:40 +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 32C8540052; Mon, 23 Jun 2025 11:28:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id B5DF95C2DFB; Mon, 23 Jun 2025 11:27:21 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:21 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:06 +0200 Subject: [PATCH 01/13] bus: firewall: move stm32_firewall header file in include folder Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-1-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 Other driver than rifsc and etzpc can implement firewall ops, such as rcc. In order for them to have access to the ops and type of this framework, we need to get the `stm32_firewall.h` file in the include/ folder. Signed-off-by: Cl=C3=A9ment Le Goffic --- drivers/bus/stm32_etzpc.c | 3 +-- drivers/bus/stm32_firewall.c | 3 +-- drivers/bus/stm32_rifsc.c | 3 +-- {drivers =3D> include/linux}/bus/stm32_firewall.h | 0 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/bus/stm32_etzpc.c b/drivers/bus/stm32_etzpc.c index 7fc0f16960be..4918a14e507e 100644 --- a/drivers/bus/stm32_etzpc.c +++ b/drivers/bus/stm32_etzpc.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include #include #include @@ -16,8 +17,6 @@ #include #include =20 -#include "stm32_firewall.h" - /* * ETZPC registers */ diff --git a/drivers/bus/stm32_firewall.c b/drivers/bus/stm32_firewall.c index 2fc9761dadec..ef4988054b44 100644 --- a/drivers/bus/stm32_firewall.c +++ b/drivers/bus/stm32_firewall.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include #include #include @@ -18,8 +19,6 @@ #include #include =20 -#include "stm32_firewall.h" - /* Corresponds to STM32_FIREWALL_MAX_EXTRA_ARGS + firewall ID */ #define STM32_FIREWALL_MAX_ARGS (STM32_FIREWALL_MAX_EXTRA_ARGS + 1) =20 diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c index 4cf1b60014b7..643ddd0a5f54 100644 --- a/drivers/bus/stm32_rifsc.c +++ b/drivers/bus/stm32_rifsc.c @@ -5,6 +5,7 @@ =20 #include #include +#include #include #include #include @@ -16,8 +17,6 @@ #include #include =20 -#include "stm32_firewall.h" - /* * RIFSC offset register */ diff --git a/drivers/bus/stm32_firewall.h b/include/linux/bus/stm32_firewal= l.h similarity index 100% rename from drivers/bus/stm32_firewall.h rename to include/linux/bus/stm32_firewall.h --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 2707417996; Mon, 23 Jun 2025 09:29:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671000; cv=none; b=WzQDZ/0Wpqg1LXot84+Zs8TP/SOzL9iGSf8htvfZq7PU/GfAVWiYUxiIVe2lE7XsQHoTnd3BQBaeL/y8WynWdcfczvc71Yp+e00eZASjPWk5rmEUlHd1Qdoyp1Wh2aLyPTv4emboUYnF3VXZjTHCP4NwgDqI0xfYYIxZLa7glMw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671000; c=relaxed/simple; bh=Z/JyWLR3XY6i6uwbS0ebYewrhlB9XFQj4QMmwqeNAz4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=g4D+981y1Uqv+lRV89hwYa3Xin/aNxYdCoweAi9NQjX3fVEibGS7sfnuNL9AIV1ycIFB39f/d7J4bj58saYHX00TGLUcLKlteqbO+SPx3YWT7QAxisNR8PTvSlYRIs/1LIwXTgMh+LgOkLOlp0WaF29FjrgIdcWjdn6jcw9YYSw= 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=xKjNtqKI; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="xKjNtqKI" Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N5ppEk002482; Mon, 23 Jun 2025 11:29:39 +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= ZOsuluXNSLkxvHwd4tbbEr6WHEQwIqQwF7TiT8kGSEY=; b=xKjNtqKI9/+dDLG9 oFTGydhHzjiJWbKuNHqPXZyh2TRLdnYlIx9Wm85jf7VTjSZEvYT25ojtBP+kPV7z 9OlpKZApBw9+xxKb4ywsAoojQBi5XX62vGKvxYhUB7DwqOyVytNjHH5NX0eDuUUg oANtco0jJceMp29Z9UDP5B+jVmhEDXG6ForKdRVtZe5gU3FLGUzWqCN2I0P71Enu 9vHisFwQQ02suimEnYZI5Yjgj8CWp4ShkUCe6bsyJq5DnP6BEdUehg84U2WlKDsU /ps1szoDjLVxduRU1fyVtDGIWj3fexp2bRoywhcM1xQEbY6OsvEoMrzKchqre+8I lAXVnQ== 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 47dj5nfca1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:39 +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 2629E40051; Mon, 23 Jun 2025 11:28:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id A5B2E5C37FE; Mon, 23 Jun 2025 11:27:22 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:22 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:07 +0200 Subject: [PATCH 02/13] dt-bindings: stm32: stm32mp25: add `access-controller-cell` property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-2-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 RCC is able to check the availability of a clock. Allow to query the RCC with a firewall ID. Signed-off-by: Cl=C3=A9ment Le Goffic --- Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml = b/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml index 88e52f10d1ec..83974b7fb82f 100644 --- a/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml +++ b/Documentation/devicetree/bindings/clock/st,stm32mp25-rcc.yaml @@ -31,6 +31,11 @@ properties: '#reset-cells': const: 1 =20 + '#access-controller-cells': + const: 1 + description: + Contains the firewall ID associated to the peripheral. + clocks: items: - description: CK_SCMI_HSE High Speed External oscillator (8 to 48 M= Hz) @@ -123,6 +128,7 @@ required: - reg - '#clock-cells' - '#reset-cells' + - '#access-controller-cells' - clocks =20 additionalProperties: false --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx08-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 3AC5123A994; Mon, 23 Jun 2025 09:30:04 +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=1750671007; cv=none; b=g3doipCGDFJZPLLgGm4VTNH3JneGEuY+2eNHCXzRJ/BNVQbtdaZf3M3bvYD3thIQHmWhKVR+NYDYujKr4fYMuCvy+A9bCKzoWigMPYiBQ/Y9eo41JeW7l9DEN9GkSpVtUYlu7Za/uv4tVD2j8zkHhD/YrYr4fdP7YLFh/TDWmR8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671007; c=relaxed/simple; bh=zHL0/JrntZk6f9z9OaKUCRl5Ve/+xb8bifr4gesVLAc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=NWiii8b/5C/q9OsPyglqdRaeBxPhE0o5AjVTVKbbY9P93U5lzVicUgK5UGivFPlPKYiRkefe9hWFxSYdEUNdQpxnBHCRUC0kbY6IAejLs4sHAj3GZm7DPTG/tQ+av1Ff//Qbuu83yDMJhBVLDLaMbWg/YuglsCKF9NRW8UisrOQ= 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=jQPh+kQx; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="jQPh+kQx" Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N8xDEl024011; Mon, 23 Jun 2025 11:29:35 +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= c84xGmzk0WDtYO8pxiXJLl1Oz2OVFtl3JU/pJXFAfdc=; b=jQPh+kQxUnHvfPcA KzZiHgX4bkjM2hZCal54YdDqFf43W50G03KtAZI5j13pwnlAvpLfG8wzk2v7YTMo qTvTCQ5+1jFUFZg+QoCHMDYIyHSuPdhBkn2SHRxhzrMeeE4REROEEJkzhI+wE39a XwpMgzIVRj61Hv+L3c8zG+HB+iER+oOhmnxGWvTOiHebTwmZ4YUKHYPPd4L40hDf RJc9YiqrhlzMyLlKFHMJutM4nOlFB8UnBiB992VlnDOzKEHkzSjUFCYnp6+uFMTo Ll07eqSBHeoGY70vfO2yYYF792cjQA2NntkXBmZyrO/jzYepKm+mP6zl1lesfclz N/clqA== 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 47e7pp4932-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:35 +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 261FC4004A; Mon, 23 Jun 2025 11:28:30 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 9A9B15C2DFF; Mon, 23 Jun 2025 11:27:23 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:23 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:08 +0200 Subject: [PATCH 03/13] clk: stm32mp25: add firewall grant_access ops Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-3-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 On STM32MP25, the RCC peripheral manages the secure level of resources that are used by other devices such as clocks. Declare this peripheral as a firewall controller. Signed-off-by: Cl=C3=A9ment Le Goffic --- drivers/clk/stm32/clk-stm32mp25.c | 40 +++++++++++++++++++++++++++++++++++= +++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/drivers/clk/stm32/clk-stm32mp25.c b/drivers/clk/stm32/clk-stm3= 2mp25.c index 52f0e8a12926..af4bc06d703a 100644 --- a/drivers/clk/stm32/clk-stm32mp25.c +++ b/drivers/clk/stm32/clk-stm32mp25.c @@ -4,8 +4,10 @@ * Author: Gabriel Fernandez for STMicroel= ectronics. */ =20 +#include #include #include +#include #include #include =20 @@ -1602,6 +1604,11 @@ static int stm32_rcc_get_access(void __iomem *base, = u32 index) return 0; } =20 +static int stm32mp25_rcc_grant_access(struct stm32_firewall_controller *ct= rl, u32 firewall_id) +{ + return stm32_rcc_get_access(ctrl->mmio, firewall_id); +} + static int stm32mp25_check_security(struct device_node *np, void __iomem *= base, const struct clock_config *cfg) { @@ -1970,6 +1977,7 @@ MODULE_DEVICE_TABLE(of, stm32mp25_match_data); =20 static int stm32mp25_rcc_clocks_probe(struct platform_device *pdev) { + struct stm32_firewall_controller *rcc_controller; struct device *dev =3D &pdev->dev; void __iomem *base; int ret; @@ -1982,7 +1990,36 @@ static int stm32mp25_rcc_clocks_probe(struct platfor= m_device *pdev) if (ret) return ret; =20 - return stm32_rcc_init(dev, stm32mp25_match_data, base); + ret =3D stm32_rcc_init(dev, stm32mp25_match_data, base); + if (ret) + return ret; + + rcc_controller =3D devm_kzalloc(&pdev->dev, sizeof(*rcc_controller), GFP_= KERNEL); + if (!rcc_controller) + return -ENOMEM; + + rcc_controller->dev =3D dev; + rcc_controller->mmio =3D base; + rcc_controller->name =3D dev_driver_string(dev); + rcc_controller->type =3D STM32_PERIPHERAL_FIREWALL; + rcc_controller->grant_access =3D stm32mp25_rcc_grant_access; + + platform_set_drvdata(pdev, rcc_controller); + + ret =3D stm32_firewall_controller_register(rcc_controller); + if (ret) { + dev_err(dev, "Couldn't register as a firewall controller: %d\n", ret); + return ret; + } + + return 0; +} + +static void stm32mp25_rcc_clocks_remove(struct platform_device *pdev) +{ + struct stm32_firewall_controller *rcc_controller =3D platform_get_drvdata= (pdev); + + stm32_firewall_controller_unregister(rcc_controller); } =20 static struct platform_driver stm32mp25_rcc_clocks_driver =3D { @@ -1991,6 +2028,7 @@ static struct platform_driver stm32mp25_rcc_clocks_dr= iver =3D { .of_match_table =3D stm32mp25_match_data, }, .probe =3D stm32mp25_rcc_clocks_probe, + .remove =3D stm32mp25_rcc_clocks_remove, }; =20 static int __init stm32mp25_clocks_init(void) --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx08-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 3ACD223A995; Mon, 23 Jun 2025 09:30:04 +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=1750671007; cv=none; b=eU5Ys6GJjTo5rbCsRg0F1VsZ1D6Nr89uw8yPbbPp71zzjLWQ6d8Ac8VLdzgSyNWz5yLwcCYGZZAv2V7zZPDmuDL+RbKmEICT2bAvAQXsxD49CvRJw7gsTdCDYFu8xNklcBeR4wvRQRcKYER1NpLpePuHN+BvPneJtKzUC/9P6dM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671007; c=relaxed/simple; bh=d5iWwZQBtscc9/XYMe8rkBSJD76rq7wf56xNPUB+T6Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=q51tbqsiSFSj96d+sDWM1rnpfXYm4eIYAKSBaZf1+wEB87Me2Ahw8XLcJAvBc6fbTX4o17WJt5vvUxPuUsalEL0LT91tChX06okaS0JddKyNoI4QTl1LGFG6TYK7Qw0RHe8kwTRrY3GtIhKCezOOOeMQhhL960sMhPpFEaTeG8M= 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=0PzW+B9M; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="0PzW+B9M" Received: from pps.filterd (m0369457.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N6lBuF002078; Mon, 23 Jun 2025 11:29:35 +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= /Ngm9p3NQD6arEx7d73G9n3PIlBqe76QEjiMrucBWPs=; b=0PzW+B9MDjgw2/iO aJBP/PvxZ3T7ogF+DICcUk61kolKgkscCGYYdVUqHG5ZrODkU+zDin0aF58zjESM 6elC/ucFSixhlPbjtp76hSNtm8R1VUmAhCbr3HhpN5h4EDiNo3ltVYmSt7ZvWpGK pWcCn1466lrh2Nb3ZDVK3HFWd24sHG4ItFO2/VlApkyx2n9ByXshbzsF9L/rESVg 0VMjmXGz0yB2oLzv0MIjR36UmWzOOcuupXV44Jh9RrL9L6hywW/DVm2jvw/U1tvP j3xuQv/MUtKDqvPPJPtC62/ynzHS9Bxnb+V1UcvHwLlmUs/fCLBug040GZCcKLgC Iv+7bw== 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 47e7pp4933-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:35 +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 4FF5040048; Mon, 23 Jun 2025 11:28:19 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 84AD45C3DD4; Mon, 23 Jun 2025 11:27:24 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:24 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:09 +0200 Subject: [PATCH 04/13] arm64: dts: st: set rcc as an access-controller Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-4-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 RCC now implements firewall access ops to check the access to resources. Allow client nodes to query the RCC with one firewall ID. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm64/boot/dts/st/stm32mp251.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/s= t/stm32mp251.dtsi index 8d87865850a7..0683c2d5cb6f 100644 --- a/arch/arm64/boot/dts/st/stm32mp251.dtsi +++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi @@ -1153,6 +1153,7 @@ rcc: clock-controller@44200000 { reg =3D <0x44200000 0x10000>; #clock-cells =3D <1>; #reset-cells =3D <1>; + #access-controller-cells =3D <1>; clocks =3D <&scmi_clk CK_SCMI_HSE>, <&scmi_clk CK_SCMI_HSI>, <&scmi_clk CK_SCMI_MSI>, --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 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 EAD9F233722; Mon, 23 Jun 2025 09:30:05 +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=1750671007; cv=none; b=aC2Zax5hq/AqYTaFMwLh23i7XjMH4iry9anJua36UBIOVFrAo+9/MKX3nYEPTyc8AohegFTbcZnlZcpC3/zPSSVZHp92LX+vwn/9LQQVv1dFnrHOJUMp8b38fuB1HTwU278NFkXPM4/D8cY9t7SB1vi0Z9e+7dMpte5x5uySy9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671007; c=relaxed/simple; bh=3LnNlWutqRhBSK3TgebE+cPIHrDJlwHzxQajjnqK+bA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=KHfx8WejLOOqXX/LJM1ltvo3TbSlqb0/7OnivbzHfND064UA86Llc26dt49g2d4emQCuwZNPyuxe2tZuGNSdkD3Xm1aCXsaKHRCoPY+frlNBc7RYOZ14YdqsSBqJvNLIvZ1/jOxooqB7L/bXAATGtdynNf3K0d+Tqw4CKYGo098= 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=Zh/vzDdM; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="Zh/vzDdM" 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 55N91VaZ013223; Mon, 23 Jun 2025 11:29:52 +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= HxYJdm+vIW2mkVXU2bP4ej7pG694JeHb3sv9IaD0GlM=; b=Zh/vzDdMFPiarDuj 9VlLwmbUlKhvIXvJ+C5gC/Dqxg/moeDlyqc/tuzr4YUIT//o4Ad+SobW7iSqREDH GbBVMfwHtlMNNdqSj7tV4EH7fMsuuuhX7IroRoSA7RDhUqjO2gmNYNTPqRM+IaXx wknXBfoH7zwvb16Vamxfhboi5FzsCucqUlthwNWvAhD+n9gJAVMrXlcU+vlDVpIF 4Sn7n8BfDx9nTF5lZ/rJn+1BgE4d/dt5jpbiJoqkYhaYbNbb7PjSMG+85LHb43kW Quq7hf1z9QR/cYjtOQ94g4949HSx0+oWLiDX8pkR85yxD+qt/B30ycXrqZPi4s5T ygTzIw== 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 47dhvbevd6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:52 +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 4420940047; Mon, 23 Jun 2025 11:28:34 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 7D3AA5C3DD9; Mon, 23 Jun 2025 11:27:25 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:25 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:10 +0200 Subject: [PATCH 05/13] dt-bindings: perf: stm32: introduce DDRPERFM dt-bindings Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-5-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 DDRPERFM is the DDR Performance Monitor embedded in STM32MPU SoC. It allows to monitor DDR events that come from the DDR Controller such as read or write events. Signed-off-by: Cl=C3=A9ment Le Goffic --- .../devicetree/bindings/perf/st,stm32-ddr-pmu.yaml | 93 ++++++++++++++++++= ++++ 1 file changed, 93 insertions(+) diff --git a/Documentation/devicetree/bindings/perf/st,stm32-ddr-pmu.yaml b= /Documentation/devicetree/bindings/perf/st,stm32-ddr-pmu.yaml new file mode 100644 index 000000000000..35d34782865b --- /dev/null +++ b/Documentation/devicetree/bindings/perf/st,stm32-ddr-pmu.yaml @@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/perf/st,stm32-ddr-pmu.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +maintainers: + - Cl=C3=A9ment Le Goffic + +title: STMicroelectronics STM32 DDR Performance Monitor (DDRPERFM) + +properties: + compatible: + enum: + - st,stm32mp131-ddr-pmu + - st,stm32mp151-ddr-pmu + - st,stm32mp251-ddr-pmu + + reg: + maxItems: 1 + + clocks: + description: Reference clock for the DDR Performance Monitor + maxItems: 1 + + resets: + description: Reset control for the DDR Performance Monitor + maxItems: 1 + + access-controllers: + minItems: 1 + maxItems: 2 + + st,dram-type: + description: | + This property is used to specify the type of DRAM memory connected t= o the + associated memory controller. It is required for the DDR Performance= Monitor + to correctly interpret the performance data. + 0 =3D LPDDR4, + 1 =3D LPDDR3, + 2 =3D DDR4, + 3 =3D DDR3 + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + +required: + - compatible + - reg + +allOf: + - if: + properties: + compatible: + contains: + enum: + - st,stm32mp131-ddr-pmu + - st,stm32mp151-ddr-pmu + then: + required: + - clocks + - resets + + - if: + properties: + compatible: + contains: + const: st,stm32mp251-ddr-pmu + then: + required: + - access-controllers + - st,dram-type + +additionalProperties: false + +examples: + - | + #include + #include + + perf@5a007000 { + compatible =3D "st,stm32mp151-ddr-pmu"; + reg =3D <0x5a007000 0x400>; + clocks =3D <&rcc DDRPERFM>; + resets =3D <&rcc DDRPERFM_R>; + }; + + - | + perf@48041000 { + compatible =3D "st,stm32mp251-ddr-pmu"; + reg =3D <0x48041000 0x400>; + access-controllers =3D <&rcc 104>; + st,dram-type =3D <2>; + }; --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 B565423E32B; Mon, 23 Jun 2025 09:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671013; cv=none; b=tKeG2kHpfJjCR2S9PPpbKvA5EQnVi3GUMMoADcnHjND7hm4IZHguS2mPXb2Oyh8UhC+mQFx6uMVHkGv6H28B8Cdf0q6SticNSfJB8OIJa7yEYwtsuuOtRBQqLpd5CDzF4ufKZydGWO2R/3w44WuF87PMCkGBU5HIGLXT/VF5umM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671013; c=relaxed/simple; bh=C0WdASPsfx2IuYJ8dqSeb8f+42+4JKByOc7VnceNLwo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=ASk8lasRs3FMFo5iys4uTOFYXaRg3WHClY5XuZ6H6Thejb++Kmp+wkdYXnOj5qFXQI9SxwccWo6hegdr5BPBHesbSmqEDzF0IjbEW2KLoKSXQvPsZt3mtsLKqC5B4SDFL5rl4WlLUDdu04x9TV7Pr5GxxxODYOZL9qZxOmPNu6w= 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=8A0DskKk; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="8A0DskKk" Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N6FIfA015580; Mon, 23 Jun 2025 11:29:52 +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= 4UBGOUpuPOeKtQ2u8AmnXlBkDE/8J7UlX6pI6buIBoY=; b=8A0DskKkVRd4jcDB kIqXuPfJA3i+Z70bOMyPkcoWwUjmMgHsriIQlswxSPPxWhpVfVJtT4SpmSXCJ2g2 eJLSSvnd1AsIHQyHH3VqGqj9Wny+vLIO5SiqR+1iXD1kubeMmgGL32K9D2Y9PcoB xVUZPHxvIsoQT4dEONQtAleMRDFTt/WmOO5tGlw4JNZRyK/ubRZ+YGeMFZizEAb7 VtrqSZw1+GBgBhRWOL/CuhR37PkRDDunHtA/SsxA/Ovu0W5Ye3v+7rv0mG28n//D Xad3FLCfbS5MvHotgd+W0WgA0rDrYSSRQ68hdIvHHvuZC/taa8D2kNlAFiBJm+7L K3h3aQ== 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 47dm3372qg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:52 +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 539DD40053; Mon, 23 Jun 2025 11:28:34 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 8C1135C3DDD; Mon, 23 Jun 2025 11:27:26 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:26 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:11 +0200 Subject: [PATCH 06/13] perf: stm32: introduce DDRPERFM driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-6-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 Introduce the driver for the DDR Performance Monitor available on STM32MPU SoC. On STM32MP2 platforms, the DDRPERFM allows to monitor up to 8 DDR events that come from the DDR Controller such as read or write events. On STM32MP1 platforms, the DDRPERFM cannot monitor any event on any counter, there is a notion of set of events. Events from different sets cannot be monitored at the same time. The first chosen event selects the set. The set is coded in the first two bytes of the config value which is on 4 bytes. On STM32MP25x series, the DDRPERFM clock is shared with the DDR controller and may be secured by bootloaders. Access controllers allow to check access to a resource. Use the access controller defined in the devicetree to know about the access to the DDRPERFM clock. Signed-off-by: Cl=C3=A9ment Le Goffic --- drivers/perf/Kconfig | 11 + drivers/perf/Makefile | 1 + drivers/perf/stm32_ddr_pmu.c | 893 +++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 905 insertions(+) diff --git a/drivers/perf/Kconfig b/drivers/perf/Kconfig index 278c929dc87a..5118535134ee 100644 --- a/drivers/perf/Kconfig +++ b/drivers/perf/Kconfig @@ -198,6 +198,17 @@ config QCOM_L3_PMU Adds the L3 cache PMU into the perf events subsystem for monitoring L3 cache events. =20 +config STM32_DDR_PMU + tristate "STM32 DDR PMU" + depends on ARCH_STM32 || COMPILE_TEST + default m + help + Provides support for the DDR performance monitor on STM32MPU platforms. + The monitor provides counters for memory related events. + It allows developers to analyze and optimize DDR performance. + Enabling this feature is useful for performance tuning and debugging me= mory + subsystem issues on supported hardware. + config THUNDERX2_PMU tristate "Cavium ThunderX2 SoC PMU UNCORE" depends on ARCH_THUNDER2 || COMPILE_TEST diff --git a/drivers/perf/Makefile b/drivers/perf/Makefile index de71d2574857..7f83b50feb71 100644 --- a/drivers/perf/Makefile +++ b/drivers/perf/Makefile @@ -20,6 +20,7 @@ obj-$(CONFIG_RISCV_PMU) +=3D riscv_pmu.o obj-$(CONFIG_RISCV_PMU_LEGACY) +=3D riscv_pmu_legacy.o obj-$(CONFIG_RISCV_PMU_SBI) +=3D riscv_pmu_sbi.o obj-$(CONFIG_STARFIVE_STARLINK_PMU) +=3D starfive_starlink_pmu.o +obj-$(CONFIG_STM32_DDR_PMU) +=3D stm32_ddr_pmu.o obj-$(CONFIG_THUNDERX2_PMU) +=3D thunderx2_pmu.o obj-$(CONFIG_XGENE_PMU) +=3D xgene_pmu.o obj-$(CONFIG_ARM_SPE_PMU) +=3D arm_spe_pmu.o diff --git a/drivers/perf/stm32_ddr_pmu.c b/drivers/perf/stm32_ddr_pmu.c new file mode 100644 index 000000000000..c0bce1f446a0 --- /dev/null +++ b/drivers/perf/stm32_ddr_pmu.c @@ -0,0 +1,893 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2025, STMicroelectronics - All Rights Reserved + * Author: Cl=C3=A9ment Le Goffic for STMic= roelectronics. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define DRIVER_NAME "stm32_ddr_pmu" + +/* + * The PMU is able to freeze all counters and generate an interrupt when t= here + * is a counter overflow. But, relying on this means that we lose all the + * events that occur between the freeze and the interrupt handler executio= n. + * So we use a polling mechanism to avoid this lost of information. + * The fastest counter can overflow in ~7s @600MHz (that is the maximum DDR + * frequency supported on STM32MP257), so we poll in 3.5s intervals to ens= ure + * we don't reach this limit. + */ +#define POLL_MS 3500 + +#define DDRPERFM_CTRL 0x000 +#define DDRPERFM_CFG 0x004 +#define DDRPERFM_STATUS 0x008 +#define DDRPERFM_CLR 0x00C +#define DDRPERFM_TCNT 0x020 +#define DDRPERFM_EVCNT(X) (0x030 + 8 * (X)) + +#define DDRPERFM_MP2_CFG0 0x010 +#define DDRPERFM_MP2_CFG1 0x014 +#define DDRPERFM_MP2_CFG5 0x024 +#define DDRPERFM_MP2_DRAMINF 0x028 +#define DDRPERFM_MP2_EVCNT(X) (0x040 + 4 * (X)) +#define DDRPERFM_MP2_TCNT 0x060 +#define DDRPERFM_MP2_STATUS 0x080 + +#define MP1_STATUS_BUSY BIT(16) +#define MP2_STATUS_BUSY BIT(31) + +#define CTRL_START BIT(0) +#define CTRL_STOP BIT(1) + +#define CFG_SEL_MSK GENMASK(17, 16) +#define CFG_SEL_SHIFT 16 +#define CFG_EN_MSK GENMASK(3, 0) + +#define MP1_CLR_CNT GENMASK(3, 0) +#define MP1_CLR_TIME BIT(31) +#define MP2_CLR_CNT GENMASK(7, 0) +#define MP2_CLR_TIME BIT(8) + +/* 4 event counters plus 1 dedicated to time */ +#define MP1_CNT_NB (4 + 1) +/* Index of the time dedicated counter */ +#define MP1_TIME_CNT_IDX 4 + +/* 8 event counters plus 1 dedicated to time */ +#define MP2_CNT_NB (8 + 1) +/* Index of the time dedicated counter */ +#define MP2_TIME_CNT_IDX 8 +/* 4 event counters per register */ +#define MP2_CNT_SEL_PER_REG 4 + +/* Arbitrary value used to identify a time event */ +#define TIME_CNT 64 + +struct stm32_ddr_pmu_reg { + unsigned int reg; + u32 mask; +}; + +struct stm32_ddr_cnt { + int idx; + struct perf_event *evt; + struct list_head cnt_list; +}; + +struct stm32_ddr_pmu_regspec { + const struct stm32_ddr_pmu_reg stop; + const struct stm32_ddr_pmu_reg start; + const struct stm32_ddr_pmu_reg enable; + const struct stm32_ddr_pmu_reg status; + const struct stm32_ddr_pmu_reg clear_cnt; + const struct stm32_ddr_pmu_reg clear_time; + const struct stm32_ddr_pmu_reg cfg; + const struct stm32_ddr_pmu_reg cfg0; + const struct stm32_ddr_pmu_reg cfg1; + const struct stm32_ddr_pmu_reg dram_inf; + const struct stm32_ddr_pmu_reg counter_time; + const struct stm32_ddr_pmu_reg counter_evt[]; +}; + +struct stm32_ddr_pmu { + struct pmu pmu; + void __iomem *membase; + struct device *dev; + struct clk *clk; + const struct stm32_ddr_pmu_cfg *cfg; + struct hrtimer hrtimer; + ktime_t poll_period; + int selected_set; + u32 dram_type; + struct list_head counters[]; +}; + +struct stm32_ddr_pmu_cfg { + const struct stm32_ddr_pmu_regspec *regs; + const struct attribute_group **attribute; + u32 counters_nb; + u32 evt_counters_nb; + u32 time_cnt_idx; + struct stm32_ddr_cnt * (*get_counter)(struct stm32_ddr_pmu *p, struct per= f_event *e); +}; + +#define EVENT_NUMBER(group, index) (((group) << 8) | (index)) +#define GROUP_VALUE(event_number) ((event_number) >> 8) +#define EVENT_INDEX(event_number) ((event_number) & 0xFF) + +/* MP1 ddrperfm events */ +enum stm32_ddr_pmu_events_mp1 { + PERF_OP_IS_RD =3D EVENT_NUMBER(0, 0), + PERF_OP_IS_WR =3D EVENT_NUMBER(0, 1), + PERF_OP_IS_ACTIVATE =3D EVENT_NUMBER(0, 2), + CTL_IDLE =3D EVENT_NUMBER(0, 3), + PERF_HPR_REQ_WITH_NO_CREDIT =3D EVENT_NUMBER(1, 0), + PERF_LPR_REQ_WITH_NO_CREDIT =3D EVENT_NUMBER(1, 1), + CACTIVE_DDRC =3D EVENT_NUMBER(1, 3), + PERF_OP_IS_ENTER_POWERDOWN =3D EVENT_NUMBER(2, 0), + PERF_OP_IS_REFRESH =3D EVENT_NUMBER(2, 1), + PERF_SELFRESH_MODE =3D EVENT_NUMBER(2, 2), + DFI_LP_REQ =3D EVENT_NUMBER(2, 3), + PERF_HPR_XACT_WHEN_CRITICAL =3D EVENT_NUMBER(3, 0), + PERF_LPR_XACT_WHEN_CRITICAL =3D EVENT_NUMBER(3, 1), + PERF_WR_XACT_WHEN_CRITICAL =3D EVENT_NUMBER(3, 2), + DFI_LP_REQ_SCND =3D EVENT_NUMBER(3, 3), +}; + +/* MP2 ddrperfm events */ +enum stm32_ddr_pmu_events_mp2 { + DFI_IS_ACT =3D EVENT_NUMBER(0, 0), + DFI_IS_PREPB =3D EVENT_NUMBER(0, 1), + DFI_IS_PREAB =3D EVENT_NUMBER(0, 2), + DFI_IS_RD =3D EVENT_NUMBER(0, 3), + DFI_IS_RDA =3D EVENT_NUMBER(0, 4), + DFI_IS_WR =3D EVENT_NUMBER(0, 6), + DFI_IS_WRA =3D EVENT_NUMBER(0, 7), + DFI_IS_MWR =3D EVENT_NUMBER(0, 9), + DFI_IS_MWRA =3D EVENT_NUMBER(0, 10), + DFI_IS_MRW =3D EVENT_NUMBER(0, 12), + DFI_IS_MRR =3D EVENT_NUMBER(0, 13), + DFI_IS_REFPB =3D EVENT_NUMBER(0, 14), + DFI_IS_REFAB =3D EVENT_NUMBER(0, 15), + DFI_IS_MPC =3D EVENT_NUMBER(0, 16), + PERF_OP_IS_ACT =3D EVENT_NUMBER(0, 32), + PERF_OP_IS_RD_MP2 =3D EVENT_NUMBER(0, 33), + PERF_OP_IS_WR_MP2 =3D EVENT_NUMBER(0, 34), + PERF_OP_IS_MWR =3D EVENT_NUMBER(0, 35), + PERF_OP_IS_REF =3D EVENT_NUMBER(0, 36), + PERF_OP_IS_CRIT_REF =3D EVENT_NUMBER(0, 37), + PERF_OP_IS_SPEC_REF =3D EVENT_NUMBER(0, 38), + PERF_OP_IS_ZQCAL =3D EVENT_NUMBER(0, 39), + PERF_OP_IS_ENTER_POWDN =3D EVENT_NUMBER(0, 40), + PERF_OP_IS_ENTER_SELFREF =3D EVENT_NUMBER(0, 41), + PERF_OP_IS_PRE =3D EVENT_NUMBER(0, 42), + PERF_OP_IS_PRE_FOR_RDWR =3D EVENT_NUMBER(0, 43), + PERF_OP_IS_PRE_FOR_OTHERS =3D EVENT_NUMBER(0, 44), + PERF_OP_IS_RD_ACTIVATE =3D EVENT_NUMBER(0, 45), + PERF_HPR_REQ_WITH_NOCREDIT =3D EVENT_NUMBER(0, 48), + PERF_LPR_REQ_WITH_NOCREDIT =3D EVENT_NUMBER(0, 49), + PERF_HPR_XACT_WHEN_CRITICAL_MP2 =3D EVENT_NUMBER(0, 50), + PERF_LPR_XACT_WHEN_CRITICAL_MP2 =3D EVENT_NUMBER(0, 51), + PERF_WR_XACT_WHEN_CRITICAL_MP2 =3D EVENT_NUMBER(0, 52), + PERF_RDWR_TRANSITIONS =3D EVENT_NUMBER(0, 53), + PERF_WAR_HAZARD =3D EVENT_NUMBER(0, 54), + PERF_RAW_HAZARD =3D EVENT_NUMBER(0, 55), + PERF_WAW_HAZARD =3D EVENT_NUMBER(0, 56), + PERF_RANK =3D EVENT_NUMBER(0, 58), + PERF_READ_BYPASS =3D EVENT_NUMBER(0, 59), + PERF_ACT_BYPASS =3D EVENT_NUMBER(0, 60), + PERF_WINDOW_LIMIT_REACHED_RD =3D EVENT_NUMBER(0, 61), + PERF_WINDOW_LIMIT_REACHED_WR =3D EVENT_NUMBER(0, 62), + NO_EVENT =3D EVENT_NUMBER(0, 63), +}; + +static struct stm32_ddr_pmu *to_stm32_ddr_pmu(struct pmu *p) +{ + return container_of(p, struct stm32_ddr_pmu, pmu); +} + +static struct stm32_ddr_pmu *hrtimer_to_stm32_ddr_pmu(struct hrtimer *h) +{ + return container_of(h, struct stm32_ddr_pmu, hrtimer); +} + +static void stm32_ddr_start_counters(struct stm32_ddr_pmu *pmu) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + + writel_relaxed(r->start.mask, pmu->membase + r->start.reg); +} + +static void stm32_ddr_stop_counters(struct stm32_ddr_pmu *pmu) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + + writel_relaxed(r->stop.mask, pmu->membase + r->stop.reg); +} + +static void stm32_ddr_clear_time_counter(struct stm32_ddr_pmu *pmu) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + + writel_relaxed(r->clear_time.mask, pmu->membase + r->clear_time.reg); +} + +static void stm32_ddr_clear_event_counter(struct stm32_ddr_pmu *pmu, struc= t stm32_ddr_cnt *counter) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + + writel_relaxed(r->clear_cnt.mask & BIT(counter->idx), pmu->membase + r->c= lear_cnt.reg); +} + +static void stm32_ddr_clear_counter(struct stm32_ddr_pmu *pmu, struct stm3= 2_ddr_cnt *counter) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + u32 status =3D readl_relaxed(pmu->membase + r->status.reg); + + if (counter->idx =3D=3D pmu->cfg->time_cnt_idx) + stm32_ddr_clear_time_counter(pmu); + else + stm32_ddr_clear_event_counter(pmu, counter); + + if (status & r->status.mask) + dev_err(pmu->dev, "Failed to clear counter %i because the PMU is busy\n", + counter->idx); +} + +static void stm32_ddr_counter_enable(struct stm32_ddr_pmu *pmu, struct stm= 32_ddr_cnt *counter) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + u32 val =3D readl_relaxed(pmu->membase + r->enable.reg); + + val |=3D BIT(counter->idx); + writel_relaxed(val, pmu->membase + r->enable.reg); +} + +static void stm32_ddr_counter_disable(struct stm32_ddr_pmu *pmu, struct st= m32_ddr_cnt *counter) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + u32 val =3D readl_relaxed(pmu->membase + r->enable.reg); + + val &=3D ~BIT(counter->idx); + writel_relaxed(val, pmu->membase + r->enable.reg); +} + +static int stm32_ddr_sel_evnt(struct stm32_ddr_pmu *pmu, struct stm32_ddr_= cnt *counter) +{ + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + u32 cnt_sel_val; + + u32 group_val =3D GROUP_VALUE(counter->evt->attr.config); + u32 evt_val =3D EVENT_INDEX(counter->evt->attr.config); + + if (pmu->selected_set !=3D -1 && pmu->selected_set !=3D group_val) { + dev_err(pmu->dev, "Selected events are from different set\n"); + return -EINVAL; + } + pmu->selected_set =3D group_val; + + if (pmu->cfg->regs->cfg.reg) { + cnt_sel_val =3D readl_relaxed(pmu->membase + r->cfg.reg); + cnt_sel_val &=3D ~CFG_SEL_MSK; + cnt_sel_val |=3D (CFG_SEL_MSK & (group_val << CFG_SEL_SHIFT)); + writel_relaxed(cnt_sel_val, pmu->membase + r->cfg.reg); + + return 0; + } + + /* We assume cfg0 and cfg1 are filled in the match data */ + u32 cnt_idx =3D counter->idx; + u32 cnt_sel_evt_reg =3D r->cfg0.reg; + + if (!(cnt_idx < MP2_CNT_SEL_PER_REG)) { + cnt_sel_evt_reg =3D r->cfg1.reg; + cnt_idx -=3D MP2_CNT_SEL_PER_REG; + } + + cnt_sel_val =3D readl_relaxed(pmu->membase + cnt_sel_evt_reg); + cnt_sel_val &=3D ~GENMASK(8 * cnt_idx + 7, 8 * cnt_idx); + cnt_sel_val |=3D evt_val << (8 * cnt_idx); + + writel_relaxed(cnt_sel_val, pmu->membase + cnt_sel_evt_reg); + + return 0; +} + +static struct stm32_ddr_cnt *stm32_ddr_pmu_get_event_counter_mp1(struct st= m32_ddr_pmu *pmu, + struct perf_event *event) +{ + u32 config =3D event->attr.config; + u32 event_idx =3D EVENT_INDEX(config); + struct stm32_ddr_cnt *cnt; + + cnt =3D kzalloc(sizeof(*cnt), GFP_KERNEL); + if (!cnt) + return ERR_PTR(-ENOMEM); + + cnt->evt =3D event; + cnt->idx =3D event_idx; + event->pmu_private =3D cnt; + list_add(&cnt->cnt_list, &pmu->counters[event_idx]); + + return cnt; +} + +static struct stm32_ddr_cnt *stm32_ddr_pmu_get_event_counter_mp2(struct st= m32_ddr_pmu *pmu, + struct perf_event *event) +{ + struct stm32_ddr_cnt *cnt; + int idx =3D -1; + + /* Loop on all the counters except TIME_CNT_IDX */ + for (int i =3D 0; i < pmu->cfg->evt_counters_nb; i++) { + u64 config; + + if (list_empty(&pmu->counters[i])) { + idx =3D i; + continue; + } + config =3D list_first_entry(&pmu->counters[i], struct stm32_ddr_cnt, + cnt_list)->evt->attr.config; + if (config =3D=3D event->attr.config) { + idx =3D i; + break; + } + } + + if (idx =3D=3D -1) + return ERR_PTR(-ENOENT); + + cnt =3D kzalloc(sizeof(*cnt), GFP_KERNEL); + if (!cnt) + return ERR_PTR(-ENOMEM); + + cnt->evt =3D event; + cnt->idx =3D idx; + event->pmu_private =3D cnt; + + list_add(&cnt->cnt_list, &pmu->counters[idx]); + + return cnt; +} + +static inline struct stm32_ddr_cnt *stm32_get_event_counter(struct stm32_d= dr_pmu *pmu, + struct perf_event *event) +{ + return pmu->cfg->get_counter(pmu, event); +} + +static int stm32_ddr_pmu_get_counter(struct stm32_ddr_pmu *pmu, struct per= f_event *event) +{ + u32 time_cnt_idx =3D pmu->cfg->time_cnt_idx; + u32 config =3D event->attr.config; + struct stm32_ddr_cnt *cnt; + + if (!pmu || !event) + return -EINVAL; + + pmu->selected_set =3D GROUP_VALUE(config); + + if (config =3D=3D TIME_CNT) { + cnt =3D kzalloc(sizeof(*cnt), GFP_KERNEL); + if (!cnt) + return -ENOMEM; + + cnt->evt =3D event; + cnt->idx =3D time_cnt_idx; + event->pmu_private =3D cnt; + list_add(&cnt->cnt_list, &pmu->counters[time_cnt_idx]); + + return 0; + } + + cnt =3D stm32_get_event_counter(pmu, event); + if (IS_ERR(cnt)) + return PTR_ERR(cnt); + + if (list_count_nodes(&cnt->cnt_list) =3D=3D 1) { + stm32_ddr_stop_counters(pmu); + stm32_ddr_sel_evnt(pmu, cnt); + stm32_ddr_counter_enable(pmu, cnt); + stm32_ddr_start_counters(pmu); + } + + return 0; +} + +static void stm32_ddr_pmu_free_counter(struct stm32_ddr_pmu *pmu, + struct stm32_ddr_cnt *counter) +{ + size_t count =3D list_count_nodes(&counter->cnt_list); + + if (counter->evt->attr.config !=3D TIME_CNT && count =3D=3D 1) + stm32_ddr_counter_disable(pmu, counter); + + list_del(&counter->cnt_list); + kfree(counter); +} + +static void stm32_ddr_pmu_event_update_list(struct stm32_ddr_pmu *pmu, str= uct list_head *list) +{ + struct stm32_ddr_cnt *counter =3D list_first_entry(list, struct stm32_ddr= _cnt, cnt_list); + const struct stm32_ddr_pmu_regspec *r =3D pmu->cfg->regs; + u32 val; + + if (counter->evt->attr.config !=3D TIME_CNT) + val =3D readl_relaxed(pmu->membase + r->counter_evt[counter->idx].reg); + else + val =3D readl_relaxed(pmu->membase + r->counter_time.reg); + + stm32_ddr_clear_counter(pmu, counter); + + list_for_each_entry(counter, list, cnt_list) + local64_add(val, &counter->evt->count); +} + +static void stm32_ddr_pmu_event_read(struct perf_event *event) +{ + struct stm32_ddr_pmu *pmu =3D to_stm32_ddr_pmu(event->pmu); + struct stm32_ddr_cnt *cnt =3D event->pmu_private; + + hrtimer_start(&pmu->hrtimer, pmu->poll_period, HRTIMER_MODE_REL_PINNED); + + stm32_ddr_stop_counters(pmu); + + stm32_ddr_pmu_event_update_list(pmu, &pmu->counters[cnt->idx]); + + stm32_ddr_start_counters(pmu); +} + +static void stm32_ddr_pmu_event_start(struct perf_event *event, int flags) +{ + struct stm32_ddr_pmu *pmu =3D to_stm32_ddr_pmu(event->pmu); + struct stm32_ddr_cnt *counter =3D event->pmu_private; + struct hw_perf_event *hw =3D &event->hw; + + if (WARN_ON_ONCE(!(hw->state & PERF_HES_STOPPED))) + return; + + if (flags & PERF_EF_RELOAD) + WARN_ON_ONCE(!(hw->state & PERF_HES_UPTODATE)); + + stm32_ddr_stop_counters(pmu); + + if (list_count_nodes(&counter->cnt_list) =3D=3D 1) + stm32_ddr_clear_counter(pmu, counter); + else + stm32_ddr_pmu_event_update_list(pmu, &pmu->counters[counter->idx]); + + stm32_ddr_start_counters(pmu); + local64_set(&hw->prev_count, 0); + hw->state =3D 0; +} + +static void stm32_ddr_pmu_event_stop(struct perf_event *event, int flags) +{ + struct hw_perf_event *hw =3D &event->hw; + + if (WARN_ON_ONCE(hw->state & PERF_HES_STOPPED)) + return; + + hw->state |=3D PERF_HES_STOPPED; + + if (flags & PERF_EF_UPDATE) { + stm32_ddr_pmu_event_read(event); + hw->state |=3D PERF_HES_UPTODATE; + } +} + +static int stm32_ddr_pmu_event_add(struct perf_event *event, int flags) +{ + struct stm32_ddr_pmu *pmu =3D to_stm32_ddr_pmu(event->pmu); + int ret; + + clk_enable(pmu->clk); + + hrtimer_start(&pmu->hrtimer, pmu->poll_period, HRTIMER_MODE_REL_PINNED); + + ret =3D stm32_ddr_pmu_get_counter(pmu, event); + if (ret) + return ret; + + event->hw.state =3D PERF_HES_STOPPED | PERF_HES_UPTODATE; + + if (flags & PERF_EF_START) + stm32_ddr_pmu_event_start(event, flags); + + return 0; +} + +static void stm32_ddr_pmu_event_del(struct perf_event *event, int flags) +{ + struct stm32_ddr_pmu *pmu =3D to_stm32_ddr_pmu(event->pmu); + struct stm32_ddr_cnt *counter =3D event->pmu_private; + bool events =3D true; + + stm32_ddr_pmu_event_stop(event, PERF_EF_UPDATE); + + stm32_ddr_pmu_free_counter(pmu, counter); + + for (int i =3D 0; i < pmu->cfg->counters_nb; i++) + events =3D !list_empty(&pmu->counters[i]); + + /* If there is activity nothing to do */ + if (events) + return; + + hrtimer_cancel(&pmu->hrtimer); + stm32_ddr_stop_counters(pmu); + + pmu->selected_set =3D -1; + + clk_disable(pmu->clk); +} + +static int stm32_ddr_pmu_event_init(struct perf_event *event) +{ + if (event->attr.type !=3D event->pmu->type) + return -ENOENT; + + if (is_sampling_event(event) || event->attach_state & PERF_ATTACH_TASK) + return -EINVAL; + + return 0; +} + +static enum hrtimer_restart stm32_ddr_pmu_poll(struct hrtimer *hrtimer) +{ + struct stm32_ddr_pmu *pmu =3D hrtimer_to_stm32_ddr_pmu(hrtimer); + + stm32_ddr_stop_counters(pmu); + + for (int i =3D 0; i < MP2_CNT_NB; i++) + if (!list_empty(&pmu->counters[i])) + stm32_ddr_pmu_event_update_list(pmu, &pmu->counters[i]); + + if (list_empty(&pmu->counters[pmu->cfg->time_cnt_idx])) + stm32_ddr_clear_time_counter(pmu); + + stm32_ddr_start_counters(pmu); + + hrtimer_forward_now(hrtimer, pmu->poll_period); + + return HRTIMER_RESTART; +} + +static ssize_t stm32_ddr_pmu_sysfs_show(struct device *dev, struct device_= attribute *attr, + char *buf) +{ + struct perf_pmu_events_attr *pmu_attr; + + pmu_attr =3D container_of(attr, struct perf_pmu_events_attr, attr); + + return sysfs_emit(buf, "event=3D0x%02llx\n", pmu_attr->id); +} + +#define STM32_DDR_PMU_EVENT_ATTR(_name, _id) \ + PMU_EVENT_ATTR_ID(_name, stm32_ddr_pmu_sysfs_show, _id) + +static struct attribute *stm32_ddr_pmu_events_attrs_mp[] =3D { + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_rd, PERF_OP_IS_RD), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_wr, PERF_OP_IS_WR), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_activate, PERF_OP_IS_ACTIVATE), + STM32_DDR_PMU_EVENT_ATTR(ctl_idle, CTL_IDLE), + STM32_DDR_PMU_EVENT_ATTR(perf_hpr_req_with_no_credit, PERF_HPR_REQ_WITH_N= O_CREDIT), + STM32_DDR_PMU_EVENT_ATTR(perf_lpr_req_with_no_credit, PERF_LPR_REQ_WITH_N= O_CREDIT), + STM32_DDR_PMU_EVENT_ATTR(cactive_ddrc, CACTIVE_DDRC), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_enter_powerdown, PERF_OP_IS_ENTER_POW= ERDOWN), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_refresh, PERF_OP_IS_REFRESH), + STM32_DDR_PMU_EVENT_ATTR(perf_selfresh_mode, PERF_SELFRESH_MODE), + STM32_DDR_PMU_EVENT_ATTR(dfi_lp_req, DFI_LP_REQ), + STM32_DDR_PMU_EVENT_ATTR(perf_hpr_xact_when_critical, PERF_HPR_XACT_WHEN_= CRITICAL), + STM32_DDR_PMU_EVENT_ATTR(perf_lpr_xact_when_critical, PERF_LPR_XACT_WHEN_= CRITICAL), + STM32_DDR_PMU_EVENT_ATTR(perf_wr_xact_when_critical, PERF_WR_XACT_WHEN_CR= ITICAL), + STM32_DDR_PMU_EVENT_ATTR(dfi_lp_req_cpy, DFI_LP_REQ), /* Suffixed '_cpy'= to allow the + * choice between sets 2 and 3 + */ + STM32_DDR_PMU_EVENT_ATTR(time_cnt, TIME_CNT), + NULL, +}; + +static struct attribute_group stm32_ddr_pmu_events_attrs_group_mp =3D { + .name =3D "events", + .attrs =3D stm32_ddr_pmu_events_attrs_mp, +}; + +static struct attribute *stm32_ddr_pmu_events_attrs_mp2[] =3D { + STM32_DDR_PMU_EVENT_ATTR(dfi_is_act, DFI_IS_ACT), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_prepb, DFI_IS_PREPB), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_preab, DFI_IS_PREAB), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_rd, DFI_IS_RD), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_rda, DFI_IS_RDA), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_wr, DFI_IS_WR), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_wra, DFI_IS_WRA), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_mwr, DFI_IS_MWR), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_mwra, DFI_IS_MWRA), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_mrw, DFI_IS_MRW), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_mrr, DFI_IS_MRR), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_refpb, DFI_IS_REFPB), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_refab, DFI_IS_REFAB), + STM32_DDR_PMU_EVENT_ATTR(dfi_is_mpc, DFI_IS_MPC), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_act, PERF_OP_IS_ACT), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_rd, PERF_OP_IS_RD), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_wr, PERF_OP_IS_WR), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_mwr, PERF_OP_IS_MWR), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_ref, PERF_OP_IS_REF), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_crit_ref, PERF_OP_IS_CRIT_REF), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_spec_ref, PERF_OP_IS_SPEC_REF), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_zqcal, PERF_OP_IS_ZQCAL), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_enter_powdn, PERF_OP_IS_ENTER_POWDN), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_enter_selfref, PERF_OP_IS_ENTER_SELFR= EF), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_pre, PERF_OP_IS_PRE), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_pre_for_rdwr, PERF_OP_IS_PRE_FOR_RDWR= ), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_pre_for_others, PERF_OP_IS_PRE_FOR_OT= HERS), + STM32_DDR_PMU_EVENT_ATTR(perf_op_is_rd_activate, PERF_OP_IS_RD_ACTIVATE), + STM32_DDR_PMU_EVENT_ATTR(perf_hpr_req_with_nocredit, PERF_HPR_REQ_WITH_NO= CREDIT), + STM32_DDR_PMU_EVENT_ATTR(perf_lpr_req_with_nocredit, PERF_LPR_REQ_WITH_NO= CREDIT), + STM32_DDR_PMU_EVENT_ATTR(perf_hpr_xact_when_critical, PERF_HPR_XACT_WHEN_= CRITICAL), + STM32_DDR_PMU_EVENT_ATTR(perf_lpr_xact_when_critical, PERF_LPR_XACT_WHEN_= CRITICAL), + STM32_DDR_PMU_EVENT_ATTR(perf_wr_xact_when_critical, PERF_WR_XACT_WHEN_CR= ITICAL), + STM32_DDR_PMU_EVENT_ATTR(perf_rdwr_transitions, PERF_RDWR_TRANSITIONS), + STM32_DDR_PMU_EVENT_ATTR(perf_war_hazard, PERF_WAR_HAZARD), + STM32_DDR_PMU_EVENT_ATTR(perf_raw_hazard, PERF_RAW_HAZARD), + STM32_DDR_PMU_EVENT_ATTR(perf_waw_hazard, PERF_WAW_HAZARD), + STM32_DDR_PMU_EVENT_ATTR(perf_rank, PERF_RANK), + STM32_DDR_PMU_EVENT_ATTR(perf_read_bypass, PERF_READ_BYPASS), + STM32_DDR_PMU_EVENT_ATTR(perf_act_bypass, PERF_ACT_BYPASS), + STM32_DDR_PMU_EVENT_ATTR(perf_window_limit_reached_rd, PERF_WINDOW_LIMIT_= REACHED_RD), + STM32_DDR_PMU_EVENT_ATTR(perf_window_limit_reached_wr, PERF_WINDOW_LIMIT_= REACHED_WR), + STM32_DDR_PMU_EVENT_ATTR(time_cnt, TIME_CNT), + NULL +}; + +static struct attribute_group stm32_ddr_pmu_events_attrs_group_mp2 =3D { + .name =3D "events", + .attrs =3D stm32_ddr_pmu_events_attrs_mp2, +}; + +PMU_FORMAT_ATTR(event, "config:0-8"); + +static struct attribute *stm32_ddr_pmu_format_attrs[] =3D { + &format_attr_event.attr, + NULL, +}; + +static const struct attribute_group stm32_ddr_pmu_format_attr_group =3D { + .name =3D "format", + .attrs =3D stm32_ddr_pmu_format_attrs, +}; + +static const struct attribute_group *stm32_ddr_pmu_attr_groups_mp1[] =3D { + &stm32_ddr_pmu_events_attrs_group_mp, + &stm32_ddr_pmu_format_attr_group, + NULL, +}; + +static const struct attribute_group *stm32_ddr_pmu_attr_groups_mp2[] =3D { + &stm32_ddr_pmu_events_attrs_group_mp2, + &stm32_ddr_pmu_format_attr_group, + NULL, +}; + +static int stm32_ddr_pmu_device_probe(struct platform_device *pdev) +{ + struct stm32_firewall firewall; + struct stm32_ddr_pmu *pmu; + struct reset_control *rst; + struct resource *res; + int ret; + + pmu =3D devm_kzalloc(&pdev->dev, struct_size(pmu, counters, MP2_CNT_NB), = GFP_KERNEL); + if (!pmu) + return -ENOMEM; + + platform_set_drvdata(pdev, pmu); + pmu->dev =3D &pdev->dev; + + pmu->cfg =3D device_get_match_data(&pdev->dev); + + pmu->membase =3D devm_platform_get_and_ioremap_resource(pdev, 0, &res); + if (IS_ERR(pmu->membase)) + return PTR_ERR(pmu->membase); + + if (of_property_present(pmu->dev->of_node, "access-controllers")) { + ret =3D stm32_firewall_get_firewall(pmu->dev->of_node, &firewall, 1); + if (ret) { + dev_err(pmu->dev, "Failed to get firewall\n"); + return ret; + } + ret =3D stm32_firewall_grant_access_by_id(&firewall, firewall.firewall_i= d); + if (ret) { + dev_err(pmu->dev, "Failed to grant access\n"); + return ret; + } + } + + if (of_property_present(pmu->dev->of_node, "clocks")) { + pmu->clk =3D devm_clk_get_prepared(pmu->dev, NULL); + if (IS_ERR(pmu->clk)) { + dev_err(pmu->dev, "Failed to get clock\n"); + return PTR_ERR(pmu->clk); + } + } + + clk_enable(pmu->clk); + + if (of_property_present(pdev->dev.of_node, "resets")) { + rst =3D devm_reset_control_get(&pdev->dev, NULL); + if (IS_ERR(rst)) { + dev_err(&pdev->dev, "Failed to get reset\n"); + ret =3D PTR_ERR(rst); + goto err_clk; + } + reset_control_assert(rst); + reset_control_deassert(rst); + } + + pmu->poll_period =3D ms_to_ktime(POLL_MS); + hrtimer_setup(&pmu->hrtimer, stm32_ddr_pmu_poll, CLOCK_MONOTONIC, HRTIMER= _MODE_REL); + + for (int i =3D 0; i < MP2_CNT_NB; i++) + INIT_LIST_HEAD(&pmu->counters[i]); + + pmu->selected_set =3D -1; + + pmu->pmu =3D (struct pmu) { + .task_ctx_nr =3D perf_invalid_context, + .start =3D stm32_ddr_pmu_event_start, + .stop =3D stm32_ddr_pmu_event_stop, + .add =3D stm32_ddr_pmu_event_add, + .del =3D stm32_ddr_pmu_event_del, + .read =3D stm32_ddr_pmu_event_read, + .event_init =3D stm32_ddr_pmu_event_init, + .attr_groups =3D pmu->cfg->attribute, + .module =3D THIS_MODULE, + }; + + ret =3D perf_pmu_register(&pmu->pmu, DRIVER_NAME, -1); + if (ret) { + dev_err(&pdev->dev, "Couldn't register DDRPERFM driver as a PMU\n"); + goto err_clk; + } + + if (pmu->cfg->regs->dram_inf.reg) { + ret =3D of_property_read_u32(pdev->dev.of_node, "st,dram-type", &pmu->dr= am_type); + if (ret) { + dev_err(&pdev->dev, "Missing device-tree property 'st,dram-type'\n"); + perf_pmu_unregister(&pmu->pmu); + + return ret; + } + + writel_relaxed(pmu->dram_type, pmu->membase + pmu->cfg->regs->dram_inf.r= eg); + } + + clk_disable(pmu->clk); + + return 0; + +err_clk: + clk_disable_unprepare(pmu->clk); + + return ret; +} + +static void stm32_ddr_pmu_device_remove(struct platform_device *pdev) +{ + struct stm32_ddr_pmu *stm32_ddr_pmu =3D platform_get_drvdata(pdev); + + perf_pmu_unregister(&stm32_ddr_pmu->pmu); +} + +static int __maybe_unused stm32_ddr_pmu_device_resume(struct device *dev) +{ + struct stm32_ddr_pmu *pmu =3D dev_get_drvdata(dev); + + clk_enable(pmu->clk); + writel_relaxed(pmu->dram_type, pmu->membase + pmu->cfg->regs->dram_inf.re= g); + clk_disable(pmu->clk); + + return 0; +} + +static const struct stm32_ddr_pmu_regspec stm32_ddr_pmu_regspec_mp1 =3D { + .stop =3D { DDRPERFM_CTRL, CTRL_STOP }, + .start =3D { DDRPERFM_CTRL, CTRL_START }, + .enable =3D { DDRPERFM_CFG }, + .cfg =3D { DDRPERFM_CFG }, + .status =3D { DDRPERFM_STATUS, MP1_STATUS_BUSY }, + .clear_cnt =3D { DDRPERFM_CLR, MP1_CLR_CNT}, + .clear_time =3D { DDRPERFM_CLR, MP1_CLR_TIME}, + .counter_time =3D { DDRPERFM_TCNT }, + .counter_evt =3D { + { DDRPERFM_EVCNT(0) }, + { DDRPERFM_EVCNT(1) }, + { DDRPERFM_EVCNT(2) }, + { DDRPERFM_EVCNT(3) }, + }, +}; + +static const struct stm32_ddr_pmu_regspec stm32_ddr_pmu_regspec_mp2 =3D { + .stop =3D { DDRPERFM_CTRL, CTRL_STOP }, + .start =3D { DDRPERFM_CTRL, CTRL_START }, + .status =3D { DDRPERFM_MP2_STATUS, MP2_STATUS_BUSY }, + .clear_cnt =3D { DDRPERFM_CLR, MP2_CLR_CNT}, + .clear_time =3D { DDRPERFM_CLR, MP2_CLR_TIME}, + .cfg0 =3D { DDRPERFM_MP2_CFG0 }, + .cfg1 =3D { DDRPERFM_MP2_CFG1 }, + .enable =3D { DDRPERFM_MP2_CFG5 }, + .dram_inf =3D { DDRPERFM_MP2_DRAMINF }, + .counter_time =3D { DDRPERFM_MP2_TCNT }, + .counter_evt =3D { + { DDRPERFM_MP2_EVCNT(0) }, + { DDRPERFM_MP2_EVCNT(1) }, + { DDRPERFM_MP2_EVCNT(2) }, + { DDRPERFM_MP2_EVCNT(3) }, + { DDRPERFM_MP2_EVCNT(4) }, + { DDRPERFM_MP2_EVCNT(5) }, + { DDRPERFM_MP2_EVCNT(6) }, + { DDRPERFM_MP2_EVCNT(7) }, + }, +}; + +static const struct stm32_ddr_pmu_cfg stm32_ddr_pmu_cfg_mp1 =3D { + .regs =3D &stm32_ddr_pmu_regspec_mp1, + .attribute =3D stm32_ddr_pmu_attr_groups_mp1, + .counters_nb =3D MP1_CNT_NB, + .evt_counters_nb =3D MP1_CNT_NB - 1, /* Time counter is not an event coun= ter */ + .time_cnt_idx =3D MP1_TIME_CNT_IDX, + .get_counter =3D stm32_ddr_pmu_get_event_counter_mp1, +}; + +static const struct stm32_ddr_pmu_cfg stm32_ddr_pmu_cfg_mp2 =3D { + .regs =3D &stm32_ddr_pmu_regspec_mp2, + .attribute =3D stm32_ddr_pmu_attr_groups_mp2, + .counters_nb =3D MP2_CNT_NB, + .evt_counters_nb =3D MP2_CNT_NB - 1, /* Time counter is an event counter = */ + .time_cnt_idx =3D MP2_TIME_CNT_IDX, + .get_counter =3D stm32_ddr_pmu_get_event_counter_mp2, +}; + +static const struct dev_pm_ops stm32_ddr_pmu_pm_ops =3D { + SET_SYSTEM_SLEEP_PM_OPS(NULL, stm32_ddr_pmu_device_resume) +}; + +static const struct of_device_id stm32_ddr_pmu_of_match[] =3D { + { + .compatible =3D "st,stm32mp131-ddr-pmu", + .data =3D &stm32_ddr_pmu_cfg_mp1 + }, + { + .compatible =3D "st,stm32mp151-ddr-pmu", + .data =3D &stm32_ddr_pmu_cfg_mp1 + }, + { + .compatible =3D "st,stm32mp251-ddr-pmu", + .data =3D &stm32_ddr_pmu_cfg_mp2 + }, + { }, +}; +MODULE_DEVICE_TABLE(of, stm32_ddr_pmu_of_match); + +static struct platform_driver stm32_ddr_pmu_driver =3D { + .driver =3D { + .name =3D DRIVER_NAME, + .pm =3D &stm32_ddr_pmu_pm_ops, + .of_match_table =3D of_match_ptr(stm32_ddr_pmu_of_match), + }, + .probe =3D stm32_ddr_pmu_device_probe, + .remove =3D stm32_ddr_pmu_device_remove, +}; + +module_platform_driver(stm32_ddr_pmu_driver); + +MODULE_AUTHOR("Cl=C3=A9ment Le Goffic"); +MODULE_DESCRIPTION("STMicroelectronics STM32 DDR performance monitor drive= r"); +MODULE_LICENSE("GPL"); --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 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 7558623D288; Mon, 23 Jun 2025 09:30:09 +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=1750671012; cv=none; b=t/xntdDGbtS04y3qTidhdWc9XFtLjgxsVQc0pJQFtjfSLaXk8AY8ZHirngf8K46BPFSNEx3xG4uOw+rmPeTLGEXSfs+Fa90+6tvYqJEekE1RQmWCAV3zkwK48lPMTYHmBRO5QTCQmDy4sBIa4jVGIGxX3bA/SNNOVtdu7BIjQwU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671012; c=relaxed/simple; bh=2uEtFVwi+wdX8OeRQHgPRlqO3x1jsKN8u5e4kKD7Awk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=UngBTZxVV9NNdteKB5qWlBKfKavOZ0gdZP2JEFKUjFeILYC8xY2LGvZFfAp7ile8mCkUGNZWKLbbKuLegzJRB1SZ9hHZ3muDcLLkLdmrM9p7mCcnzDWNK3oM7Ic8pjQCctwNub6bAJzQ89WEXX2BXh4Ia2/Cq2w7uHtlLLSIN2Q= 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=DWsfMiFo; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="DWsfMiFo" 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 55N98YXc008317; Mon, 23 Jun 2025 11:29:52 +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= W7lja2ibWXfiVo4eDJLx4tgeIggbs4JL9GjrFt29DoI=; b=DWsfMiFo4XQf8nGM 8e4pmvL84fmFcsCdJfZSvho2FjPkbkXoQXX1/+kM8iqHuMhgQl7ypn4hSUR8wtTl 7Z0AzEVeEeNRSmpZ4Eo1Yg+23Ek9jsPTFZRdTdfoEjoH8Wb3Ng0mzR09CTVwgFoc NNC24WJ8JLQ4z6ZIybVGbNfNtUgYrwSFO0+pnVUCVemT2I6i7yWP/QZPJqFEQYXa Qh7h2H8lcEWJB70J8+jxPuqzetxWLU8/7UfSVWMASAvGO2FIuZEdd7XY945MbgqV 6vWP5gJbsag46UkQcBV0Z0lM8ByFQ4Q0rduFcsieVJ4m3sThPPBwyo7V3LB1rbqu yNPkhg== 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 47dhvbevd8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:52 +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 E9D8340044; Mon, 23 Jun 2025 11:28:33 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 845475C3DD2; Mon, 23 Jun 2025 11:27:27 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:27 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:12 +0200 Subject: [PATCH 07/13] Documentation: perf: stm32: add ddrperfm support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-7-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 The DDRPERFM is the DDR Performance Monitor embedded in STM32MPU SoC. This documentation introduces the DDRPERFM, the stm32-ddr-pmu driver supporting it and how to use it with the perf tool. Signed-off-by: Cl=C3=A9ment Le Goffic --- Documentation/admin-guide/perf/index.rst | 1 + Documentation/admin-guide/perf/stm32-ddr-pmu.rst | 86 ++++++++++++++++++++= ++++ 2 files changed, 87 insertions(+) diff --git a/Documentation/admin-guide/perf/index.rst b/Documentation/admin= -guide/perf/index.rst index 072b510385c4..33aedc4ee5c3 100644 --- a/Documentation/admin-guide/perf/index.rst +++ b/Documentation/admin-guide/perf/index.rst @@ -29,3 +29,4 @@ Performance monitor support cxl ampere_cspmu mrvl-pem-pmu + stm32-ddr-pmu diff --git a/Documentation/admin-guide/perf/stm32-ddr-pmu.rst b/Documentati= on/admin-guide/perf/stm32-ddr-pmu.rst new file mode 100644 index 000000000000..5b02bf44dd7a --- /dev/null +++ b/Documentation/admin-guide/perf/stm32-ddr-pmu.rst @@ -0,0 +1,86 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +STM32 DDR Performance Monitor (DDRPERFM) +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +The DDRPERFM is the DDR Performance Monitor embedded in STM32MPU SoC. +The DDR controller provides events to DDRPERFM, once selected they are cou= nted in the DDRPERFM +peripheral. + +In MP1 family, the DDRPERFM is able to count 4 different events at the sam= e time. +However, the 4 events must belong to the same set. +One hardware counter is dedicated to the time counter, `time_cnt`. + +In MP2 family, the DDRPERFM is able to select between 44 different DDR eve= nts. +As for MP1, there is a dedicated hardware counter for the time. +It is incremented every 4 DDR clock cycles. +All the other counters can be freely allocated to count any other DDR even= t. + +The stm32-ddr-pmu driver relies on the perf PMU framework to expose the co= unters via sysfs: + +On MP1: + + .. code-block:: bash + + $ ls /sys/bus/event_source/devices/stm32_ddr_pmu/events/ + cactive_ddrc perf_lpr_req_with_no_credit perf_op_= is_wr + ctl_idle perf_lpr_xact_when_critical perf_sel= fresh_mode + dfi_lp_req perf_op_is_activate perf_wr_= xact_when_critical + dfi_lp_req_cpy perf_op_is_enter_powerdown time_cnt + perf_hpr_req_with_no_credit perf_op_is_rd + perf_hpr_xact_when_critical perf_op_is_refresh + +On MP2: + + .. code-block:: bash + + $ ls /sys/bus/event_source/devices/stm32_ddr_pmu/events/ + dfi_is_act perf_hpr_req_with_nocredit perf_op_is_spec_ref + dfi_is_mpc perf_hpr_xact_when_critical perf_op_is_wr + dfi_is_mrr perf_lpr_req_with_nocredit perf_op_is_zqcal + dfi_is_mrw perf_lpr_xact_when_critical perf_rank + dfi_is_mwr perf_op_is_act perf_raw_hazard + dfi_is_mwra perf_op_is_crit_ref perf_rdwr_transitions + dfi_is_preab perf_op_is_enter_powdn perf_read_bypass + dfi_is_prepb perf_op_is_enter_selfref perf_war_hazard + dfi_is_rd perf_op_is_mwr perf_waw_hazard + dfi_is_rda perf_op_is_pre perf_window_limit_re= ached_rd + dfi_is_refab perf_op_is_pre_for_others perf_window_limit_re= ached_wr + dfi_is_refpb perf_op_is_pre_for_rdwr perf_wr_xact_when_cr= itical + dfi_is_wr perf_op_is_rd time_cnt + dfi_is_wra perf_op_is_rd_activate + perf_act_bypass perf_op_is_ref + + +The perf PMU framework is usually invoked via the 'perf stat' tool. + + +Example: + + .. code-block:: bash + + $ perf stat --timeout 60000 -e stm32_ddr_pmu/dfi_is_act/,\ + > stm32_ddr_pmu/dfi_is_rd/,\ + > stm32_ddr_pmu/dfi_is_wr/,\ + > stm32_ddr_pmu/dfi_is_refab/,\ + > stm32_ddr_pmu/dfi_is_mrw/,\ + > stm32_ddr_pmu/dfi_is_rda/,\ + > stm32_ddr_pmu/dfi_is_wra/,\ + > stm32_ddr_pmu/dfi_is_mrr/,\ + > stm32_ddr_pmu/time_cnt/ \ + > -a sleep 5 + + Performance counter stats for 'system wide': + + 481025 stm32_ddr_pmu/dfi_is_act/ + 732166 stm32_ddr_pmu/dfi_is_rd/ + 144926 stm32_ddr_pmu/dfi_is_wr/ + 644154 stm32_ddr_pmu/dfi_is_refab/ + 0 stm32_ddr_pmu/dfi_is_mrw/ + 0 stm32_ddr_pmu/dfi_is_rda/ + 0 stm32_ddr_pmu/dfi_is_wra/ + 0 stm32_ddr_pmu/dfi_is_mrr/ + 752347686 stm32_ddr_pmu/time_cnt/ + + 5.014910750 seconds time elapsed --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 176B0238C09; Mon, 23 Jun 2025 09:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671019; cv=none; b=hTIi2cX9zOXbqxNu6UO2xELtpmclPtMjFlGJ+3c5IF7V8bpSVESADwZ76WVyNx8XfvWq+nE8EyI1gbVF7cReZfOfXnULm0E44e2Bi2Vc1nwVFxYuBPOFPVbB9ZD90H7mIz3ZMTBCFHZ2J8jSidwpu5XJ14WeQKzmhEA3v7l5gZ4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671019; c=relaxed/simple; bh=eC5DTlfNVMfG44OCEWsxiMdL6lZhTGPuEYkXHWK7M7M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=T/mH+x6OEYwfZhxxfjsfRzn9fEOpPk8alEbZNAYF/lUzqJ11HtjMlWNaPPGoJuTKBmcF41r2c3vYFReZSYucMj3vrdPk8izKSYNqredD5bUyUfNl+Z81Ch82HHN/C2QP9el4agGhQioskmUsn4pwD6Uak9W4pNljxH/x7xXSq10= 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=TLmOwndv; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="TLmOwndv" Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N7hfSA011850; Mon, 23 Jun 2025 11:30:03 +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= pTsJ/+q2VqHoq0n9xQoDMSflxAq/mEpvyBw7OSlMNVw=; b=TLmOwndvBslAgTa7 TRp1M7ievNHL7EPTswHRzuAHl8ZKIZ+qVBhFC4noOmeYaRSsKV3dnqH4mh5iqOJC 7grku4sOD0xJg0yqyOi52ypfCYt0jDzN9YCG1GlsZ09l9mwswuy5S97f/eiX3CFT VuXoFfNNNOcyKcrNN2DIMymw+UCZLapQ2Eh77M+XHihruAKV/MkSn0A+A++E0r5i y1CGuHWeZFRKNhoR4wM7k5HTZCgmcndjogKz1RamJkOiTCirWQI8pNqcf65qql50 kdMwWL81GtlIO/a2iFSbNhwWjGBghmRa82teXLkp+tdYtNFAzYMLXKtAFhezZL/5 QdVLOw== 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 47dm3372rk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:30:03 +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 3113440057; Mon, 23 Jun 2025 11:28:38 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6856E5C2DF9; Mon, 23 Jun 2025 11:27:28 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:28 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:13 +0200 Subject: [PATCH 08/13] MAINTAINERS: add myself as STM32 DDR PMU maintainer Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-8-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 Add Cl=C3=A9ment Le Goffic as STM32 DDR PMU maintainer. Signed-off-by: Cl=C3=A9ment Le Goffic --- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index c3f7fbd0d67a..4211133e731e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -23451,6 +23451,13 @@ S: Maintained F: Documentation/devicetree/bindings/power/supply/st,stc3117.yaml F: drivers/power/supply/stc3117_fuel_gauge.c =20 +ST STM32 DDR PMU +M: Cl=C3=A9ment Le Goffic +S: Maintained +F: Documentation/admin-guide/perf/stm32-ddr-pmu.rst +F: Documentation/devicetree/bindings/perf/st,stm32-ddr-pmu.yaml +F: drivers/perf/stm32_ddr-pmu.c + ST STM32 FIREWALL M: Gatien Chevallier S: Maintained --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 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 9E0FE238177; Mon, 23 Jun 2025 09:30:16 +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=1750671018; cv=none; b=fF8S7GN1Klv+ExVipCOlLO5+MT8ZXhDcYYBhkj14axmZ+3rmhYK7rZkHQUojvxJATWZJd5G8utVXba6K0HjdPLjNLbMKUs7+zTVhxvN+RlQd/jBL3YwHYtpUoY4LA5ds6RJD2XL2zDpjTgJkBVraglfCc/8eVYHcVYgFaGKSjJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671018; c=relaxed/simple; bh=gftIvYHzveImR+MPjt/uzTmWFEBJ3zj0CJjUcncYRD4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=QdzWlgSdM490UwPNgFPhbttkjygcAynM21L0lOC5dIQdeWKs0yLFbgve6o6/sbR78tQI2KyZp3bTVmkwFXKbL3Ba1wcRy/crYdta2lxobeJBauPcgEapyeSj/pEiubeE6Oi+jH7mLcb8pCkCYyOOmGLK1rEQxtgFxJET60nKZDk= 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=gyMSJr0V; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="gyMSJr0V" 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 55N91Vab013223; Mon, 23 Jun 2025 11:30:03 +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= +oFosf+Y2aWw9hUSMPebh2RDsEkKVFT8bx1JKOIHJNs=; b=gyMSJr0V04FlOzHe roSRZalnJmYlmpFevyOMpMPPNLreng2DyS9LM7asYkyRkoa2gwlV3nuH7pM/IYBs NArbNtTwxfWOmuS8KGtFSC9yMegoP388Nka89oF2jBHMaleUZsdO+lCqjag5iPsN g5A9rYgIH3WFkdzBrHcLQqxx+pdBX13ClNKNd9e0j3OFIYwmZSIsMQFlVIyGWHKi WJfmQF+vGdLTlQY0vbYZuNPD3Qtk4TjrnETo4sqqBT4LipabxKBwI9eVqOBLSYwu FtMMuSS7RAbDHFwlvDX1bFV7obRr+XbnNlnMMOM5T/17qmI2D+rGfz3exwPyfSYL D/bI9Q== 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 47dhvbeve3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:30:03 +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 2A9BB40056; Mon, 23 Jun 2025 11:28:38 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 5563A5C3DE4; Mon, 23 Jun 2025 11:27:29 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:29 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:14 +0200 Subject: [PATCH 09/13] ARM: dts: stm32: add ddrperfm on stm32mp131 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-9-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 The DDRPERFM is the DDR Performance Monitor embedded in STM32MP131 SoC. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm/boot/dts/st/stm32mp131.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/st/stm32mp131.dtsi b/arch/arm/boot/dts/st/st= m32mp131.dtsi index 492bcf586361..e097723789aa 100644 --- a/arch/arm/boot/dts/st/stm32mp131.dtsi +++ b/arch/arm/boot/dts/st/stm32mp131.dtsi @@ -998,6 +998,13 @@ iwdg2: watchdog@5a002000 { status =3D "disabled"; }; =20 + ddrperfm: perf@5a007000 { + compatible =3D "st,stm32mp131-ddr-pmu"; + reg =3D <0x5a007000 0x400>; + clocks =3D <&rcc DDRPERFM>; + resets =3D <&rcc DDRPERFM_R>; + }; + rtc: rtc@5c004000 { compatible =3D "st,stm32mp1-rtc"; reg =3D <0x5c004000 0x400>; --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 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 5DD2923D288; Mon, 23 Jun 2025 09:30:16 +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=1750671019; cv=none; b=meRPrts2BiK04D/NAt1eE+ScymblHIun1YMkmRSHcPZewVVMbPgxlhCltdJSnySgr6kMgsXfe4aLI2AHtTtvH/yt+FbgKQaIyOiDa9JFKETcGoduwbtwd77fIxiN929odOnxm9YZZBl6X6sIbskVWvEE39GY2Oz6jlC2LfJAeQQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671019; c=relaxed/simple; bh=UV0F3MbZJ1j5D6Nw46DTCJ1cIrxJmIJchC6GwHLuKOg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=Gc/zEyC/zstTGvQra1wLTeqx1q3o9nVZmFNciw0iO8BTpprVW14MnJv0O+6CRx8eMQ+avVUvKSUZnxEpYxsE5OiAzhfoucoupdPex0vaZF4GAn8KQF/tsbEbW1yCW94aNEEeuTS9le/0fCa9ICtJ+RCfm11uWVQlzOJJcx2e970= 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=gtkfvfi0; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="gtkfvfi0" Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N6PVJ7014356; Mon, 23 Jun 2025 11:30:04 +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= 7SRDiOcsRxqow4wRzu0HPujQCXvPPYcNL51XFVNyyKc=; b=gtkfvfi0EeCgWI/i EvMPTj8mnh8/WvIVKSoH8UE38M4T8Zy0jb77UQk5N/3gE1zNkFh9IZZWnEP1Is3D hSR3ESCUn3nbc4FJYs0lS/mmnm4dIFLTLfv5Mr0DNX7berQ3bHBPURKsNRSp/MFM g/p2Tq+b5dj6pjBrpmY1unNVNjO/dGtKIo3RqkXfkqidt1OqFV05oAGHC+ihTPWC Sq7dz0pByaVUhwbAey7SqzzeWVqEgKFthplYKFc0GYn70dFY/WUvjE00BT6TpVg0 +UBFUr5ifjbx2GCFyyccugLArwaxa2MnibaNtZL4juCLdm1CCMueK6+NAY+JwsEb 13SDhQ== 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 47dkmjemrd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:30:04 +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 25C7E40055; Mon, 23 Jun 2025 11:28:38 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 446965C3DE8; Mon, 23 Jun 2025 11:27:30 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:29 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:15 +0200 Subject: [PATCH 10/13] ARM: dts: stm32: add ddrperfm on stm32mp151 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-10-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 The DDRPERFM is the DDR Performance Monitor embedded in STM32MP151 SoC. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm/boot/dts/st/stm32mp151.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/st= m32mp151.dtsi index 0daa8ffe2ff5..82b1d585a099 100644 --- a/arch/arm/boot/dts/st/stm32mp151.dtsi +++ b/arch/arm/boot/dts/st/stm32mp151.dtsi @@ -383,6 +383,13 @@ usbphyc_port1: usb-phy@1 { }; }; =20 + ddrperfm: perf@5a007000 { + compatible =3D "st,stm32mp151-ddr-pmu"; + reg =3D <0x5a007000 0x400>; + clocks =3D <&rcc DDRPERFM>; + resets =3D <&rcc DDRPERFM_R>; + }; + rtc: rtc@5c004000 { compatible =3D "st,stm32mp1-rtc"; reg =3D <0x5c004000 0x400>; --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 9CD7723F409; Mon, 23 Jun 2025 09:30:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671019; cv=none; b=NQYYs+1XlfjgsV8ycwGOH6OJ0JZmC+8oR896mZJNNGzxP4J1Um0XtbycDxB1ECEs0S9HlLg+Uwq+Q8IGhonjd1PwqvEzJQE1zPYIuK4Qbh46uQyOwpv08bV2C733TYS/2RZANZqPEnO+/7fXMoCftNOY09kYbV8Jyjk83+R5edQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671019; c=relaxed/simple; bh=jDxrKSVKGmymiWgFfc3XLLghQxyNU894E3heEmmTqGc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=UQHF312GqmSHNAkUSa3v1uwePtTXL7OPnT3/VdZZ+tPVV4WHNgo++rlvlERUcsiVdftYFoB4rqc3PuZxjZ2fgrEtm1YhH1GTWHOFVl4coMTeeDRSlDz9jln/obs7HwJoN1AgpICqRnGtks5XOGZXdJCLFt9nlLClbTi9VfuvmBE= 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=tfTKsqoN; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="tfTKsqoN" Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N9FWgh021128; Mon, 23 Jun 2025 11:30:03 +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= SuBSodyyqcKAz1sJaFnr1XdxWrUs+npg1uqS49q9/0Y=; b=tfTKsqoN8IhNoUxP RVIKVe+P/8Q9oMNMZ2lQJpg1UIpGxmqE8Wjms1EfUFDAmJd/yn56VMlGKDDEtGjg 4+f+a0dEXakxTp4Vws/ebiPiDhpCM8I7yF64kmJAXeylzlgKvOWFhKqR71vOH1Bv UlbZcWgZ5CUc4rm9uRMm1nQtstBKPjRPYHWtHKy3xsSrL2FnRxh3gdS+Rpf6gmEh vYUak6G/PVBCVtFHDL7LgXR/cx2a9dvb4xRXHCmkAP9GqYViE/x5EqA+xIDvGLgp GawEqRZ/2CMhUfuqSatsBkfV+tdgPvAIv2OgcAHu82t9LfNGhQaHWROk/psZD5aQ bPMKYg== 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 47e6a6cjrb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:30:03 +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 2515A40054; Mon, 23 Jun 2025 11:28:37 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2A1475C2DF3; Mon, 23 Jun 2025 11:27:31 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:30 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:16 +0200 Subject: [PATCH 11/13] arm64: dts: st: add ddrperfm on stm32mp251 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-11-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 The DDRPERFM is the DDR Performance Monitor embedded in STM32MP251 SoC. Keep the node disabled at SoC level as it requires the property `st,dram-type` which is provided in board dtsi file. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm64/boot/dts/st/stm32mp251.dtsi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/arm64/boot/dts/st/stm32mp251.dtsi b/arch/arm64/boot/dts/s= t/stm32mp251.dtsi index 0683c2d5cb6f..7f138324610a 100644 --- a/arch/arm64/boot/dts/st/stm32mp251.dtsi +++ b/arch/arm64/boot/dts/st/stm32mp251.dtsi @@ -1577,5 +1577,12 @@ exti2: interrupt-controller@46230000 { <0>, <&intc GIC_SPI 213 IRQ_TYPE_LEVEL_HIGH>; /* EXTI_70 */ }; + + ddrperfm: perf@48041000 { + compatible =3D "st,stm32mp251-ddr-pmu"; + reg =3D <0x48041000 0x400>; + access-controllers =3D <&rcc 104>; + status =3D "disabled"; + }; }; }; --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 619DB19938D; Mon, 23 Jun 2025 09:30:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671008; cv=none; b=KxeQV+qHvpVGk202Slv955vZlotF45gpt19GlyG6CUF2fnt0UzoO5lsgKegNiv8htbn7g5I8t3ZchZ4XRrGG5KKviJHQWkb+wKqRdw/eTRpbnec1DfvoNM/Iv8qWYRghoe0g0CIhyHeNBPwcmbrqZ0LRXJAf496raCyOJDRAXSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671008; c=relaxed/simple; bh=2P5ny0jXq0Zka5S9YZS8xJq7IT9AiULqloVqfFuXhN8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=o6zCcxUIHxwXAIaRaXGxqpru0/zBU6O/Y1e/C91D0bqFf1SsP3QAI4YwfTuWX54yxLAs4pW41m+arSCch+USeAbCSIVb4wUD347moprBVuHx2vX01BssjzIV2xSGnVeC3eJNU05bQo5kqS5iWo/bGoW2XIOx7nW2ebdZ4kKysi8= 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=0WV19Me8; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="0WV19Me8" Received: from pps.filterd (m0288072.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N8d1RM015478; Mon, 23 Jun 2025 11:29:52 +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= JMNBycwcd7wyfwtdlkzqGW8/SiXBU1Q2CVVSljevQu8=; b=0WV19Me8R8tRuy65 ebSb8qxl2wP57/f12O4bhW4vU3d457E251WWz6hAsSLq8h3gp6qR87WnSfO/ALfu av+RlCFPWzA0cRhu5cWDp0I2/li3Zht+I8Gteii1c3Zi5SnvQAHMakYdgoUqeid6 uPlAJhVDCvB6vX/gwDus1PaHdyvo/8T8G7bINdSJnHl7vV/YEbjLkG/Z9kgSiw42 WCILgGOmx2iYs6uu1wxjkIuXrnCBqkGEQqxi2YX4Vu+d8q0stYKpYnVsk2AkaY7E bIr+0wN59AuzsH8AGAOdFzgAYo7tAzAjDfkTabLtJRZdlaZLtoUsRC6olS8DiGtj tqOYuA== 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 47dj5nfcb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:52 +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 D296A40059; Mon, 23 Jun 2025 11:28:41 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1D0E15C3DF8; Mon, 23 Jun 2025 11:27:32 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:31 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:17 +0200 Subject: [PATCH 12/13] arm64: dts: st: support ddrperfm on stm32mp257f-dk Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-12-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 Configure DDRPERFM node on stm32mp257f-dk board. Disable the node as DDRPERFM will produce an error message if it's clock (shared with the DDRCTRL on STM32MP25x) is secured by common bootloaders. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm64/boot/dts/st/stm32mp257f-dk.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts b/arch/arm64/boot/dt= s/st/stm32mp257f-dk.dts index a278a1e3ce03..e59ef18de7c3 100644 --- a/arch/arm64/boot/dts/st/stm32mp257f-dk.dts +++ b/arch/arm64/boot/dts/st/stm32mp257f-dk.dts @@ -77,6 +77,11 @@ &arm_wdt { status =3D "okay"; }; =20 +&ddrperfm { + st,dram-type =3D <0>; + status =3D "disabled"; +}; + &scmi_regu { scmi_vddio1: regulator@0 { regulator-min-microvolt =3D <1800000>; --=20 2.43.0 From nobody Wed Oct 8 23:40:10 2025 Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (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 B4A9923E324; Mon, 23 Jun 2025 09:30:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.132.182.106 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671012; cv=none; b=pWR98jYrsXFaWSDIYIydkLONaCkg9uA6z+pgu5l+KU96svIL9BeBhjd6nQzBuOOjObZ3Qn37Dho3ls+vec8Xebsk5x5/kOmhHPNoUujgQsh0APAz87HgDum13mFgxvoLkpX0o60aMWVtRopgrcW2pGfj8fNz+TF+cKsnKfN8sQw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750671012; c=relaxed/simple; bh=C7EnqfKQQ5fQB9pf3iXHh9xmgRkHyNyUGfDlPdr64AQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JXTzVchCktEcPVc67rtchVjTnZ19bMpf4nn/bZqfJtJsKbTY9zIhwfWErlhEYJtO2CgNHl67YYtJ7OzvXERbTlzRzjnL+i6Iepdg7pBANj4ptPObwqetEBaof9vUetXo+RxUTpPC+kqNQW3BAVpjOQz7hV6ebq/CFQe4aNQASBg= 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=Z+2q4qKV; arc=none smtp.client-ip=185.132.182.106 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="Z+2q4qKV" Received: from pps.filterd (m0369458.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55N9ACnK010876; Mon, 23 Jun 2025 11:29:52 +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= qLs/ihWxyBQGt91t9+rNI5uJsOv140RQYF6cNc+ahBI=; b=Z+2q4qKV4f0Z8LEW m4tCtpd19msC3UE1sCaRH7+UOcDnCAJE5ykaAVF1M8mC8hToHLPqcp4VCPtVhGqz lnBET+Scj9UquCsRusQn2PLbkzvB2a5MulzLsUMyY0QvSOGpQ/fKuJMStQAgb9Zw W+Yvk4xgWyWbVYyGbqbhnLZKCeglJqRDHBiQcHgLSg+xiBSbdvAPCOsirlCKL4uK 0/hISR+Y6bJJ/qUiiF4BTmTZON7bshzt7i5rOxbCkKQfFQoEcE0v9fzw83w8oPGO EVQO1hZxBg44ggyVbzhRmPhcAf3ybjAaroSPf4BgV+JzADBgSfNFba57mcefpez2 OJb4qA== 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 47e6a6cjq9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Jun 2025 11:29:52 +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 C789240058; Mon, 23 Jun 2025 11:28:41 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node2.st.com [10.75.129.70]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 0C6135C3DEC; Mon, 23 Jun 2025 11:27:33 +0200 (CEST) Received: from localhost (10.252.18.29) by SHFDAG1NODE2.st.com (10.75.129.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 23 Jun 2025 11:27:32 +0200 From: =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= Date: Mon, 23 Jun 2025 11:27:18 +0200 Subject: [PATCH 13/13] arm64: dts: st: support ddrperfm on stm32mp257f-ev1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20250623-ddrperfm-upstream-v1-13-7dffff168090@foss.st.com> References: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> In-Reply-To: <20250623-ddrperfm-upstream-v1-0-7dffff168090@foss.st.com> To: Will Deacon , Mark Rutland , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue , Philipp Zabel , Jonathan Corbet , Gatien Chevallier , Michael Turquette , Stephen Boyd , Gabriel Fernandez CC: , , , , , , , =?utf-8?q?Cl=C3=A9ment_Le_Goffic?= X-Mailer: b4 0.15-dev-c25d1 X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE2.st.com (10.75.129.70) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-23_03,2025-06-23_02,2025-03-28_01 Configure DDRPERFM node on stm32mp257f-ev1 board. Disable the node as DDRPERFM will produce an error message if it's clock (shared with the DDRCTRL on STM32MP25x) is secured by common bootloaders. Signed-off-by: Cl=C3=A9ment Le Goffic --- arch/arm64/boot/dts/st/stm32mp257f-ev1.dts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts b/arch/arm64/boot/d= ts/st/stm32mp257f-ev1.dts index 2f561ad40665..a48fb7b33198 100644 --- a/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts +++ b/arch/arm64/boot/dts/st/stm32mp257f-ev1.dts @@ -123,6 +123,11 @@ csi_source: endpoint { }; }; =20 +&ddrperfm { + st,dram-type =3D <2>; + status =3D "disabled"; +}; + &dcmipp { status =3D "okay"; port { --=20 2.43.0